本文整理汇总了C++中PlayerNoise函数的典型用法代码示例。如果您正苦于以下问题:C++ PlayerNoise函数的具体用法?C++ PlayerNoise怎么用?C++ PlayerNoise使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PlayerNoise函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Chaingun_Fire
//.........这里部分代码省略.........
vec3_t offset;
int damage;
int kick = 2;
if (!ent) {
return;
}
if (deathmatch->value) {
damage = 6;
} else {
damage = 8;
}
if (ent->client->ps.gunframe == 5) {
PF_StartSound(ent, CHAN_AUTO, SV_SoundIndex("weapons/chngnu1a.wav"), 1, ATTN_IDLE, 0);
}
if ((ent->client->ps.gunframe == 14) && !(ent->client->buttons & BUTTON_ATTACK)) {
ent->client->ps.gunframe = 32;
ent->client->weapon_sound = 0;
return;
} else if ((ent->client->ps.gunframe == 21) && (ent->client->buttons & BUTTON_ATTACK) &&
ent->client->pers.inventory[ent->client->ammo_index]) {
ent->client->ps.gunframe = 15;
} else {
ent->client->ps.gunframe++;
}
if (ent->client->ps.gunframe == 22) {
ent->client->weapon_sound = 0;
PF_StartSound(ent, CHAN_AUTO, SV_SoundIndex("weapons/chngnd1a.wav"), 1, ATTN_IDLE, 0);
} else {
ent->client->weapon_sound = SV_SoundIndex("weapons/chngnl1a.wav");
}
ent->client->anim_priority = ANIM_ATTACK;
if (ent->client->ps.pmove.pm_flags & PMF_DUCKED) {
ent->s.frame = FRAME_crattak1 - (ent->client->ps.gunframe & 1);
ent->client->anim_end = FRAME_crattak9;
} else {
ent->s.frame = FRAME_attack1 - (ent->client->ps.gunframe & 1);
ent->client->anim_end = FRAME_attack8;
}
if (ent->client->ps.gunframe <= 9) {
shots = 1;
} else if (ent->client->ps.gunframe <= 14) {
if (ent->client->buttons & BUTTON_ATTACK) {
shots = 2;
} else {
shots = 1;
}
} else {
shots = 3;
}
if (ent->client->pers.inventory[ent->client->ammo_index] < shots) {
shots = ent->client->pers.inventory[ent->client->ammo_index];
}
if (!shots) {
if (level.time >= ent->pain_debounce_time) {
PF_StartSound(ent, CHAN_VOICE, SV_SoundIndex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
ent->pain_debounce_time = level.time + 1;
}
NoAmmoWeaponChange(ent);
return;
}
for (i = 0; i < 3; i++) {
ent->client->kick_origin[i] = crandom() * 0.35;
ent->client->kick_angles[i] = crandom() * 0.7;
}
for (i = 0; i < shots; i++) {
/* get start / end positions */
AngleVectors(ent->client->v_angle, forward, right, up);
r = 7 + crandom() * 4;
u = crandom() * 4;
VectorSet(offset, 0, r, u + ent->viewheight - 8);
P_ProjectSource(ent->client, ent->s.origin, offset, forward, right, start);
fire_bullet(ent, start, forward, damage, kick, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MOD_CHAINGUN);
}
/* send muzzle flash */
PF_WriteByte(svc_muzzleflash);
PF_WriteShort(ent - g_edicts);
PF_WriteByte(MZ_CHAINGUN1 + shots - 1);
SV_Multicast(ent->s.origin, MULTICAST_PVS);
PlayerNoise(ent, start, PNOISE_WEAPON);
if (!((int) dmflags->value & DF_INFINITE_AMMO)) {
ent->client->pers.inventory[ent->client->ammo_index] -= shots;
}
}
开发者ID:greck2908,项目名称:qengine,代码行数:101,代码来源:weapon.c
示例2: fire_rail
void
fire_rail(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick)
{
vec3_t from;
vec3_t end;
trace_t tr;
edict_t *ignore;
int mask;
qboolean water;
if (!self)
{
return;
}
VectorMA(start, 8192, aimdir, end);
VectorCopy(start, from);
ignore = self;
water = false;
mask = MASK_SHOT | CONTENTS_SLIME | CONTENTS_LAVA;
while (ignore)
{
tr = gi.trace(from, NULL, NULL, end, ignore, mask);
if (tr.contents & (CONTENTS_SLIME | CONTENTS_LAVA))
{
mask &= ~(CONTENTS_SLIME | CONTENTS_LAVA);
water = true;
}
else
{
if ((tr.ent->svflags & SVF_MONSTER) || (tr.ent->client) ||
(tr.ent->solid == SOLID_BBOX))
{
ignore = tr.ent;
}
else
{
ignore = NULL;
}
if ((tr.ent != self) && (tr.ent->takedamage))
{
T_Damage(tr.ent, self, self, aimdir, tr.endpos, tr.plane.normal,
damage, kick, 0, MOD_RAILGUN);
}
else
{
ignore = NULL;
}
}
VectorCopy(tr.endpos, from);
}
/* send gun puff / flash */
gi.WriteByte(svc_temp_entity);
gi.WriteByte(TE_RAILTRAIL);
gi.WritePosition(start);
gi.WritePosition(tr.endpos);
gi.multicast(self->s.origin, MULTICAST_PHS);
if (water)
{
gi.WriteByte(svc_temp_entity);
gi.WriteByte(TE_RAILTRAIL);
gi.WritePosition(start);
gi.WritePosition(tr.endpos);
gi.multicast(tr.endpos, MULTICAST_PHS);
}
if (self->client)
{
PlayerNoise(self, tr.endpos, PNOISE_IMPACT);
}
}
开发者ID:Nekrofage,项目名称:yquake2,代码行数:77,代码来源:g_weapon.c
示例3: weapon_supershotgun_fire
void weapon_supershotgun_fire (edict_t *ent)
{
vec3_t start;
vec3_t forward, right;
vec3_t offset;
vec3_t v;
iteminfo_t *info = getWornItemInfo(ent, 0);
int damage;
int ammo;
int kick = 9;
int count = (info->arg4 + (int)(info->arg5 * ent->client->pers.skill[3])) / 2;
damage = (int) ceil(info->arg1 + info->arg2 * (float) ent->client->pers.skill[1]) * 0.5; //(info->arg4 / 2));
damage /= count;
// damage = info->arg1 + (int) ceil(info->arg2 * ent->client->pers.skill[1]);
AngleVectors (ent->client->v_angle, forward, right, NULL);
VectorScale (forward, -2, ent->client->kick_origin);
ent->client->kick_angles[0] = -2;
VectorSet(offset, 0, 8, ent->viewheight-8);
P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
damage = applyWeaponBonuses(ent, damage, count);
if (is_quad)
kick *= 4;
v[PITCH] = ent->client->v_angle[PITCH];
v[ROLL] = ent->client->v_angle[ROLL];
if (ent->client->ps.gunframe == 7) {
v[YAW] = ent->client->v_angle[YAW] - 5;
AngleVectors (v, forward, NULL, NULL);
fire_shotgun (ent, start, forward, damage, kick, info->arg6, info->arg6, count, MOD_SSHOTGUN);
if (info->arg7 == 0) {
v[YAW] = ent->client->v_angle[YAW] + 5;
AngleVectors (v, forward, NULL, NULL);
fire_shotgun (ent, start, forward, damage, kick, info->arg6, info->arg6, count, MOD_SSHOTGUN);
}
} else {
v[YAW] = ent->client->v_angle[YAW] + 5;
AngleVectors (v, forward, NULL, NULL);
fire_shotgun (ent, start, forward, damage, kick, info->arg6, info->arg6, count, MOD_SSHOTGUN);
}
ent->client->silencer_shots-=3;
// send muzzle flash
if ((ent->client->silencer_shots > 0) && (ent->client->pers.skill[58] > 7)) {
ent->client->silencer_shots -= 1;
} else {
gi.WriteByte (svc_muzzleflash);
gi.WriteShort (ent-g_edicts);
gi.WriteByte (MZ_SSHOTGUN | is_silenced);
gi.multicast (ent->s.origin, MULTICAST_PVS);
}
ent->client->ps.gunframe++;
PlayerNoise(ent, start, PNOISE_WEAPON);
// if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) ) {
ammo = 1;
if (info->arg7 == 0) {
ammo = 2;
}
ent->client->pers.inventory[ent->client->ammo_index] -= ammo;
// }
}
开发者ID:Chromozon,项目名称:Quake2_Giex-G10,代码行数:67,代码来源:p_weapon.c
示例4: P_FallingDamage
/*
=================
P_FallingDamage
=================
*/
void P_FallingDamage (edict_t *ent)
{
float delta;
int damage;
vec3_t dir;
if (ent->s.modelindex != 255)
return; // not in the player model
if (ent->movetype == MOVETYPE_NOCLIP)
return;
if ((ent->client->oldvelocity[2] < 0) && (ent->velocity[2] > ent->client->oldvelocity[2]) && (!ent->groundentity))
{
// if we are airborne and using double-jump, we shouldn't take damage
//FIXME: why are we taking fall damage when we are in the air in the first place???
if (ent->v_flags & SFLG_DOUBLEJUMP)
return;
delta = ent->client->oldvelocity[2];
}
else
{
if (!ent->groundentity)
return;
delta = ent->velocity[2] - ent->client->oldvelocity[2];
}
delta = delta*delta * 0.0001;
//K03 Begin
if (ent->client->thrusting)
return;
if (ent->client->hook_state == HOOK_ON)
return;
//K03 End
// never take falling damage if completely underwater
if (ent->waterlevel == 3)
return;
if (ent->waterlevel == 2)
delta *= 0.25;
if (ent->waterlevel == 1)
delta *= 0.5;
if (delta < 1)
return;
if (delta < 15)
{
if ((ent->client->pers.inventory[ITEM_INDEX(FindItem("Stealth Boots"))] < 1))
{
if((ent->myskills.abilities[CLOAK].disable) || (ent->myskills.abilities[CLOAK].current_level < 1))
{
// morphed players don't make footsteps
if (!ent->mtype)
ent->s.event = EV_FOOTSTEP;
PlayerNoise(ent, ent->s.origin, PNOISE_SELF); //ponko
// if the player is not crouched, then alert monsters of footsteps
if (!(ent->client->ps.pmove.pm_flags & PMF_DUCKED))
ent->lastsound = level.framenum;
}
}
return;
}
ent->client->fall_value = delta*0.5;
if (ent->client->fall_value > 40)
ent->client->fall_value = 40;
ent->client->fall_time = level.time + FALL_TIME;
if (delta > 30)
{
if (ent->health > 0)
{
if (delta >= 55)
ent->s.event = EV_FALLFAR;
else
ent->s.event = EV_FALL;
PlayerNoise(ent, ent->s.origin, PNOISE_SELF); //ponko
}
ent->pain_debounce_time = level.time; // no normal pain sound
damage = (delta-30)/2;
if (damage < 1)
damage = 1;
VectorSet (dir, 0, 0, 1);
if (!deathmatch->value || !((int)dmflags->value & DF_NO_FALLING) )
T_Damage (ent, world, world, dir, ent->s.origin, vec3_origin, damage, 0, 0, MOD_FALLING);
}
else
{
ent->s.event = EV_FALLSHORT;
PlayerNoise(ent, ent->s.origin, PNOISE_SELF); //ponko
//.........这里部分代码省略.........
开发者ID:Ciclop,项目名称:quake-2-vortex,代码行数:101,代码来源:p_view.c
示例5: Machinegun_Fire
void Machinegun_Fire (edict_t *ent)
{
int i;
vec3_t start;
vec3_t forward, right;
vec3_t angles;
int damage = 8;
int kick = 2;
vec3_t offset;
if (!(ent->client->buttons & BUTTON_ATTACK))
{
ent->client->machinegun_shots = 0;
ent->client->ps.gunframe++;
return;
}
if (ent->client->ps.gunframe == 5)
ent->client->ps.gunframe = 4;
else
ent->client->ps.gunframe = 5;
if (ent->client->pers.inventory[ent->client->ammo_index] < 1)
{
ent->client->ps.gunframe = 6;
if (level.time >= ent->pain_debounce_time)
{
gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
ent->pain_debounce_time = level.time + 1;
}
NoAmmoWeaponChange (ent);
return;
}
if (is_quad)
{
damage *= 4;
kick *= 4;
}
for (i=1 ; i<3 ; i++)
{
ent->client->kick_origin[i] = crandom() * 0.35;
ent->client->kick_angles[i] = crandom() * 0.7;
}
ent->client->kick_origin[0] = crandom() * 0.35;
ent->client->kick_angles[0] = ent->client->machinegun_shots * -1.5;
// raise the gun as it is firing
if (!deathmatch->value)
{
ent->client->machinegun_shots++;
if (ent->client->machinegun_shots > 9)
ent->client->machinegun_shots = 9;
}
// get start / end positions
VectorAdd (ent->client->v_angle, ent->client->kick_angles, angles);
AngleVectors (angles, forward, right, NULL);
VectorSet(offset, 0, 8, ent->viewheight-8);
P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
fire_bullet (ent, start, forward, damage, kick, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MOD_MACHINEGUN);
gi.WriteByte (svc_muzzleflash);
gi.WriteShort (ent-g_edicts);
gi.WriteByte (MZ_MACHINEGUN | is_silenced);
gi.multicast (ent->s.origin, MULTICAST_PVS);
PlayerNoise(ent, start, PNOISE_WEAPON);
if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
ent->client->pers.inventory[ent->client->ammo_index]--;
// play quad damage sound
playQuadSound(ent);
}
开发者ID:alexey-lysiuk,项目名称:quake2,代码行数:76,代码来源:p_weapon.c
示例6: Machinegun_Fire
void Machinegun_Fire (edict_t *ent)
{
vec3_t start;
vec3_t forward, right;
vec3_t angles;
int damage;
int kick = 0;
vec3_t offset;
int item = getWornItem(ent, GIEX_ITEM_WEAPON);
iteminfo_t *info = getWornItemInfo(ent, GIEX_ITEM_WEAPON);
int i, spread = getMachinegunSpread(ent, item, info);
// damage = info->arg1 + info->arg2 * ent->client->pers.skill[1];
damage = getMachinegunDamage(ent, item, info);
if (!(ent->client->buttons & BUTTON_ATTACK))
{
ent->client->ps.gunframe++;
return;
}
if (ent->client->ps.gunframe == 5)
ent->client->ps.gunframe = 4;
else
ent->client->ps.gunframe = 5;
if (ent->client->pers.inventory[ent->client->ammo_index] < 1)
{
ent->client->ps.gunframe = 6;
if (level.time >= ent->pain_debounce_time)
{
gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
ent->pain_debounce_time = level.time + 1;
}
NoAmmoWeaponChange (ent);
return;
}
damage = applyWeaponBonuses(ent, damage, 1);
// if (is_quad)
// kick *= 4;
for (i=1 ; i<3 ; i++) {
ent->client->kick_origin[i] = crandom() * 0.35;
ent->client->kick_angles[i] = crandom() * 0.7;
}
ent->client->kick_origin[0] = crandom() * 0.35;
// get start / end positions
VectorAdd (ent->client->v_angle, ent->client->kick_angles, angles);
AngleVectors (angles, forward, right, NULL);
VectorSet(offset, 0, 8, ent->viewheight-8);
P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
fire_bullet (ent, start, forward, damage, kick, spread, spread, MOD_MACHINEGUN);
if ((ent->client->silencer_shots > 0) && (ent->client->pers.skill[58] > 7)) {
ent->client->silencer_shots -= 1;
} else {
gi.WriteByte (svc_muzzleflash);
gi.WriteShort (ent-g_edicts);
gi.WriteByte (MZ_MACHINEGUN | is_silenced);
gi.multicast (ent->s.origin, MULTICAST_PVS);
}
PlayerNoise(ent, start, PNOISE_WEAPON);
// if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
ent->client->pers.inventory[ent->client->ammo_index]--;
ent->client->anim_priority = ANIM_ATTACK;
if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
{
ent->s.frame = FRAME_crattak1 - (int) (random()+0.25);
ent->client->anim_end = FRAME_crattak9;
}
else
{
ent->s.frame = FRAME_attack1 - (int) (random()+0.25);
ent->client->anim_end = FRAME_attack8;
}
}
开发者ID:Chromozon,项目名称:Quake2_Giex-G10,代码行数:81,代码来源:p_weapon.c
示例7: Combat_Level0
//return weapon
void Combat_Level0(edict_t *ent,int foundedenemy,int enewep
,float aim,float distance,int skill)
{
float f;
gclient_t *client;
zgcl_t *zc;
edict_t *target;
int mywep,i,j,k;
vec3_t v,vv,v1,v2;
qboolean mod = false;
trace_t rs_trace;
client = ent->client;
zc = &client->zc;
target = zc->first_target;
//-----------------------------------------------------------------------
//ステータスを反映
//-----------------------------------------------------------------------
//チキンは狙いがキツイ==============
if(zc->battlemode == FIRE_CHIKEN) aim *= 0.7;
//左右に回避========================
if(zc->battlemode & FIRE_SHIFT)
{
mywep = Get_KindWeapon(client->pers.weapon);
Get_AimAngle(ent,aim,distance,mywep);
if(--zc->battlesubcnt > 0)
{
if(ent->groundentity)
{
if(zc->battlemode & FIRE_SHIFT_R)
{
zc->moveyaw = ent->s.angles[YAW] + 90;
if(zc->moveyaw > 180) zc->moveyaw -= 360;
}
else
{
zc->moveyaw = ent->s.angles[YAW] - 90;
if(zc->moveyaw < -180) zc->moveyaw += 360;
}
trace_priority = TRP_MOVEKEEP; //後退処理
}
}
else
{
zc->battlemode &= ~FIRE_SHIFT;
}
}
//dodge=============================
if(Bot[ent->client->zc.botindex].param[BOP_DODGE]
&& ent->groundentity && !ent->waterlevel)
{
AngleVectors (target->client->v_angle, v,NULL, NULL);
VectorScale (v, 300, v);
VectorSet(vv, 0, 0, target->viewheight-8);
VectorAdd(target->s.origin,vv,vv);
VectorAdd(vv,v,v);
VectorSet(v1, -4, -4,-4);
VectorSet(v2, 4, 4, 4);
rs_trace = gi.trace(vv,v1,v2,v,target,MASK_SHOT);
if(rs_trace.ent == ent)
{
if(rs_trace.endpos[2] > (ent->s.origin[2] + 4) && random() < 0.4)
{
client->ps.pmove.pm_flags |= PMF_DUCKED;
zc->battleduckcnt = 2 + 8 * random();
}
else if(rs_trace.endpos[2] < (ent->s.origin[2] + JumpMax - 24))
{
if(zc->route_trace)
{
if(Bot_Fall(ent,ent->s.origin,0)) trace_priority = TRP_MOVEKEEP;;
}
else
{
ent->moveinfo.speed = 0.5;
ent->velocity[2] += VEL_BOT_JUMP;
gi.sound(ent, CHAN_VOICE, gi.soundindex("*jump1.wav"), 1, ATTN_NORM, 0);
PlayerNoise(ent, ent->s.origin, PNOISE_SELF); //pon
Set_BotAnim(ent,ANIM_JUMP,FRAME_jump1-1,FRAME_jump6);
}
}
}
}
//無視して走る========================
if(zc->battlemode & FIRE_IGNORE)
{
if(--zc->battlecount > 0)
{
if(zc->first_target != zc->last_target)
//.........这里部分代码省略.........
开发者ID:qbism,项目名称:tmg,代码行数:101,代码来源:bot_fire.c
示例8: Chaingun_Fire
//.........这里部分代码省略.........
if (ent->client->ps.gunframe == 5)
gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/chngnu1a.wav"), 1, ATTN_IDLE, 0);
if ((ent->client->ps.gunframe == 14) && !(ent->client->buttons & BUTTON_ATTACK))
{
ent->client->ps.gunframe = 32;
ent->client->weapon_sound = 0;
return;
}
else if ((ent->client->ps.gunframe == 21) && (ent->client->buttons & BUTTON_ATTACK)
&& ent->client->pers.inventory[ent->client->ammo_index])
{
ent->client->ps.gunframe = 15;
}
else
{
ent->client->ps.gunframe++;
}
if (ent->client->ps.gunframe == 22)
{
ent->client->weapon_sound = 0;
gi.sound(ent, CHAN_AUTO, gi.soundindex("weapons/chngnd1a.wav"), 1, ATTN_IDLE, 0);
}
else
{
ent->client->weapon_sound = gi.soundindex("weapons/chngnl1a.wav");
}
if (ent->client->ps.gunframe <= 9)
shots = 1;
else if (ent->client->ps.gunframe <= 14)
{
if (ent->client->buttons & BUTTON_ATTACK)
shots = 2;
else
shots = 1;
}
else
shots = 3;
if (ent->client->pers.inventory[ent->client->ammo_index] < shots)
shots = ent->client->pers.inventory[ent->client->ammo_index];
if (!shots)
{
if (level.time >= ent->pain_debounce_time)
{
gi.sound(ent, CHAN_VOICE, gi.soundindex("weapons/noammo.wav"), 1, ATTN_NORM, 0);
ent->pain_debounce_time = level.time + 1;
}
NoAmmoWeaponChange (ent);
return;
}
if (is_quad)
{
damage *= 4;
kick *= 4;
}
for (i=0 ; i<3 ; i++)
{
ent->client->kick_origin[i] = crandom() * 0.35;
ent->client->kick_angles[i] = crandom() * 0.7;
}
if(EMPNukeCheck(ent, ent->s.origin))
{
gi.sound (ent, CHAN_AUTO, gi.soundindex("items/empnuke/emp_missfire.wav"), 1, ATTN_NORM, 0);
return;
}
if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
ent->client->pers.inventory[ent->client->ammo_index] -= shots;
for (i=0 ; i<shots ; i++)
{
// get start / end positions
AngleVectors (ent->client->v_angle, forward, right, up);
r = 7 + crandom()*4;
u = crandom()*4;
VectorSet(offset, 0, r, u + ent->viewheight-8);
P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
fire_bullet (ent, start, forward, damage, kick, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MOD_CHAINGUN);
}
// send muzzle flash
gi.WriteByte (svc_muzzleflash);
gi.WriteShort (ent-g_edicts);
gi.WriteByte ((MZ_CHAINGUN1 + shots - 1) | is_silenced);
gi.multicast (ent->s.origin, MULTICAST_PVS);
PlayerNoise(ent, start, PNOISE_WEAPON);
// play quad damage sound
playQuadSound(ent);
}
开发者ID:alexey-lysiuk,项目名称:quake2,代码行数:101,代码来源:p_weapon.c
示例9: arrow_touch
/*
=================
fire_bow
=================
*/
void arrow_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
qboolean damageSuccess = false;
int r;
if (other == self->owner)
return;
if (surf && (surf->flags & SURF_SKY))
{
G_FreeEdict (self);
return;
}
if (self->owner->client)
PlayerNoise(self->owner, self->s.origin, PNOISE_IMPACT);
if (other->takedamage)
{
r = rand() % 100;
if (r < self->owner->client->pers.marksman * 2) // Calculate damageSuccess based on marksman skill
{
damageSuccess = true; // The hit will successfully do damage
if (self->owner->client->pers.marksman < 100) // If the marksman skill is less than the skill cap
{
self->owner->client->pers.marksman = self->owner->client->pers.marksman + 0.01; // Add progress to the skill
if ((self->owner->client->pers.marksman - (int)self->owner->client->pers.marksman) * 100 >= (int)self->owner->client->pers.marksman - 25) // If the skill levels
{
self->owner->client->pers.marksman = self->owner->client->pers.marksman + (1 - (self->owner->client->pers.marksman - (int)self->owner->client->pers.marksman)); // Increase the skill to the next level
gi.centerprintf(self->owner, "Your Marksman Skill Has Increased To %i\n", (int)self->owner->client->pers.marksman); // Print that the player's skill has increased
gi.sound(self->owner, CHAN_AUTO, gi.soundindex("morrowind/skill.wav"), 1, ATTN_NORM, 0); // Play skill up sound
}
}
}
if (damageSuccess == true)
{
T_Damage(other, self, self->owner, self->velocity, self->s.origin, plane->normal, self->dmg, 1, DAMAGE_ENERGY, MOD_BOW);
gi.sound(other, CHAN_AUTO, gi.soundindex("morrowind/BodyHit.wav"), 1, ATTN_NORM, 0);
/*
gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_BLOOD);
gi.WritePosition (self->s.origin);
gi.multicast (self->s.origin, MULTICAST_PVS);
*/
}
else
gi.sound(other, CHAN_AUTO, gi.soundindex("morrowind/Miss.wav"), 1, ATTN_NORM, 0);
}
else
{
gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_SPARKS);
gi.WritePosition (self->s.origin);
if (!plane)
gi.WriteDir (vec3_origin);
else
gi.WriteDir (plane->normal);
gi.multicast (self->s.origin, MULTICAST_PVS);
}
G_FreeEdict (self);
}
开发者ID:pmm33,项目名称:pmm33,代码行数:68,代码来源:g_weapon.c
示例10: B_UseRocket
//------------------------------------------------------------
qboolean B_UseRocket(edict_t *ent,edict_t *target,int enewep,float aim,float distance,int skill)
{
int k,mywep;
zgcl_t *zc;
gclient_t *client;
client = ent->client;
zc = &client->zc;
if(k = CanUsewep(ent,WEAP_ROCKETLAUNCHER))
{
mywep = Get_KindWeapon(client->pers.weapon);
Get_AimAngle(ent,aim,distance,mywep);
if(trace_priority < TRP_ANGLEKEEP) trace_priority = TRP_ANGLEKEEP;
if((FFlg[skill] & FIRE_PRESTAYFIRE)
&& ((distance > 500 && random() < 0.1) || fabs(ent->s.angles[PITCH]) > 45 )
&& Bot_traceS(ent,target)
&& (enewep <= WEAP_MACHINEGUN || enewep == WEAP_GRENADES))
{
if(ent->groundentity || zc->waterstate)
{
zc->battlemode |= FIRE_PRESTAYFIRE;
zc->battlecount = 2 + (int)(6 * random());
trace_priority = TRP_ALLKEEP;
return true;
}
}
if((FFlg[skill] & FIRE_JUMPROC) && random() < 0.3
&& (target->s.origin[2] - ent->s.origin[2]) < JumpMax
&& !(client->ps.pmove.pm_flags && PMF_DUCKED))
{
if(ent->groundentity && !ent->waterlevel <= 1)
{
if(zc->route_trace)
{
if(Bot_Fall(ent,ent->s.origin,0))
{
trace_priority = TRP_ALLKEEP;
if(Bot_traceS(ent,target)) client->buttons |= BUTTON_ATTACK;
return true;
}
}
else
{
ent->moveinfo.speed = 0;
ent->velocity[2] += VEL_BOT_JUMP;
gi.sound(ent, CHAN_VOICE, gi.soundindex("*jump1.wav"), 1, ATTN_NORM, 0);
PlayerNoise(ent, ent->s.origin, PNOISE_SELF); //pon
Set_BotAnim(ent,ANIM_JUMP,FRAME_jump1-1,FRAME_jump6);
trace_priority = TRP_ALLKEEP;
if(Bot_traceS(ent,target)) client->buttons |= BUTTON_ATTACK;
return true;
}
}
}
else if((FFlg[skill] & FIRE_EXPAVOID)
&& distance < 300 && random() < 0.5
&& Bot_traceS(ent,target))
{
if(ent->groundentity || zc->waterstate)
{
zc->battlemode |= FIRE_EXPAVOID;
zc->battlecount = 4 + (int)(6 * random());
trace_priority = TRP_ALLKEEP;
return true;
}
}
if(Bot_traceS(ent,target)) client->buttons |= BUTTON_ATTACK;
return true;
}
return false;
}
开发者ID:qbism,项目名称:tmg,代码行数:74,代码来源:bot_fire.c
示例11: weapon_railgun_fire
void weapon_railgun_fire (edict_t *ent)
{
vec3_t start;
vec3_t forward, right;
vec3_t offset;
int damage;
int kick;
//RAV
if(ent->client->pers.pl_state ==5 )
return;
if( ent->client->pers.pl_state < 1 || ent->client->resp.spectator
||(ctf->value && ent->client->resp.ctf_team < 1))
{
ent->movetype = MOVETYPE_NOCLIP;
ent->solid = SOLID_NOT;
ent->svflags |= SVF_NOCLIENT;
ent->client->resp.ctf_team = CTF_NOTEAM;
ent->client->ps.gunindex = 0;
ent->client->pers.pl_state = 0;
gi.linkentity (ent);
ent->client->resp.spectator = true;
return;
}
//
if (deathmatch->value)
{ // normal damage is too extreme in dm
damage = rg_damage->value;
kick = rg_kick->value;
}
else
{
damage = 150;
kick = 250;
}
if (is_quad)
{
damage *= 4;
kick *= 4;
}//DB
if (is_strength)
{
damage *= 2;
kick *= 2;
}
//DB
//RAV
if(voosh->value)
{
damage = (int)raildamage->value;
kick = (int)railkick->value;
}
//
AngleVectors (ent->client->v_angle, forward, right, NULL);
VectorScale (forward, -3, ent->client->kick_origin);
ent->client->kick_angles[0] = -3;
VectorSet(offset, 0, 7, ent->viewheight-8);
P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
fire_rail (ent, start, forward, damage, kick);
// send muzzle flash
gi.WriteByte (svc_muzzleflash);
gi.WriteShort (ent-g_edicts);
gi.WriteByte (MZ_RAILGUN | is_silenced);
gi.multicast (ent->s.origin, MULTICAST_PVS);
ent->client->ps.gunframe++;
PlayerNoise(ent, start, PNOISE_WEAPON);
//RAV
//allow for camper checking
ent->client->check_camping = true;
//
if (! ( dmflag & DF_INFINITE_AMMO ) )
if(voosh->value == 0)//RAV
ent->client->pers.inventory[ent->client->ammo_index]--;
}
开发者ID:qbism,项目名称:tmg,代码行数:81,代码来源:p_weapon.c
示例12: bfg_touch
void
bfg_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
if (!self || !other)
{
G_FreeEdict(self);
return;
}
if (other == self->owner)
{
return;
}
if (surf && (surf->flags & SURF_SKY))
{
G_FreeEdict(self);
return;
}
if (self->owner && self->owner->client)
{
PlayerNoise(self->owner, self->s.origin, PNOISE_IMPACT);
}
/* core explosion - prevents firing it into the wall/floor */
if (other->takedamage)
{
if (plane)
{
T_Damage(other, self, self->owner, self->velocity, self->s.origin,
plane->normal, 200, 0, 0, MOD_BFG_BLAST);
}
else
{
T_Damage(other, self, self->owner, self->velocity, self->s.origin,
vec3_origin, 200, 0, 0, MOD_BFG_BLAST);
}
}
T_RadiusDamage(self, self->owner, 200, other, 100, MOD_BFG_BLAST);
gi.sound(self, CHAN_VOICE, gi.soundindex(
"weapons/bfg__x1b.wav"), 1, ATTN_NORM, 0);
self->solid = SOLID_NOT;
self->touch = NULL;
VectorMA(self->s.origin, -1 * FRAMETIME, self->velocity, self->s.origin);
VectorClear(self->velocity);
self->s.modelindex = gi.modelindex("sprites/s_bfg3.sp2");
self->s.frame = 0;
self->s.sound = 0;
self->s.effects &= ~EF_ANIM_ALLFAST;
self->think = bfg_explode;
self->nextthink = level.time + FRAMETIME;
self->enemy = other;
gi.WriteByte(svc_temp_entity);
gi.WriteByte(TE_BFG_BIGEXPLOSION);
gi.WritePosition(self->s.origin);
gi.multicast(self->s.origin, MULTICAST_PVS);
}
开发者ID:ZFect,项目名称:yquake2,代码行数:61,代码来源:g_weapon.c
示例13: blaster_touch
/*
=================
fire_blaster
Fires a single blaster bolt. Used by the blaster and hyper blaster.
=================
*/
void blaster_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
int mod;
if (!self || !other)
{
G_FreeEdict(self);
return;
}
if (other == self->owner)
{
return;
}
if (surf && (surf->flags & SURF_SKY))
{
G_FreeEdict(self);
return;
}
if (self->owner->client)
{
PlayerNoise(self->owner, self->s.origin, PNOISE_IMPACT);
}
if (other->takedamage)
{
if (self->spawnflags & 1)
{
mod = MOD_HYPERBLASTER;
}
else
{
mod = MOD_BLASTER;
}
T_Damage(other, self, self->owner, self->velocity, self->s.origin,
plane->normal, self->dmg, 1, DAMAGE_ENERGY, mod);
}
else
{
gi.WriteByte (svc_temp_entity);
// RAFAEL
if (self->s.effects & EF_BLUEHYPERBLASTER) // Knightmare- this was checking bit TE_BLUEHYPERBLASTER
gi.WriteByte (TE_BLUEHYPERBLASTER); // Knightmare- TE_BLUEHYPERBLASTER is broken (parse error) in most Q2 engines
else
gi.WriteByte (TE_BLASTER);
gi.WritePosition(self->s.origin);
if (!plane)
{
gi.WriteDir(vec3_origin);
}
else
{
gi.WriteDir(plane->normal);
}
gi.multicast(self->s.origin, MULTICAST_PVS);
}
G_FreeEdict(self);
}
开发者ID:basecq,项目名称:q2dos,代码行数:71,代码来源:g_weapon.c
示例14: ClientThink
/*
==============
ClientThink
This will be called once for each client frame, which will
usually be a couple times for each server frame.
==============
*/
void ClientThink (edict_t *ent, usercmd_t *ucmd)
{
gclient_t *client;
edict_t *other;
int i, j;
pmove_t pm;
level.current_entity = ent;
client = ent->client;
if (level.intermissiontime)
{
client->ps.pmove.pm_type = PM_FREEZE;
// can exit intermission after five seconds
if (level.time > level.intermissiontime + 5.0
&& (ucmd->buttons & BUTTON_ANY) )
level.exitintermission = true;
return;
}
pm_passent = ent;
if (ent->client->chase_target) {
client->resp.cmd_angles[0] = SHORT2ANGLE(ucmd->angles[0]);
client->resp.cmd_angles[1] = SHORT2ANGLE(ucmd->angles[1]);
client->resp.cmd_angles[2] = SHORT2ANGLE(ucmd->angles[2]);
} else {
// set up for pmove
memset (&pm, 0, sizeof(pm));
if (ent->movetype == MOVETYPE_NOCLIP)
client->ps.pmove.pm_type = PM_SPECTATOR;
else if (ent->s.modelindex != 255)
client->ps.pmove.pm_type = PM_GIB;
else if (ent->deadflag)
client->ps.pmove.pm_type = PM_DEAD;
else
client->ps.pmove.pm_type = PM_NORMAL;
client->ps.pmove.gravity = 0;
pm.s = client->ps.pmove;
for (i=0 ; i<3 ; i++)
{
pm.s.origin[i] = ent->s.origin[i]*8;
pm.s.velocity[i] = ent->velocity[i]*8;
}
if (memcmp(&client->old_pmove, &pm.s, sizeof(pm.s)))
{
pm.snapinitial = true;
// gi.dprintf ("pmove changed!\n");
}
pm.cmd = *ucmd;
pm.trace = PM_trace; // adds default parms
pm.pointcontents = gi.pointcontents;
// perform a pmove
gi.Pmove (&pm);
// save results of pmove
client->ps.pmove = pm.s;
client->old_pmove = pm.s;
for (i=0 ; i<3 ; i++)
{
ent->s.origin[i] = pm.s.origin[i]*0.125;
ent->velocity[i] = pm.s.velocity[i]*0.125;
}
VectorCopy (pm.mins, ent->mins);
VectorCopy (pm.maxs, ent->maxs);
client->resp.cmd_angles[0] = SHORT2ANGLE(ucmd->angles[0]);
client->resp.cmd_angles[1] = SHORT2ANGLE(ucmd->angles[1]);
client->resp.cmd_angles[2] = SHORT2ANGLE(ucmd->angles[2]);
if (ent->groundentity && !pm.groundentity && (pm.cmd.upmove >= 10) && (pm.waterlevel == 0))
{
gi.sound(ent, CHAN_VOICE, gi.soundindex("*jump1.wav"), 1, ATTN_NORM, 0);
PlayerNoise(ent, ent->s.origin, PNOISE_SELF);
}
ent->viewheight = pm.viewheight;
ent->waterlevel = pm.waterlevel;
ent->watertype = pm.watertype;
ent->groundentity = pm.groundentity;
//.........这里部分代码省略.........
开发者ID:ar664,项目名称:Quak2Mod,代码行数:101,代码来源:p_client.c
示例15: weapon_bfg_fire
void
weapon_bfg_fire(edict_t *ent)
{
vec3_t offset, start;
vec3_t forward, right;
int damage;
float damage_radius = 1000;
if (!ent)
{
return;
}
if (deathmatch->value)
{
damage = 200;
}
else
{
damage = 500;
}
if (ent->client->ps.gunframe == 9)
{
/* send muzzle flash */
gi.WriteByte(svc_muzzleflash);
gi.WriteShort(ent - g_edicts);
gi.WriteByte(MZ_BFG | is_silenced);
gi.multicast(ent->s.origin, MULTICAST_PVS);
ent->client->ps.gunframe++;
PlayerNoise(ent, start, PNOISE_WEAPON);
return;
}
/* cells can go down during windup (from power armor hits), so
check again and abort firing if we don't have enough now */
if (ent->client->pers.inventory[ent->client->ammo_index] < 50)
{
ent->client->ps.gunframe++;
return;
}
if (is_quad)
{
damage *= 4;
}
AngleVectors(ent->client->v_angle, forward, right, NULL);
VectorScale(forward, -2, ent->client->kick_origin);
/* make a big pitch kick with an inverse fall */
ent->client->v_dmg_pitch = -40;
ent->client->v_dmg_roll = crandom() * 8;
ent->client->v_dmg_time = level.time + DAMAGE_TIME;
VectorSet(offset, 8, 8, ent->viewheight - 8);
P_ProjectSource(ent->client, ent->s.origin, offset, forward, right, start);
fire_bfg(ent, start, forward, damage, 400, damage_radius);
ent->client->ps.gunframe++;
PlayerNoise(ent, start, PNOISE_WEAPON);
if (!((int)dmflags->value & DF_INFINITE_AMMO))
{
ent->client->pers.inventory[ent->client->ammo_index] -= 50;
}
}
开发者ID:phine4s,项目名称:xatrix,代码行数:71,代码来源:weapon.c
示例16: P_WorldEffects
/*
=============
P_WorldEffects
=============
*/
void P_WorldEffects (void)
{
qboolean breather;
qboolean envirosuit;
int waterlevel, old_waterlevel;
if (current_player->movetype == MOVETYPE_NOCLIP)
{
current_player->air_finished = level.time + 12; // don't need air
return;
}
waterlevel = current_player->waterlevel;
old_waterlevel = current_client->old_waterlevel;
current_client->old_waterlevel = waterlevel;
breather = current_client->breather_framenum > level.framenum;
envirosuit = current_client->enviro_framenum > level.framenum;
//
// if just entered a water volume, play a sound
//
if (!old_waterlevel && waterlevel)
{
PlayerNoise (current_player, current_player->s.origin, PNOISE_SELF);
if (current_player->watertype & CONTENTS_LAVA)
gi.sound (current_player, CHAN_BODY,
gi.soundindex ("player/lava_in.wav"), 1, ATTN_NORM, 0);
else if (current_player->watertype & CONTENTS_SLIME)
gi.sound (current_player, CHAN_BODY,
gi.soundindex ("player/watr_in.wav"), 1, ATTN_NORM, 0);
else if (current_player->watertype & CONTENTS_WATER)
gi.sound (current_player, CHAN_BODY,
gi.soundindex ("player/watr_in.wav"), 1, ATTN_NORM, 0);
current_player->flags |= FL_INWATER;
// clear damage_debounce, so the pain sound will play immediately
current_player->damage_debounce_time = level.time - 1;
}
//
// if just completely exited a water volume, play a sound
//
if (old_waterlevel && !waterlevel)
{
PlayerNoise (current_player, current_player->s.origin, PNOISE_SELF);
gi.sound (current_player, CHAN_BODY,
gi.soundindex ("player/watr_out.wav"), 1, ATTN_NORM, 0);
current_player->flags &= ~FL_INWATER;
}
//
// check for head just going under water
//
if (old_waterlevel != 3 && waterlevel == 3)
{
gi.sound (current_player, CHAN_BODY,
gi.soundindex ("player/watr_un.wav"), 1, ATTN_NORM, 0);
}
//
// check for head just coming out of water
//
if (old_waterlevel == 3 && waterlevel != 3)
{
if (current_player->air_finished < level.time)
{ // gasp for air
gi.sound (current_player, CHAN_VOICE,
gi.soundindex ("player/gasp1.wav"), 1, ATTN_NORM, 0);
PlayerNoise (current_player, current_player->s.origin, PNOISE_SELF);
}
else if (current_player->air_finished < level.time + 11)
{ // just break surface
gi.sound (current_player, CHAN_VOICE,
gi.soundindex ("player/gasp2.wav"), 1, ATTN_NORM, 0);
}
}
//
// check for drowning
//
if (waterlevel == 3)
{
// breather or envirosuit give air
if (breather || envirosuit)
{
current_player->air_finished = level.time + 10;
if (((int)(current_client->breather_framenum - level.framenum) % 25) == 0)
{
if (!current_client->breather_sound)
gi.sound (current_player, CHAN_AUTO,
gi.soundindex("player/u_breath1.wav"), 1, ATTN_NORM, 0);
else
//.........这里部分代码省略.........
开发者ID:darkshade9,项目名称:aq2-tng-alpha,代码行数:101,代码来源:p_view.c
示例17: weapon_ionripper_fire
void
weapon_ionripper_fire(edict_t *ent)
{
vec3_t start;
vec3_t forward, right;
vec3_t offset;
vec3_t tempang;
int damage;
if (!ent)
{
return;
}
if (deathmatch->value)
{
/* tone down for deathmatch */
damage = 30;
}
else
{
damage = 50;
}
if (is_quad)
{
damage *= 4;
}
VectorCopy(ent->client->v_angle, tempang);
tempang[YAW] += crandom();
AngleVectors(tempang, forward, right, NULL);
VectorScale(forward, -3, ent->client->kick_origin);
ent->client->kick_angles[0] = -3;
VectorSet(offset, 16, 7, ent->viewheight - 8);
P_ProjectSource(ent->client, ent->s.origin, offset, forward, right, start);
fire_ionripper(ent, start, forward, damage, 500, EF_IONRIPPER);
/* send muzzle flash */
gi.WriteByte(svc_muzzleflash);
gi.WriteShort(ent - g_edicts);
gi.WriteByte(MZ_IONRIPPER | is_silenced);
gi.multicast(ent->s.origin, MULTICAST_PVS);
ent->client->ps.gunframe++;
PlayerNoise(ent, start, PNOISE_WEAPON);
if (!((int)dmflags->value & DF_INFINITE_AMMO))
{
ent->client->pers.inventory[ent->client->ammo_index] -=
ent->client->pers.weapon->quantity;
}
if (ent->client->pers.inventory[ent->client->ammo_index] < 0)
{
ent->client->pers.inventory[ent->client->ammo_index] = 0;
}
}
开发者ID:phine4s,项目名称:xatrix,代码行数:63,代码来源:weapon.c
示例18: weapon_bfg_fire
void weapon_bfg_fire (edict_t *ent)
{
vec3_t offset, start;
vec3_t forward, right;
int damage;
float damage_radius = 1000;
AngleVectors (ent->client->v_angle, forward, right, NULL);
VectorScale (forward, -2, ent->client->kick_origin);
VectorSet(offset, 8, 8, ent->viewheight-8);
P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
if(ent->client->ps.gunframe == 9)
{
ent->flags &= ~FL_BFGMISSFIRE;
}
if(!(ent->flags & FL_BFGMISSFIRE) && EMPNukeCheck(ent, start))
{
ent->flags |= FL_BFGMISSFIRE;
gi.sound (ent, CHAN_AUTO, gi.soundindex("items/empnuke/emp_missfire.wav"), 1, ATTN_NORM, 0);
}
if(ent->flags & FL_BFGMISSFIRE)
{
ent->client->ps.gunframe++;
return;
}
if (deathmatch->value)
damage = 200;
else
damage = 500;
if (ent->client->ps.gunframe == 9)
{
// send muzzle flash
gi.WriteByte (svc_muzzleflash);
gi.WriteShort (ent-g_edicts);
gi.WriteByte (MZ_BFG | is_silenced);
gi.multicast (ent->s.origin, MULTICAST_PVS);
ent->client->ps.gunframe++;
PlayerNoise(ent, start, PNOISE_WEAPON);
return;
}
// cells can go down during windup (from power armor hits), so
// check again and abort firing if we don't have enough now
if (ent->client->pers.inventory[ent->client->ammo_index] < 50)
{
ent->client->ps.gunframe++;
return;
|
请发表评论