diff --git a/src/client/entities.qc b/src/client/entities.qc index 6fdc5e4..8d3cda0 100644 --- a/src/client/entities.qc +++ b/src/client/entities.qc @@ -24,10 +24,3 @@ ClientGame_EntityUpdate(float id, float new) return (1); } - -void -ClientGame_EntityRemove(void) -{ - if (self.classname == "player") - Player_DestroyWeaponModel((base_player) self); -} diff --git a/src/shared/w_asscan.qc b/src/shared/w_asscan.qc index 543992e..c50bb2f 100644 --- a/src/shared/w_asscan.qc +++ b/src/shared/w_asscan.qc @@ -34,7 +34,7 @@ w_asscan_wmodel(void) return "models/w_asscan.mdl"; } string -w_asscan_pmodel(void) +w_asscan_pmodel(player pl) { return "models/p_asscan.mdl"; } @@ -46,20 +46,20 @@ w_asscan_deathmsg(void) } void -w_asscan_draw(void) +w_asscan_draw(player pl) { Weapons_SetModel("models/v_tfac.mdl"); - Weapons_ViewAnimation(0); + Weapons_ViewAnimation(pl, 0); } float -w_asscan_aimanim(void) +w_asscan_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_asscan_hudpic(int selected, vector pos, float a) +w_asscan_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -100,7 +100,7 @@ weapon_t w_asscan = .secondary = __NULL__, .reload = __NULL__, .release = __NULL__, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_asscan_precache, .pickup = __NULL__, .updateammo = w_asscan_updateammo, diff --git a/src/shared/w_autorifle.qc b/src/shared/w_autorifle.qc index f556987..c4ac6e6 100644 --- a/src/shared/w_autorifle.qc +++ b/src/shared/w_autorifle.qc @@ -36,7 +36,7 @@ w_autorifle_wmodel(void) return "models/w_autorifle.mdl"; } string -w_autorifle_pmodel(void) +w_autorifle_pmodel(player pl) { return "models/p_autorifle.mdl"; } @@ -48,20 +48,20 @@ w_autorifle_deathmsg(void) } void -w_autorifle_draw(void) +w_autorifle_draw(player pl) { Weapons_SetModel("models/v_tfc_sniper.mdl"); - Weapons_ViewAnimation(0); + Weapons_ViewAnimation(pl, 0); } float -w_autorifle_aimanim(void) +w_autorifle_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_autorifle_hudpic(int selected, vector pos, float a) +w_autorifle_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -102,7 +102,7 @@ weapon_t w_autorifle = .secondary = __NULL__, .reload = __NULL__, .release = __NULL__, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_autorifle_precache, .pickup = __NULL__, .updateammo = w_autorifle_updateammo, diff --git a/src/shared/w_crowbar.qc b/src/shared/w_crowbar.qc index 02052f3..b30ae61 100644 --- a/src/shared/w_crowbar.qc +++ b/src/shared/w_crowbar.qc @@ -62,7 +62,7 @@ w_crowbar_wmodel(void) return "models/w_crowbar.mdl"; } string -w_crowbar_pmodel(void) +w_crowbar_pmodel(player pl) { return "models/p_crowbar.mdl"; } @@ -74,30 +74,29 @@ w_crowbar_deathmsg(void) } void -w_crowbar_draw(void) +w_crowbar_draw(player pl) { Weapons_SetModel("models/v_crowbar.mdl"); - Weapons_ViewAnimation(CBAR_DRAW); + Weapons_ViewAnimation(pl, CBAR_DRAW); } void -w_crowbar_holster(void) +w_crowbar_holster(player pl) { - Weapons_ViewAnimation(CBAR_HOLSTER); + Weapons_ViewAnimation(pl, CBAR_HOLSTER); } void -w_crowbar_primary(void) +w_crowbar_primary(player pl) { int anim = 0; vector src; - player pl = (player)self; if (pl.w_attack_next) { return; } - Weapons_MakeVectors(); + Weapons_MakeVectors(pl); src = pl.origin + pl.view_ofs; /* make sure we can gib corpses */ @@ -116,13 +115,13 @@ w_crowbar_primary(void) int r = (float)input_sequence % 3; switch (r) { case 0: - Weapons_ViewAnimation(trace_fraction >= 1 ? CBAR_ATTACK1MISS:CBAR_ATTACK1HIT); + Weapons_ViewAnimation(pl, trace_fraction >= 1 ? CBAR_ATTACK1MISS:CBAR_ATTACK1HIT); break; case 1: - Weapons_ViewAnimation(trace_fraction >= 1 ? CBAR_ATTACK2MISS:CBAR_ATTACK2HIT); + Weapons_ViewAnimation(pl, trace_fraction >= 1 ? CBAR_ATTACK2MISS:CBAR_ATTACK2HIT); break; default: - Weapons_ViewAnimation(trace_fraction >= 1 ? CBAR_ATTACK3MISS:CBAR_ATTACK3HIT); + Weapons_ViewAnimation(pl, trace_fraction >= 1 ? CBAR_ATTACK3MISS:CBAR_ATTACK3HIT); } if (self.flags & FL_CROUCHING) @@ -156,26 +155,25 @@ w_crowbar_primary(void) } void -w_crowbar_release(void) +w_crowbar_release(player pl) { - player pl = (player)self; if (pl.w_idle_next) { return; } - Weapons_ViewAnimation(CBAR_IDLE); + Weapons_ViewAnimation(pl, CBAR_IDLE); pl.w_idle_next = 15.0f; } float -w_crowbar_aimanim(void) +w_crowbar_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_crowbar_hudpic(int selected, vector pos, float a) +w_crowbar_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -217,7 +215,7 @@ weapon_t w_crowbar = .secondary = __NULL__, .reload = __NULL__, .release = w_crowbar_release, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_crowbar_precache, .pickup = __NULL__, .updateammo = w_crowbar_updateammo, diff --git a/src/shared/w_dbs.qc b/src/shared/w_dbs.qc index 5ab707a..bffaa93 100644 --- a/src/shared/w_dbs.qc +++ b/src/shared/w_dbs.qc @@ -53,7 +53,7 @@ w_dbs_wmodel(void) } string -w_dbs_pmodel(void) +w_dbs_pmodel(player pl) { return "models/p_shot2.mdl"; } @@ -65,33 +65,31 @@ w_dbs_deathmsg(void) } int -w_dbs_pickup(int new, int startammo) +w_dbs_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; pl.mag_dbs = bound(0, pl.mag_dbs + 16, 16); #endif return (1); } void -w_dbs_draw(void) +w_dbs_draw(player pl) { Weapons_SetModel("models/v_tfc_shotgun.mdl"); - Weapons_ViewAnimation(DBS_DRAW); + Weapons_ViewAnimation(pl, DBS_DRAW); } void -w_dbs_holster(void) +w_dbs_holster(player pl) { - Weapons_ViewAnimation(DBS_HOLSTER); + Weapons_ViewAnimation(pl, DBS_HOLSTER); } void -w_dbs_primary(void) +w_dbs_primary(player pl) { int s; - player pl = (player)self; if (pl.mag_dbs != 1) s = w_baseshotgun_fire(WEAPON_DBS, player::mag_dbs, 14, 4, [0.14, 0.08, 0]); @@ -104,14 +102,14 @@ w_dbs_primary(void) break; case AUTO_FIRED: pl.mag_dbs--; - Weapons_ViewAnimation(DBS_FIRE1); - Weapons_ViewPunchAngle([-2,0,0]); + Weapons_ViewAnimation(pl, DBS_FIRE1); + Weapons_ViewPunchAngle(pl, [-2,0,0]); //Weapons_Sound(pl, CHAN_WEAPON, "weapon_mossberg.fire"); pl.w_attack_next = 0.7f; break; case AUTO_LAST: - Weapons_ViewAnimation(DBS_FIRE1); - Weapons_ViewPunchAngle([-2,0,0]); + Weapons_ViewAnimation(pl, DBS_FIRE1); + Weapons_ViewPunchAngle(pl, [-2,0,0]); //Weapons_Sound(pl, CHAN_WEAPON, "weapon_mossberg.fire"); pl.w_attack_next = 0.7f; break; @@ -125,46 +123,44 @@ w_dbs_primary(void) } void -w_dbs_reload(void) +w_dbs_reload(player pl) { - player pl = (player)self; w_baseshotgun_reload(player::mag_dbs, player::m_iAmmoShells, 16); } void -w_dbs_release(void) +w_dbs_release(player pl) { - player pl = (player)self; int s = w_baseshotgun_release(player::mag_dbs, player::m_iAmmoShells, 16); switch (s) { case SHOTGUN_IDLE: int r = (float)input_sequence % 3; if (r == 1) { - Weapons_ViewAnimation(DBS_IDLE1); + Weapons_ViewAnimation(pl, DBS_IDLE1); } else if (r == 2) { - Weapons_ViewAnimation(DBS_IDLE2); + Weapons_ViewAnimation(pl, DBS_IDLE2); } else { - Weapons_ViewAnimation(DBS_IDLE3); + Weapons_ViewAnimation(pl, DBS_IDLE3); } pl.w_idle_next = 5.0f; break; case SHOTGUN_BUSY: break; case SHOTGUN_START_RELOAD: - Weapons_ViewAnimation(DBS_START_RELOAD); + Weapons_ViewAnimation(pl, DBS_START_RELOAD); break; case SHOTGUN_RELOAD: - Weapons_ViewAnimation(DBS_ADDSHELL); + Weapons_ViewAnimation(pl, DBS_ADDSHELL); break; case SHOTGUN_END_RELOAD: - Weapons_ViewAnimation(DBS_PUMP); + Weapons_ViewAnimation(pl, DBS_PUMP); break; } } void -w_dbs_crosshair(void) +w_dbs_crosshair(player pl) { #ifdef CLIENT static vector cross_pos; @@ -178,13 +174,13 @@ w_dbs_crosshair(void) } float -w_dbs_aimanim(void) +w_dbs_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMSHOTGUN : ANIM_AIMSHOTGUN; } void -w_dbs_hudpic(int s, vector pos, float a) +w_dbs_hudpic(player pl, int s, vector pos, float a) { #ifdef CLIENT if (s) { @@ -207,7 +203,7 @@ weapon_t w_dbs = .secondary = w_dbs_release, .reload = w_dbs_reload, .release = w_dbs_release, - .crosshair = w_dbs_crosshair, + .postdraw = w_dbs_crosshair, .precache = w_dbs_precache, .pickup = w_dbs_pickup, .updateammo = w_dbs_updateammo, diff --git a/src/shared/w_flamer.qc b/src/shared/w_flamer.qc index c3b6b5d..285f364 100644 --- a/src/shared/w_flamer.qc +++ b/src/shared/w_flamer.qc @@ -36,7 +36,7 @@ w_flamer_wmodel(void) return "models/w_flamer.mdl"; } string -w_flamer_pmodel(void) +w_flamer_pmodel(player pl) { return "models/p_flamer.mdl"; } @@ -48,20 +48,20 @@ w_flamer_deathmsg(void) } void -w_flamer_draw(void) +w_flamer_draw(player pl) { Weapons_SetModel("models/v_flame.mdl"); - Weapons_ViewAnimation(0); + Weapons_ViewAnimation(pl, 0); } float -w_flamer_aimanim(void) +w_flamer_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_flamer_hudpic(int selected, vector pos, float a) +w_flamer_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -102,7 +102,7 @@ weapon_t w_flamer = .secondary = __NULL__, .reload = __NULL__, .release = __NULL__, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_flamer_precache, .pickup = __NULL__, .updateammo = w_flamer_updateammo, diff --git a/src/shared/w_glauncher.qc b/src/shared/w_glauncher.qc index 8f188e1..936f4c0 100644 --- a/src/shared/w_glauncher.qc +++ b/src/shared/w_glauncher.qc @@ -36,7 +36,7 @@ w_glauncher_wmodel(void) return "models/w_glauncher.mdl"; } string -w_glauncher_pmodel(void) +w_glauncher_pmodel(player pl) { return "models/p_glauncher.mdl"; } @@ -48,20 +48,20 @@ w_glauncher_deathmsg(void) } void -w_glauncher_draw(void) +w_glauncher_draw(player pl) { Weapons_SetModel("models/v_tfgl.mdl"); - Weapons_ViewAnimation(0); + Weapons_ViewAnimation(pl, 0); } float -w_glauncher_aimanim(void) +w_glauncher_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_glauncher_hudpic(int selected, vector pos, float a) +w_glauncher_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -102,7 +102,7 @@ weapon_t w_glauncher = .secondary = __NULL__, .reload = __NULL__, .release = __NULL__, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_glauncher_precache, .pickup = __NULL__, .updateammo = w_glauncher_updateammo, diff --git a/src/shared/w_grapple.qc b/src/shared/w_grapple.qc index da460f1..f98137b 100644 --- a/src/shared/w_grapple.qc +++ b/src/shared/w_grapple.qc @@ -36,7 +36,7 @@ w_grapple_wmodel(void) return "models/w_grapple.mdl"; } string -w_grapple_pmodel(void) +w_grapple_pmodel(player pl) { return "models/p_grapple.mdl"; } @@ -48,20 +48,20 @@ w_grapple_deathmsg(void) } void -w_grapple_draw(void) +w_grapple_draw(player pl) { Weapons_SetModel("models/v_grapple.mdl"); - Weapons_ViewAnimation(0); + Weapons_ViewAnimation(pl, 0); } float -w_grapple_aimanim(void) +w_grapple_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_grapple_hudpic(int selected, vector pos, float a) +w_grapple_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -102,7 +102,7 @@ weapon_t w_grapple = .secondary = __NULL__, .reload = __NULL__, .release = __NULL__, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_grapple_precache, .pickup = __NULL__, .updateammo = w_grapple_updateammo, diff --git a/src/shared/w_incendiary.qc b/src/shared/w_incendiary.qc index 327a973..fc514da 100644 --- a/src/shared/w_incendiary.qc +++ b/src/shared/w_incendiary.qc @@ -36,7 +36,7 @@ w_incendiary_wmodel(void) return "models/w_incendiary.mdl"; } string -w_incendiary_pmodel(void) +w_incendiary_pmodel(player pl) { return "models/p_incendiary.mdl"; } @@ -48,20 +48,20 @@ w_incendiary_deathmsg(void) } void -w_incendiary_draw(void) +w_incendiary_draw(player pl) { Weapons_SetModel("models/v_tfc_rpg.mdl"); - Weapons_ViewAnimation(0); + Weapons_ViewAnimation(pl, 0); } float -w_incendiary_aimanim(void) +w_incendiary_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_incendiary_hudpic(int selected, vector pos, float a) +w_incendiary_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -102,7 +102,7 @@ weapon_t w_incendiary = .secondary = __NULL__, .reload = __NULL__, .release = __NULL__, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_incendiary_precache, .pickup = __NULL__, .updateammo = w_incendiary_updateammo, diff --git a/src/shared/w_knife.qc b/src/shared/w_knife.qc index 2169698..19a7db0 100644 --- a/src/shared/w_knife.qc +++ b/src/shared/w_knife.qc @@ -36,7 +36,7 @@ w_knife_wmodel(void) return "models/w_knife.mdl"; } string -w_knife_pmodel(void) +w_knife_pmodel(player pl) { return "models/p_knife.mdl"; } @@ -48,20 +48,20 @@ w_knife_deathmsg(void) } void -w_knife_draw(void) +w_knife_draw(player pl) { Weapons_SetModel("models/v_tfc_knife.mdl"); - Weapons_ViewAnimation(0); + Weapons_ViewAnimation(pl, 0); } float -w_knife_aimanim(void) +w_knife_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_knife_hudpic(int selected, vector pos, float a) +w_knife_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -102,7 +102,7 @@ weapon_t w_knife = .secondary = __NULL__, .reload = __NULL__, .release = __NULL__, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_knife_precache, .pickup = __NULL__, .updateammo = w_knife_updateammo, diff --git a/src/shared/w_medkit.qc b/src/shared/w_medkit.qc index d848069..8a859aa 100644 --- a/src/shared/w_medkit.qc +++ b/src/shared/w_medkit.qc @@ -36,7 +36,7 @@ w_medkit_wmodel(void) return "models/w_medkit.mdl"; } string -w_medkit_pmodel(void) +w_medkit_pmodel(player pl) { return "models/p_medkit.mdl"; } @@ -48,20 +48,20 @@ w_medkit_deathmsg(void) } void -w_medkit_draw(void) +w_medkit_draw(player pl) { Weapons_SetModel("models/v_tfc_medkit.mdl"); - Weapons_ViewAnimation(0); + Weapons_ViewAnimation(pl, 0); } float -w_medkit_aimanim(void) +w_medkit_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_medkit_hudpic(int selected, vector pos, float a) +w_medkit_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -102,7 +102,7 @@ weapon_t w_medkit = .secondary = __NULL__, .reload = __NULL__, .release = __NULL__, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_medkit_precache, .pickup = __NULL__, .updateammo = w_medkit_updateammo, diff --git a/src/shared/w_nailgun.qc b/src/shared/w_nailgun.qc index 4e1ef76..ba38a15 100644 --- a/src/shared/w_nailgun.qc +++ b/src/shared/w_nailgun.qc @@ -47,7 +47,7 @@ w_nailgun_wmodel(void) return "models/w_nailgun.mdl"; } string -w_nailgun_pmodel(void) +w_nailgun_pmodel(player pl) { return "models/p_nailgun.mdl"; } @@ -59,29 +59,29 @@ w_nailgun_deathmsg(void) } void -w_nailgun_draw(void) +w_nailgun_draw(player pl) { Weapons_SetModel("models/v_tfc_nailgun.mdl"); - Weapons_ViewAnimation(NAILGUN_DEPLOY); + Weapons_ViewAnimation(pl, NAILGUN_DEPLOY); } float -w_nailgun_aimanim(void) +w_nailgun_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_nailgun_shootnail(void) +w_nailgun_shootnail(player pl) { static void w_rpg_shootrocket_touch(void) { remove(self); } - Weapons_MakeVectors(); + Weapons_MakeVectors(pl); entity p = spawn(); setmodel(p, "models/nail.mdl"); - setorigin(p, Weapons_GetCameraPos() + (v_forward * 8)); + setorigin(p, Weapons_GetCameraPos(pl) + (v_forward * 8)); p.owner = self; p.movetype = MOVETYPE_FLYMISSILE; p.solid = SOLID_BBOX; @@ -94,10 +94,9 @@ w_nailgun_shootnail(void) } void -w_nailgun_primary(void) +w_nailgun_primary(player pl) { - player pl = (player)self; - int s = w_baseprojectile_fire(WEAPON_NAILGUN, player::m_iAmmoNails, w_nailgun_shootnail); + int s = w_baseprojectile_fire(pl, WEAPON_NAILGUN, player::m_iAmmoNails, w_nailgun_shootnail); switch (s) { case AUTO_FIRE_FAILED: @@ -107,14 +106,14 @@ w_nailgun_primary(void) case AUTO_LAST: int r = (float)input_sequence % 3; if (r == 1) { - Weapons_ViewAnimation(NAILGUN_SHOOT1); + Weapons_ViewAnimation(pl, NAILGUN_SHOOT1); } else if (r == 2) { - Weapons_ViewAnimation(NAILGUN_SHOOT2); + Weapons_ViewAnimation(pl, NAILGUN_SHOOT2); } else { - Weapons_ViewAnimation(NAILGUN_SHOOT3); + Weapons_ViewAnimation(pl, NAILGUN_SHOOT3); } - Weapons_ViewAnimation(NAILGUN_SHOOT2); - Weapons_ViewPunchAngle([-1,0,0]); + Weapons_ViewAnimation(pl, NAILGUN_SHOOT2); + Weapons_ViewPunchAngle(pl, [-1,0,0]); pl.w_attack_next = 0.1f; break; case AUTO_EMPTY: @@ -126,10 +125,9 @@ w_nailgun_primary(void) } void -w_nailgun_hud(void) +w_nailgun_hud(player pl) { #ifdef CLIENT - player pl = (player)self; vector cross_pos; vector aicon_pos; @@ -163,7 +161,7 @@ w_nailgun_hud(void) } void -w_nailgun_hudpic(int selected, vector pos, float a) +w_nailgun_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -204,7 +202,7 @@ weapon_t w_nailgun = .secondary = __NULL__, .reload = __NULL__, .release = __NULL__, - .crosshair = w_nailgun_hud, + .postdraw = w_nailgun_hud, .precache = w_nailgun_precache, .pickup = __NULL__, .updateammo = w_nailgun_updateammo, diff --git a/src/shared/w_pipebomb.qc b/src/shared/w_pipebomb.qc index 05e5826..9019c43 100644 --- a/src/shared/w_pipebomb.qc +++ b/src/shared/w_pipebomb.qc @@ -37,7 +37,7 @@ w_pipebomb_wmodel(void) } string -w_pipebomb_pmodel(void) +w_pipebomb_pmodel(player pl) { return "models/p_pipebomb.mdl"; } @@ -49,20 +49,20 @@ w_pipebomb_deathmsg(void) } void -w_pipebomb_draw(void) +w_pipebomb_draw(player pl) { Weapons_SetModel("models/v_tfgl.mdl"); - Weapons_ViewAnimation(0); + Weapons_ViewAnimation(pl, 0); } float -w_pipebomb_aimanim(void) +w_pipebomb_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_pipebomb_hudpic(int selected, vector pos, float a) +w_pipebomb_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -103,7 +103,7 @@ weapon_t w_pipebomb = .secondary = __NULL__, .reload = __NULL__, .release = __NULL__, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_pipebomb_precache, .pickup = __NULL__, .updateammo = w_pipebomb_updateammo, diff --git a/src/shared/w_railgun.qc b/src/shared/w_railgun.qc index a364bbd..db0596f 100644 --- a/src/shared/w_railgun.qc +++ b/src/shared/w_railgun.qc @@ -36,7 +36,7 @@ w_railgun_wmodel(void) return "models/w_railgun.mdl"; } string -w_railgun_pmodel(void) +w_railgun_pmodel(player pl) { return "models/p_railgun.mdl"; } @@ -48,20 +48,20 @@ w_railgun_deathmsg(void) } void -w_railgun_draw(void) +w_railgun_draw(player pl) { Weapons_SetModel("models/v_tfc_railgun.mdl"); - Weapons_ViewAnimation(0); + Weapons_ViewAnimation(pl, 0); } float -w_railgun_aimanim(void) +w_railgun_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_railgun_hudpic(int selected, vector pos, float a) +w_railgun_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -102,7 +102,7 @@ weapon_t w_railgun = .secondary = __NULL__, .reload = __NULL__, .release = __NULL__, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_railgun_precache, .pickup = __NULL__, .updateammo = w_railgun_updateammo, diff --git a/src/shared/w_rpg.qc b/src/shared/w_rpg.qc index 4ddf1f6..98c0163 100644 --- a/src/shared/w_rpg.qc +++ b/src/shared/w_rpg.qc @@ -42,10 +42,9 @@ w_rpg_precache(void) } int -w_rpg_pickup(int new, int startammo) +w_rpg_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; pl.mag_rpg = bound(0, pl.mag_rpg + 4, 4); #endif return (1); @@ -64,7 +63,7 @@ w_rpg_wmodel(void) } string -w_rpg_pmodel(void) +w_rpg_pmodel(player pl) { return "models/p_rpg.mdl"; } @@ -76,24 +75,24 @@ w_rpg_deathmsg(void) } void -w_rpg_draw(void) +w_rpg_draw(player pl) { Weapons_SetModel("models/v_tfc_rpg.mdl"); - Weapons_ViewAnimation(0); + Weapons_ViewAnimation(pl, 0); } void -w_rpg_shootrocket(void) +w_rpg_shootrocket(player pl) { static void w_rpg_shootrocket_touch(void) { FX_Explosion(self.origin); remove(self); } - Weapons_MakeVectors(); + Weapons_MakeVectors(pl); entity p = spawn(); setmodel(p, "models/rpgrocket.mdl"); - setorigin(p, Weapons_GetCameraPos() + (v_forward * 8)); + setorigin(p, Weapons_GetCameraPos(pl) + (v_forward * 8)); p.owner = self; p.movetype = MOVETYPE_FLYMISSILE; p.solid = SOLID_BBOX; @@ -106,23 +105,22 @@ w_rpg_shootrocket(void) } void -w_rpg_primary(void) +w_rpg_primary(player pl) { - player pl = (player)self; - int s = w_baseprojectile_fire(WEAPON_RPG, player::mag_rpg, w_rpg_shootrocket); + int s = w_baseprojectile_fire(pl, WEAPON_RPG, player::mag_rpg, w_rpg_shootrocket); switch (s) { case AUTO_FIRE_FAILED: return; break; case AUTO_FIRED: - Weapons_ViewAnimation(RPG_FIRE); - Weapons_ViewPunchAngle([-2,0,0]); + Weapons_ViewAnimation(pl, RPG_FIRE); + Weapons_ViewPunchAngle(pl, [-2,0,0]); pl.w_attack_next = 0.8f; break; case AUTO_LAST: - Weapons_ViewAnimation(RPG_FIRE); - Weapons_ViewPunchAngle([-2,0,0]); + Weapons_ViewAnimation(pl, RPG_FIRE); + Weapons_ViewPunchAngle(pl, [-2,0,0]); pl.w_attack_next = 0.8f; break; case AUTO_EMPTY: @@ -134,55 +132,52 @@ w_rpg_primary(void) } void -w_rpg_reload(void) +w_rpg_reload(player pl) { - player pl = (player)self; w_baseshotgun_reload(player::mag_rpg, player::m_iAmmoRockets, 4); } void -w_rpg_release(void) +w_rpg_release(player pl) { - player pl = (player)self; int s = w_baseshotgun_release(player::mag_rpg, player::m_iAmmoRockets, 4); switch (s) { case SHOTGUN_IDLE: int r = (float)input_sequence % 3; if (r == 1) { - Weapons_ViewAnimation(RPG_IDLE1); + Weapons_ViewAnimation(pl, RPG_IDLE1); } else if (r == 2) { - Weapons_ViewAnimation(RPG_FIDGET1); + Weapons_ViewAnimation(pl, RPG_FIDGET1); } else { - Weapons_ViewAnimation(RPG_FIDGET2); + Weapons_ViewAnimation(pl, RPG_FIDGET2); } pl.w_idle_next = 5.0f; break; case SHOTGUN_BUSY: break; case SHOTGUN_START_RELOAD: - Weapons_ViewAnimation(RPG_RELOAD_START); + Weapons_ViewAnimation(pl, RPG_RELOAD_START); break; case SHOTGUN_RELOAD: - Weapons_ViewAnimation(RPG_RELOAD); + Weapons_ViewAnimation(pl, RPG_RELOAD); break; case SHOTGUN_END_RELOAD: - Weapons_ViewAnimation(RPG_RELOAD_END); + Weapons_ViewAnimation(pl, RPG_RELOAD_END); break; } } float -w_rpg_aimanim(void) +w_rpg_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_rpg_hud(void) +w_rpg_hud(player pl) { #ifdef CLIENT - player pl = (player)self; vector cross_pos; vector aicon_pos; @@ -220,7 +215,7 @@ w_rpg_hud(void) void -w_rpg_hudpic(int selected, vector pos, float a) +w_rpg_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -243,7 +238,7 @@ weapon_t w_rpg = .secondary = __NULL__, .reload = w_rpg_reload, .release = w_rpg_release, - .crosshair = w_rpg_hud, + .postdraw = w_rpg_hud, .precache = w_rpg_precache, .pickup = w_rpg_pickup, .updateammo = w_rpg_updateammo, diff --git a/src/shared/w_sbs.qc b/src/shared/w_sbs.qc index 7b599b5..92cad36 100644 --- a/src/shared/w_sbs.qc +++ b/src/shared/w_sbs.qc @@ -50,7 +50,7 @@ string w_sbs_wmodel(void) { return "models/ball.mdl"; } -string w_sbs_pmodel(void) +string w_sbs_pmodel(player pl) { return "models/p_shotgun.mdl"; } @@ -60,32 +60,30 @@ string w_sbs_deathmsg(void) } int -w_sbs_pickup(int new, int startammo) +w_sbs_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; pl.mag_sbs = bound(0, pl.mag_sbs + 8, 8); #endif return (1); } void -w_sbs_draw(void) +w_sbs_draw(player pl) { Weapons_SetModel("models/v_tfc_12gauge.mdl"); - Weapons_ViewAnimation(SBS_DRAW); + Weapons_ViewAnimation(pl, SBS_DRAW); } void -w_sbs_holster(void) +w_sbs_holster(player pl) { - Weapons_ViewAnimation(SBS_HOLSTER); + Weapons_ViewAnimation(pl, SBS_HOLSTER); } void -w_sbs_primary(void) +w_sbs_primary(player pl) { - player pl = (player)self; int s = w_baseshotgun_fire(WEAPON_SBS, player::mag_sbs, 6, 4, [0.04, 0.04, 0]); switch (s) { @@ -93,14 +91,14 @@ w_sbs_primary(void) return; break; case AUTO_FIRED: - Weapons_ViewAnimation(SBS_FIRE1); - Weapons_ViewPunchAngle([-2,0,0]); + Weapons_ViewAnimation(pl, SBS_FIRE1); + Weapons_ViewPunchAngle(pl, [-2,0,0]); //Weapons_Sound(pl, CHAN_WEAPON, "weapon_mossberg.fire"); pl.w_attack_next = 0.5f; break; case AUTO_LAST: - Weapons_ViewAnimation(SBS_FIRE1); - Weapons_ViewPunchAngle([-2,0,0]); + Weapons_ViewAnimation(pl, SBS_FIRE1); + Weapons_ViewPunchAngle(pl, [-2,0,0]); //Weapons_Sound(pl, CHAN_WEAPON, "weapon_mossberg.fire"); pl.w_attack_next = 0.5f; break; @@ -114,46 +112,44 @@ w_sbs_primary(void) } void -w_sbs_reload(void) +w_sbs_reload(player pl) { - player pl = (player)self; w_baseshotgun_reload(player::mag_sbs, player::m_iAmmoShells, 8); } void -w_sbs_release(void) +w_sbs_release(player pl) { - player pl = (player)self; int s = w_baseshotgun_release(player::mag_sbs, player::m_iAmmoShells, 8); switch (s) { case SHOTGUN_IDLE: int r = (float)input_sequence % 3; if (r == 1) { - Weapons_ViewAnimation(SBS_IDLE1); + Weapons_ViewAnimation(pl, SBS_IDLE1); } else if (r == 2) { - Weapons_ViewAnimation(SBS_IDLE2); + Weapons_ViewAnimation(pl, SBS_IDLE2); } else { - Weapons_ViewAnimation(SBS_IDLE3); + Weapons_ViewAnimation(pl, SBS_IDLE3); } pl.w_idle_next = 5.0f; break; case SHOTGUN_BUSY: break; case SHOTGUN_START_RELOAD: - Weapons_ViewAnimation(SBS_START_RELOAD); + Weapons_ViewAnimation(pl, SBS_START_RELOAD); break; case SHOTGUN_RELOAD: - Weapons_ViewAnimation(SBS_ADDSHELL); + Weapons_ViewAnimation(pl, SBS_ADDSHELL); break; case SHOTGUN_END_RELOAD: - Weapons_ViewAnimation(SBS_PUMP); + Weapons_ViewAnimation(pl, SBS_PUMP); break; } } void -w_sbs_crosshair(void) +w_sbs_crosshair(player pl) { #ifdef CLIENT static vector cross_pos; @@ -167,13 +163,13 @@ w_sbs_crosshair(void) } float -w_sbs_aimanim(void) +w_sbs_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMSHOTGUN : ANIM_AIMSHOTGUN; } void -w_sbs_hudpic(int s, vector pos, float a) +w_sbs_hudpic(player pl, int s, vector pos, float a) { #ifdef CLIENT if (s) { @@ -196,7 +192,7 @@ weapon_t w_sbs = .secondary = w_sbs_release, .reload = w_sbs_reload, .release = w_sbs_release, - .crosshair = w_sbs_crosshair, + .postdraw = w_sbs_crosshair, .precache = w_sbs_precache, .pickup = w_sbs_pickup, .updateammo = w_sbs_updateammo, diff --git a/src/shared/w_sniper.qc b/src/shared/w_sniper.qc index aea73a0..c342443 100644 --- a/src/shared/w_sniper.qc +++ b/src/shared/w_sniper.qc @@ -36,7 +36,7 @@ w_sniper_wmodel(void) return "models/w_sniper.mdl"; } string -w_sniper_pmodel(void) +w_sniper_pmodel(player pl) { return "models/p_sniper.mdl"; } @@ -48,20 +48,20 @@ w_sniper_deathmsg(void) } void -w_sniper_draw(void) +w_sniper_draw(player pl) { Weapons_SetModel("models/v_tfc_sniper.mdl"); - Weapons_ViewAnimation(0); + Weapons_ViewAnimation(pl, 0); } float -w_sniper_aimanim(void) +w_sniper_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_sniper_hudpic(int selected, vector pos, float a) +w_sniper_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -102,7 +102,7 @@ weapon_t w_sniper = .secondary = __NULL__, .reload = __NULL__, .release = __NULL__, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_sniper_precache, .pickup = __NULL__, .updateammo = w_sniper_updateammo, diff --git a/src/shared/w_supernail.qc b/src/shared/w_supernail.qc index 67d3012..0b5050e 100644 --- a/src/shared/w_supernail.qc +++ b/src/shared/w_supernail.qc @@ -36,7 +36,7 @@ w_supernail_wmodel(void) return "models/w_supernail.mdl"; } string -w_supernail_pmodel(void) +w_supernail_pmodel(player pl) { return "models/p_supernail.mdl"; } @@ -48,20 +48,20 @@ w_supernail_deathmsg(void) } void -w_supernail_draw(void) +w_supernail_draw(player pl) { Weapons_SetModel("models/v_tfc_supernailgun.mdl"); - Weapons_ViewAnimation(0); + Weapons_ViewAnimation(pl, 0); } float -w_supernail_aimanim(void) +w_supernail_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_supernail_hudpic(int selected, vector pos, float a) +w_supernail_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -102,7 +102,7 @@ weapon_t w_supernail = .secondary = __NULL__, .reload = __NULL__, .release = __NULL__, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_supernail_precache, .pickup = __NULL__, .updateammo = w_supernail_updateammo, diff --git a/src/shared/w_tranquil.qc b/src/shared/w_tranquil.qc index 63706fd..6cc7919 100644 --- a/src/shared/w_tranquil.qc +++ b/src/shared/w_tranquil.qc @@ -36,7 +36,7 @@ w_tranquil_wmodel(void) return "models/w_tranquil.mdl"; } string -w_tranquil_pmodel(void) +w_tranquil_pmodel(player pl) { return "models/p_tranquil.mdl"; } @@ -48,20 +48,20 @@ w_tranquil_deathmsg(void) } void -w_tranquil_draw(void) +w_tranquil_draw(player pl) { Weapons_SetModel("models/v_tfc_pistol.mdl"); - Weapons_ViewAnimation(0); + Weapons_ViewAnimation(pl, 0); } float -w_tranquil_aimanim(void) +w_tranquil_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_tranquil_hudpic(int selected, vector pos, float a) +w_tranquil_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -102,7 +102,7 @@ weapon_t w_tranquil = .secondary = __NULL__, .reload = __NULL__, .release = __NULL__, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_tranquil_precache, .pickup = __NULL__, .updateammo = w_tranquil_updateammo, diff --git a/src/shared/w_umbrella.qc b/src/shared/w_umbrella.qc index e0e22dd..72a2ab8 100644 --- a/src/shared/w_umbrella.qc +++ b/src/shared/w_umbrella.qc @@ -58,7 +58,7 @@ w_umbrella_wmodel(void) return "models/w_umbrella.mdl"; } string -w_umbrella_pmodel(void) +w_umbrella_pmodel(player pl) { return "models/p_umbrella.mdl"; } @@ -70,30 +70,29 @@ w_umbrella_deathmsg(void) } void -w_umbrella_draw(void) +w_umbrella_draw(player pl) { Weapons_SetModel("models/v_umbrella.mdl"); - Weapons_ViewAnimation(UMBRELLA_DRAW); + Weapons_ViewAnimation(pl, UMBRELLA_DRAW); } void -w_umbrella_holster(void) +w_umbrella_holster(player pl) { - Weapons_ViewAnimation(UMBRELLA_HOLSTER); + Weapons_ViewAnimation(pl, UMBRELLA_HOLSTER); } void -w_umbrella_primary(void) +w_umbrella_primary(player pl) { int anim = 0; vector src; - player pl = (player)self; if (pl.w_attack_next) { return; } - Weapons_MakeVectors(); + Weapons_MakeVectors(pl); src = pl.origin + pl.view_ofs; traceline(src, src + (v_forward * 32), FALSE, pl); @@ -108,7 +107,7 @@ w_umbrella_primary(void) default: anim = trace_fraction >= 1 ? UMBRELLA_ATTACK3MISS:UMBRELLA_ATTACK3HIT; } - Weapons_ViewAnimation(anim); + Weapons_ViewAnimation(pl, anim); if (trace_fraction >= 1.0) { pl.w_attack_next = 0.5f; @@ -163,26 +162,25 @@ w_umbrella_primary(void) } void -w_umbrella_release(void) +w_umbrella_release(player pl) { - player pl = (player)self; if (pl.w_idle_next) { return; } - Weapons_ViewAnimation(UMBRELLA_IDLE); + Weapons_ViewAnimation(pl, UMBRELLA_IDLE); pl.w_idle_next = 15.0f; } float -w_umbrella_aimanim(void) +w_umbrella_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_umbrella_hudpic(int selected, vector pos, float a) +w_umbrella_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -223,7 +221,7 @@ weapon_t w_umbrella = .secondary = __NULL__, .reload = __NULL__, .release = w_umbrella_release, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_umbrella_precache, .pickup = __NULL__, .updateammo = w_umbrella_updateammo, diff --git a/src/shared/w_wrench.qc b/src/shared/w_wrench.qc index 2447c43..36507fe 100644 --- a/src/shared/w_wrench.qc +++ b/src/shared/w_wrench.qc @@ -51,7 +51,7 @@ w_wrench_wmodel(void) return "models/ball.mdl"; } string -w_wrench_pmodel(void) +w_wrench_pmodel(player pl) { return "models/p_spanner.mdl"; } @@ -63,30 +63,29 @@ w_wrench_deathmsg(void) } void -w_wrench_draw(void) +w_wrench_draw(player pl) { Weapons_SetModel("models/v_tfc_spanner.mdl"); - Weapons_ViewAnimation(WRENCH_DRAW); + Weapons_ViewAnimation(pl, WRENCH_DRAW); } void -w_wrench_holster(void) +w_wrench_holster(player pl) { - Weapons_ViewAnimation(WRENCH_HOLSTER); + Weapons_ViewAnimation(pl, WRENCH_HOLSTER); } void -w_wrench_primary(void) +w_wrench_primary(player pl) { int anim = 0; vector src; - player pl = (player)self; if (pl.w_attack_next) { return; } - Weapons_MakeVectors(); + Weapons_MakeVectors(pl); src = pl.origin + pl.view_ofs; traceline(src, src + (v_forward * 32), FALSE, pl); @@ -98,7 +97,7 @@ w_wrench_primary(void) default: anim = WRENCH_ATTACK2; } - Weapons_ViewAnimation(anim); + Weapons_ViewAnimation(pl, anim); if (trace_fraction < 1.0) { pl.w_attack_next = 0.25f; @@ -153,26 +152,25 @@ w_wrench_primary(void) } void -w_wrench_release(void) +w_wrench_release(player pl) { - player pl = (player)self; if (pl.w_idle_next) { return; } - Weapons_ViewAnimation(WRENCH_IDLE); + Weapons_ViewAnimation(pl, WRENCH_IDLE); pl.w_idle_next = 15.0f; } float -w_wrench_aimanim(void) +w_wrench_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR; } void -w_wrench_hudpic(int selected, vector pos, float a) +w_wrench_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -213,7 +211,7 @@ weapon_t w_wrench = .secondary = __NULL__, .reload = __NULL__, .release = w_wrench_release, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_wrench_precache, .pickup = __NULL__, .updateammo = w_wrench_updateammo,