Shared: Avoid use of 'self' in weapon code where applicable. Leftovers from older times.
This commit is contained in:
parent
7bb5660f09
commit
120e6988c4
12 changed files with 42 additions and 43 deletions
|
@ -218,7 +218,7 @@ w_crossbow_primary(player pl)
|
|||
entity bolt = spawn();
|
||||
setmodel(bolt, "models/crossbow_bolt.mdl");
|
||||
setorigin(bolt, Weapons_GetCameraPos(pl) + (v_forward * 16));
|
||||
bolt.owner = self;
|
||||
bolt.owner = pl;
|
||||
bolt.velocity = v_forward * 2000;
|
||||
bolt.movetype = MOVETYPE_FLYMISSILE;
|
||||
bolt.solid = SOLID_BBOX;
|
||||
|
@ -248,7 +248,7 @@ w_crossbow_primary(player pl)
|
|||
Weapons_ViewAnimation(pl, CROSSBOW_FIRE3);
|
||||
}
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTBOW, 0.25f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTBOW, 0.25f);
|
||||
|
|
|
@ -100,10 +100,10 @@ w_crowbar_primary(player pl)
|
|||
src = pl.origin + pl.view_ofs;
|
||||
|
||||
/* make sure we can gib corpses */
|
||||
int oldhitcontents = self.hitcontentsmaski;
|
||||
self.hitcontentsmaski = CONTENTBITS_POINTSOLID | CONTENTBIT_CORPSE;
|
||||
int oldhitcontents = pl.hitcontentsmaski;
|
||||
pl.hitcontentsmaski = CONTENTBITS_POINTSOLID | CONTENTBIT_CORPSE;
|
||||
traceline(src, src + (v_forward * 32), FALSE, pl);
|
||||
self.hitcontentsmaski = oldhitcontents;
|
||||
pl.hitcontentsmaski = oldhitcontents;
|
||||
|
||||
if (trace_fraction >= 1.0) {
|
||||
pl.w_attack_next = 0.5f;
|
||||
|
@ -124,13 +124,13 @@ w_crowbar_primary(player pl)
|
|||
Weapons_ViewAnimation(pl, trace_fraction >= 1 ? CBAR_ATTACK3MISS:CBAR_ATTACK3HIT);
|
||||
}
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTCROWBAR, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
|
||||
|
||||
#ifdef SERVER
|
||||
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.miss");
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_crowbar.miss");
|
||||
|
||||
if (trace_fraction >= 1.0) {
|
||||
return;
|
||||
|
@ -146,10 +146,10 @@ w_crowbar_primary(player pl)
|
|||
if (trace_ent.takedamage) {
|
||||
Damage_Apply(trace_ent, pl, Skill_GetValue("plr_crowbar", 10), WEAPON_CROWBAR, DMG_BLUNT);
|
||||
if (trace_ent.iBleeds) {
|
||||
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.hitbody");
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_crowbar.hitbody");
|
||||
}
|
||||
} else {
|
||||
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.hit");
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_crowbar.hit");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -157,7 +157,6 @@ w_crowbar_primary(player pl)
|
|||
void
|
||||
w_crowbar_release(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_idle_next) {
|
||||
return;
|
||||
}
|
||||
|
@ -169,7 +168,7 @@ w_crowbar_release(player pl)
|
|||
float
|
||||
w_crowbar_aimanim(player pl)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -278,7 +278,7 @@ void w_egon_crosshair(player pl)
|
|||
|
||||
float w_egon_aimanim(player pl)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMEGON : ANIM_AIMEGON;
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMEGON : ANIM_AIMEGON;
|
||||
}
|
||||
|
||||
void w_egon_hudpic(player pl, int selected, vector pos, float a)
|
||||
|
|
|
@ -188,7 +188,7 @@ w_glock_primary(player pl)
|
|||
Weapons_ViewAnimation(pl, GLOCK_SHOOT_EMPTY);
|
||||
}
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.2f);
|
||||
|
@ -232,7 +232,7 @@ w_glock_secondary(player pl)
|
|||
Weapons_ViewAnimation(pl, GLOCK_SHOOT_EMPTY);
|
||||
}
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.2f);
|
||||
|
@ -312,7 +312,7 @@ w_glock_release(player pl)
|
|||
float
|
||||
w_glock_aimanim(player pl)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND;
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -191,7 +191,7 @@ void w_handgrenade_release(player pl)
|
|||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTCROWBAR, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
|
||||
|
@ -220,7 +220,7 @@ void w_handgrenade_release(player pl)
|
|||
float
|
||||
w_handgrenade_aimanim(player pl)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -111,7 +111,7 @@ w_hornetgun_shoothornet(player pl)
|
|||
entity bolt = spawn();
|
||||
setmodel(bolt, "models/hornet.mdl");
|
||||
setorigin(bolt, Weapons_GetCameraPos(pl) + (v_forward * 16) + (v_up * -8));
|
||||
bolt.owner = self;
|
||||
bolt.owner = pl;
|
||||
bolt.velocity = v_forward * 1000;
|
||||
bolt.movetype = MOVETYPE_FLY;
|
||||
bolt.solid = SOLID_BBOX;
|
||||
|
@ -182,7 +182,7 @@ w_hornetgun_primary(player pl)
|
|||
pl.ammo_hornet--;
|
||||
Weapons_ViewAnimation(pl, HORNETGUN_SHOOT);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTHIVE, 0.43f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTHIVE, 0.43f);
|
||||
|
@ -212,7 +212,7 @@ w_hornetgun_secondary(player pl)
|
|||
pl.ammo_hornet--;
|
||||
Weapons_ViewAnimation(pl, HORNETGUN_SHOOT);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTHIVE, 0.43f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTHIVE, 0.43f);
|
||||
|
@ -260,7 +260,7 @@ w_hornetgun_crosshair(player pl)
|
|||
float
|
||||
w_hornetgun_aimanim(player pl)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMHIVE : ANIM_AIMHIVE;
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMHIVE : ANIM_AIMHIVE;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -155,7 +155,7 @@ w_python_primary(player pl)
|
|||
Weapons_ViewPunchAngle(pl, [-10,0,0]);
|
||||
Weapons_ViewAnimation(pl, PYTHON_FIRE1);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTPYTHON, 0.43f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTPYTHON, 0.43f);
|
||||
|
@ -314,7 +314,7 @@ w_python_crosshair(player pl)
|
|||
float
|
||||
w_python_aimanim(player pl)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMPYTHON : ANIM_AIMPYTHON;
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMPYTHON : ANIM_AIMPYTHON;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -143,7 +143,7 @@ void w_rpg_primary(player pl)
|
|||
entity rocket = spawn();
|
||||
setmodel(rocket, "models/rpgrocket.mdl");
|
||||
setorigin(rocket, Weapons_GetCameraPos(pl) + (v_forward * 16));
|
||||
rocket.owner = self;
|
||||
rocket.owner = pl;
|
||||
rocket.movetype = MOVETYPE_FLY;
|
||||
rocket.solid = SOLID_BBOX;
|
||||
//bolt.flags |= FL_LAGGEDMOVE;
|
||||
|
@ -167,7 +167,7 @@ void w_rpg_primary(player pl)
|
|||
Weapons_ViewAnimation(pl, RPG_FIRE2);
|
||||
Weapons_ViewPunchAngle(pl, [-10,0,0]);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTRPG, 0.43f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTRPG, 0.43f);
|
||||
|
@ -253,7 +253,7 @@ void w_rpg_secondary(player pl)
|
|||
|
||||
float w_rpg_aimanim(player pl)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMRPG : ANIM_AIMRPG;
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMRPG : ANIM_AIMRPG;
|
||||
}
|
||||
|
||||
void w_rpg_hudpic(player pl, int selected, vector pos, float a)
|
||||
|
|
|
@ -181,11 +181,11 @@ w_satchel_primary(player pl)
|
|||
|
||||
Weapons_MakeVectors(pl);
|
||||
throw = pl.velocity + (v_forward * 274);
|
||||
s_satchel_drop(self, pl.origin, throw);
|
||||
s_satchel_drop(pl, pl.origin, throw);
|
||||
pl.satchel_chg++;
|
||||
pl.ammo_satchel--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSQUEAK, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSQUEAK, 0.5f);
|
||||
|
@ -235,10 +235,10 @@ w_satchel_secondary(player pl)
|
|||
vector throw;
|
||||
Weapons_MakeVectors(pl);
|
||||
throw = pl.velocity + (v_forward * 274);
|
||||
s_satchel_drop(self, pl.origin, throw);
|
||||
s_satchel_drop(pl, pl.origin, throw);
|
||||
#endif
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSQUEAK, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSQUEAK, 0.5f);
|
||||
|
@ -275,7 +275,7 @@ w_satchel_release(player pl)
|
|||
float
|
||||
w_satchel_aimanim(player pl)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMSQUEAK : ANIM_AIMSQUEAK;
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMSQUEAK : ANIM_AIMSQUEAK;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -227,7 +227,7 @@ w_shotgun_primary(player pl)
|
|||
Weapons_ViewAnimation(pl, SHOTGUN_FIRE1);
|
||||
Weapons_ViewPunchAngle(pl, [-5,0,0]);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSHOTGUN, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSHOTGUN, 0.5f);
|
||||
|
@ -280,7 +280,7 @@ w_shotgun_secondary(player pl)
|
|||
Weapons_ViewAnimation(pl, SHOTGUN_FIRE2);
|
||||
Weapons_ViewPunchAngle(pl, [-10,0,0]);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSHOTGUN, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSHOTGUN, 0.5f);
|
||||
|
@ -389,7 +389,7 @@ w_shotgun_crosshair(player pl)
|
|||
float
|
||||
w_shotgun_aimanim(player pl)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMSHOTGUN : ANIM_AIMSHOTGUN;
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMSHOTGUN : ANIM_AIMSHOTGUN;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -173,12 +173,12 @@ void w_snark_holster(player pl)
|
|||
}
|
||||
|
||||
#ifdef SERVER
|
||||
void w_snark_deploy(void)
|
||||
void w_snark_deploy(entity snark_owner)
|
||||
{
|
||||
monster_snark snark = spawn(monster_snark, real_owner: self, goalentity: self, spawnflags: MSF_MULTIPLAYER);
|
||||
makevectors(self.v_angle);
|
||||
monster_snark snark = spawn(monster_snark, real_owner: snark_owner, goalentity: snark_owner, spawnflags: MSF_MULTIPLAYER);
|
||||
makevectors(snark_owner.v_angle);
|
||||
snark.Respawn();
|
||||
snark.SetOrigin(self.origin + v_forward * 32);
|
||||
snark.SetOrigin(snark_owner.origin + v_forward * 32);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -196,13 +196,13 @@ void w_snark_primary(player pl)
|
|||
/* Audio-Visual Bit */
|
||||
Weapons_ViewAnimation(pl, SNARK_THROW);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSQUEAK, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSQUEAK, 0.5f);
|
||||
|
||||
#ifdef SERVER
|
||||
w_snark_deploy();
|
||||
w_snark_deploy(pl);
|
||||
|
||||
if (pl.ammo_snark <= 0) {
|
||||
Weapons_RemoveItem(pl, WEAPON_SNARK);
|
||||
|
@ -283,7 +283,7 @@ string w_snark_deathmsg(void)
|
|||
|
||||
float w_snark_aimanim(player pl)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMSQUEAK : ANIM_AIMSQUEAK;
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMSQUEAK : ANIM_AIMSQUEAK;
|
||||
}
|
||||
|
||||
void w_snark_hud(player pl)
|
||||
|
|
|
@ -282,7 +282,7 @@ w_tripmine_primary(player pl)
|
|||
|
||||
Weapons_ViewAnimation(pl, TRIPMINE_FIRE2);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTTRIPMINE, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTTRIPMINE, 0.5f);
|
||||
|
@ -343,7 +343,7 @@ w_tripmine_release(player pl)
|
|||
float
|
||||
w_tripmine_aimanim(player pl)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMTRIPMINE : ANIM_AIMTRIPMINE;
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMTRIPMINE : ANIM_AIMTRIPMINE;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue