diff --git a/src/client/entities.qc b/src/client/entities.qc index 5cff7d8..d37263e 100644 --- a/src/client/entities.qc +++ b/src/client/entities.qc @@ -27,10 +27,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/client/hud.qc b/src/client/hud.qc index ffd0d95..12d9113 100644 --- a/src/client/hud.qc +++ b/src/client/hud.qc @@ -632,6 +632,7 @@ HUD_DrawProgress(void) void HUD_DrawNotify(void) { + player pl = (player)pSeat->m_ePlayer; vector pos; float a; @@ -645,7 +646,7 @@ HUD_DrawNotify(void) } a = bound(0.0, pSeatLocal->m_flPickupAlpha, 1.0); - Weapons_HUDPic(pSeatLocal->m_iPickupWeapon, 1, pos, a); + Weapons_HUDPic(pl, pSeatLocal->m_iPickupWeapon, 1, pos, a); pos[0] += 148; pos[1] -= 32; HUD_AmmoNotify_Draw(pos); @@ -668,7 +669,7 @@ HUD_Draw(void) g_hud_color = autocvar_con_color * (1 / 255); /* little point in not drawing these, even if you don't have a suit */ - Weapons_DrawCrosshair(); + Weapons_DrawCrosshair(pl); HUD_DrawWeaponSelect(); Obituary_Draw(); diff --git a/src/client/hud_weaponselect.qc b/src/client/hud_weaponselect.qc index 98d35fc..38801c9 100644 --- a/src/client/hud_weaponselect.qc +++ b/src/client/hud_weaponselect.qc @@ -204,13 +204,13 @@ HUD_DrawWeaponSelect(void) slot_selected = TRUE; if (x == wantpos) { // Selected Sprite - Weapons_HUDPic(pSeat->m_iHUDWeaponSelected, 1, vecPos, 1.0f); + Weapons_HUDPic(pl, pSeat->m_iHUDWeaponSelected, 1, vecPos, 1.0f); drawsubpic(vecPos, [170,45], g_hud3_spr, [0,180/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE); vecPos[1] += 50; } else if ((b=HUD_InSlotPos(i, x)) != -1) { // Unselected Sprite - Weapons_HUDPic(b, 0, vecPos, 1.0f); + Weapons_HUDPic(pl, b, 0, vecPos, 1.0f); vecPos[1] += 50; } } else if (HUD_InSlotPos(i, x) != -1) { diff --git a/src/client/view.qc b/src/client/view.qc index 3cc04e2..2a2bf90 100644 --- a/src/client/view.qc +++ b/src/client/view.qc @@ -15,10 +15,8 @@ */ void -View_UpdateWeapon(entity vm, entity mflash) +View_UpdateWeapon(player pl, entity vm, entity mflash) { - player pl = (player)pSeat->m_ePlayer; - /* only bother upon change */ if (pSeat->m_iLastWeapon == pl.activeweapon) { return; @@ -30,9 +28,6 @@ View_UpdateWeapon(entity vm, entity mflash) return; } - /* hack, we changed the wep, move this into Game_Input/PMove */ - Weapons_Draw(); - /* we forced a weapon call outside the prediction, * thus we need to update all the net variables to * make sure these updates are recognized. this is @@ -41,6 +36,20 @@ View_UpdateWeapon(entity vm, entity mflash) SAVE_STATE(pl.w_idle_next); SAVE_STATE(pl.viewzoom); SAVE_STATE(pl.weapontime); + SAVE_STATE(pl.weaponframe); + + /* hack, we changed the wep, move this into Game_Input/PMove */ + Weapons_Draw(pl); + + /* we forced a weapon call outside the prediction, + * thus we need to update all the net variables to + * make sure these updates are recognized. this is + * vile but it'll have to do for now */ + ROLL_BACK(pl.w_attack_next); + ROLL_BACK(pl.w_idle_next); + ROLL_BACK(pl.viewzoom); + ROLL_BACK(pl.weapontime); + ROLL_BACK(pl.weaponframe); /* figure out when the attachments start. in FTE attachments for * HLMDL are treated as bones. they start at numbones + 1 */ diff --git a/src/server/bot.qc b/src/server/bot.qc index d9ae79b..3e33c73 100644 --- a/src/server/bot.qc +++ b/src/server/bot.qc @@ -222,7 +222,7 @@ CSBot_BuyStart_Shop(void) for (int i = 0; i < g_weapons.length; i++) if (pl.g_items & g_weapons[i].id) { pl.activeweapon = i; - Weapons_Draw(); + Weapons_Draw(pl); return; } diff --git a/src/server/player.qc b/src/server/player.qc index c37c1c1..1602aba 100644 --- a/src/server/player.qc +++ b/src/server/player.qc @@ -77,14 +77,14 @@ Player_UseUp(void) } } -void Weapons_Draw(void); +void Weapons_Draw(player); void CSEv_PlayerSwitchWeapon_i(int w) { player pl = (player)self; pl.activeweapon = w; - Weapons_Draw(); + Weapons_Draw(pl); } void diff --git a/src/shared/animations.qc b/src/shared/animations.qc index 034b278..a68d076 100644 --- a/src/shared/animations.qc +++ b/src/shared/animations.qc @@ -70,7 +70,7 @@ Animation_PlayerUpdate(player pl) pl.basebone = gettagindex(self, "-- R shoulder outside"); if (pl.anim_top_delay <= 0.0f) { - pl.anim_top = Weapons_GetAim(pl.activeweapon); + pl.anim_top = Weapons_GetAim(pl, pl.activeweapon); } if (vlen(pl.velocity) == 0) { @@ -130,9 +130,11 @@ Animation_PlayerUpdate(player pl) void Animation_PlayerTop(player pl, float topanim, float timer) { +#if 0 pl.anim_top = topanim; pl.anim_top_time = 0.0f; pl.anim_top_delay = timer; +#endif } void diff --git a/src/shared/w_ak47.qc b/src/shared/w_ak47.qc index b42f43d..b871e6a 100644 --- a/src/shared/w_ak47.qc +++ b/src/shared/w_ak47.qc @@ -108,10 +108,9 @@ w_ak47_deathmsg(void) } int -w_ak47_pickup(int new, int startammo) +w_ak47_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -130,11 +129,10 @@ w_ak47_pickup(int new, int startammo) } void -w_ak47_draw(void) +w_ak47_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_ak47.mdl"); - Weapons_ViewAnimation(AK47_DRAW); + Weapons_ViewAnimation(pl, AK47_DRAW); #ifdef CLIENT pl.cs_cross_mindist = 4; @@ -143,9 +141,8 @@ w_ak47_draw(void) } void -w_ak47_primary(void) +w_ak47_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0) { return; @@ -161,13 +158,13 @@ w_ak47_primary(void) int r = (float)input_sequence % 3; switch (r) { case 0: - Weapons_ViewAnimation(AK47_SHOOT1); + Weapons_ViewAnimation(pl, AK47_SHOOT1); break; case 1: - Weapons_ViewAnimation(AK47_SHOOT2); + Weapons_ViewAnimation(pl, AK47_SHOOT2); break; default: - Weapons_ViewAnimation(AK47_SHOOT3); + Weapons_ViewAnimation(pl, AK47_SHOOT3); break; } @@ -190,9 +187,8 @@ w_ak47_primary(void) } void -w_ak47_reload(void) +w_ak47_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { return; @@ -204,7 +200,7 @@ w_ak47_reload(void) return; } - Weapons_ViewAnimation(AK47_RELOAD); + Weapons_ViewAnimation(pl, AK47_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::ak47_mag, player::ammo_762mm, 30); @@ -215,28 +211,27 @@ w_ak47_reload(void) } void -w_ak47_release(void) +w_ak47_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.ak47_mag == 0 && pl.ammo_762mm > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_ak47_aimanim(void) +w_ak47_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_AK47 : ANIM_AIM_AK47; } void -w_ak47_hud(void) +w_ak47_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -248,9 +243,8 @@ w_ak47_hud(void) } int -w_ak47_isempty(void) +w_ak47_isempty(player pl) { - player pl = (player)self; if (pl.ak47_mag <= 0 && pl.ammo_762mm <= 0) return 1; @@ -259,13 +253,12 @@ w_ak47_isempty(void) } void -w_ak47_hudpic(int selected, vector pos, float a) +w_ak47_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_ak47_isempty()) + if (w_ak47_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -312,7 +305,7 @@ weapon_t w_ak47 = .secondary = __NULL__, .reload = w_ak47_reload, .release = w_ak47_release, - .crosshair = w_ak47_hud, + .postdraw = w_ak47_hud, .precache = w_ak47_precache, .pickup = w_ak47_pickup, .updateammo = w_ak47_updateammo, diff --git a/src/shared/w_aug.qc b/src/shared/w_aug.qc index d1aa9c5..469746a 100644 --- a/src/shared/w_aug.qc +++ b/src/shared/w_aug.qc @@ -74,10 +74,9 @@ w_aug_deathmsg(void) } int -w_aug_pickup(int new, int startammo) +w_aug_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -96,11 +95,10 @@ w_aug_pickup(int new, int startammo) } void -w_aug_draw(void) +w_aug_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_aug.mdl"); - Weapons_ViewAnimation(AUG_DRAW); + Weapons_ViewAnimation(pl, AUG_DRAW); #ifdef CLIENT pl.cs_cross_mindist = 3; @@ -109,9 +107,8 @@ w_aug_draw(void) } void -w_aug_primary(void) +w_aug_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { return; @@ -127,13 +124,13 @@ w_aug_primary(void) int r = (float)input_sequence % 3; switch (r) { case 0: - Weapons_ViewAnimation(AUG_SHOOT1); + Weapons_ViewAnimation(pl, AUG_SHOOT1); break; case 1: - Weapons_ViewAnimation(AUG_SHOOT2); + Weapons_ViewAnimation(pl, AUG_SHOOT2); break; default: - Weapons_ViewAnimation(AUG_SHOOT3); + Weapons_ViewAnimation(pl, AUG_SHOOT3); break; } @@ -160,9 +157,8 @@ w_aug_primary(void) } void -w_aug_secondary(void) +w_aug_secondary(player pl) { - player pl = (player)self; if (pl.w_attack_next) { return; } @@ -176,9 +172,8 @@ w_aug_secondary(void) } void -w_aug_reload(void) +w_aug_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { return; @@ -189,7 +184,7 @@ w_aug_reload(void) if (!pl.ammo_762mm) { return; } - Weapons_ViewAnimation(AUG_RELOAD); + Weapons_ViewAnimation(pl, AUG_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::aug_mag, player::ammo_762mm, 30); @@ -200,31 +195,29 @@ w_aug_reload(void) } void -w_aug_release(void) +w_aug_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.aug_mag == 0 && pl.ammo_762mm > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_aug_aimanim(void) +w_aug_aimanim(player pl) { - return w_ak47_aimanim(); + return w_ak47_aimanim(pl); } void -w_aug_hud(void) +w_aug_hud(player pl) { #ifdef CLIENT - player pl = (player)self; if (pl.viewzoom == 1.0f) { Cstrike_DrawCrosshair(); } else { @@ -238,9 +231,8 @@ w_aug_hud(void) } int -w_aug_isempty(void) +w_aug_isempty(player pl) { - player pl = (player)self; if (pl.aug_mag <= 0 && pl.ammo_762mm <= 0) return 1; @@ -249,13 +241,12 @@ w_aug_isempty(void) } void -w_aug_hudpic(int selected, vector pos, float a) +w_aug_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_aug_isempty()) + if (w_aug_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -302,7 +293,7 @@ weapon_t w_aug = .secondary = w_aug_secondary, .reload = w_aug_reload, .release = w_aug_release, - .crosshair = w_aug_hud, + .postdraw = w_aug_hud, .precache = w_aug_precache, .pickup = w_aug_pickup, .updateammo = w_aug_updateammo, diff --git a/src/shared/w_awp.qc b/src/shared/w_awp.qc index 2934684..b137845 100644 --- a/src/shared/w_awp.qc +++ b/src/shared/w_awp.qc @@ -107,10 +107,9 @@ w_awp_deathmsg(void) } int -w_awp_pickup(int new, int startammo) +w_awp_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -129,11 +128,10 @@ w_awp_pickup(int new, int startammo) } void -w_awp_draw(void) +w_awp_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_awp.mdl"); - Weapons_ViewAnimation(AWP_DRAW); + Weapons_ViewAnimation(pl, AWP_DRAW); pl.mode_temp = 0; #ifdef CLIENT @@ -143,16 +141,15 @@ w_awp_draw(void) } void -w_awp_release(void) +w_awp_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.awp_mag == 0 && pl.ammo_338mag > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } @@ -175,9 +172,8 @@ w_awp_release(void) } void -w_awp_secondary(void) +w_awp_secondary(player pl) { - player pl = (player)self; if (pl.w_attack_next) { return; } @@ -197,16 +193,15 @@ w_awp_secondary(void) pl.w_attack_next = 0.3f; pl.w_idle_next = 0.0f; - w_awp_release(); + w_awp_release(pl); } void -w_awp_primary(void) +w_awp_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { - w_awp_release(); + w_awp_release(pl); return; } if (!pl.awp_mag) { @@ -220,13 +215,13 @@ w_awp_primary(void) int r = (float)input_sequence % 3; switch (r) { case 0: - Weapons_ViewAnimation(AWP_SHOOT1); + Weapons_ViewAnimation(pl, AWP_SHOOT1); break; case 1: - Weapons_ViewAnimation(AWP_SHOOT2); + Weapons_ViewAnimation(pl, AWP_SHOOT2); break; default: - Weapons_ViewAnimation(AWP_SHOOT3); + Weapons_ViewAnimation(pl, AWP_SHOOT3); break; } @@ -250,9 +245,8 @@ w_awp_primary(void) } void -w_awp_reload(void) +w_awp_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -261,7 +255,7 @@ w_awp_reload(void) if (!pl.ammo_338mag) return; - Weapons_ViewAnimation(AWP_RELOAD); + Weapons_ViewAnimation(pl, AWP_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::awp_mag, player::ammo_338mag, 10); @@ -272,16 +266,15 @@ w_awp_reload(void) } float -w_awp_aimanim(void) +w_awp_aimanim(player pl) { - return w_ak47_aimanim(); + return w_ak47_aimanim(pl); } void -w_awp_hud(void) +w_awp_hud(player pl) { #ifdef CLIENT - player pl = (player)self; if (pl.viewzoom < 1.0f) { Cstrike_DrawScope(); } @@ -293,9 +286,8 @@ w_awp_hud(void) } int -w_awp_isempty(void) +w_awp_isempty(player pl) { - player pl = (player)self; if (pl.awp_mag <= 0 && pl.ammo_338mag <= 0) return 1; @@ -304,13 +296,12 @@ w_awp_isempty(void) } void -w_awp_hudpic(int selected, vector pos, float a) +w_awp_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_awp_isempty()) + if (w_awp_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -357,7 +348,7 @@ weapon_t w_awp = .secondary = w_awp_secondary, .reload = w_awp_reload, .release = w_awp_release, - .crosshair = w_awp_hud, + .postdraw = w_awp_hud, .precache = w_awp_precache, .pickup = w_awp_pickup, .updateammo = w_awp_updateammo, diff --git a/src/shared/w_c4bomb.qc b/src/shared/w_c4bomb.qc index 8585a43..1841eb8 100644 --- a/src/shared/w_c4bomb.qc +++ b/src/shared/w_c4bomb.qc @@ -95,18 +95,16 @@ w_c4bomb_deathmsg(void) } void -w_c4bomb_draw(void) +w_c4bomb_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_c4.mdl"); - Weapons_ViewAnimation(C4_DRAW); + Weapons_ViewAnimation(pl, C4_DRAW); pl.mode_temp = 0; } void -w_c4bomb_release(void) +w_c4bomb_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); @@ -123,16 +121,15 @@ w_c4bomb_release(void) /* reset animation */ if (pl.mode_temp != C4S_NONE) { - Weapons_ViewAnimation(C4_IDLE); + Weapons_ViewAnimation(pl, C4_IDLE); } pl.mode_temp = C4S_NONE; pl.w_idle_next = 0.0f; } void -w_c4bomb_primary(void) +w_c4bomb_primary(player pl) { - player pl = (player)self; if (!(pl.gflags & GF_BOMBZONE)) { return; @@ -144,18 +141,18 @@ w_c4bomb_primary(void) switch (pl.mode_temp) { case C4S_NONE: pl.mode_temp = C4S_ENTERINGCODE; - Weapons_ViewAnimation(C4_ENTERCODE); + Weapons_ViewAnimation(pl, C4_ENTERCODE); pl.w_idle_next = 3.0f; break; case C4S_ENTERINGCODE: if (pl.w_idle_next <= 0.0f) { pl.mode_temp = C4S_DROPPING; - Weapons_ViewAnimation(C4_DROP); + Weapons_ViewAnimation(pl, C4_DROP); pl.w_idle_next = 1.0f; } break; case C4S_DROPPING: - w_c4bomb_release(); + w_c4bomb_release(pl); return; break; default: @@ -166,13 +163,13 @@ w_c4bomb_primary(void) } float -w_c4bomb_aimanim(void) +w_c4bomb_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_C4 : ANIM_AIM_C4; } void -w_c4bomb_hud(void) +w_c4bomb_hud(player pl) { #ifdef CLIENT HUD_DrawAmmo2(); @@ -182,10 +179,9 @@ w_c4bomb_hud(void) } int -w_c4bomb_pickup(int new, int startammo) +w_c4bomb_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (pl.team != TEAM_T) return (0); @@ -194,7 +190,7 @@ w_c4bomb_pickup(int new, int startammo) } void -w_c4bomb_hudpic(int selected, vector pos, float a) +w_c4bomb_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT if (selected) { @@ -236,7 +232,7 @@ weapon_t w_c4bomb = .secondary = __NULL__, .reload = __NULL__, .release = w_c4bomb_release, - .crosshair = w_c4bomb_hud, + .postdraw = w_c4bomb_hud, .precache = w_c4bomb_precache, .pickup = w_c4bomb_pickup, .updateammo = w_c4bomb_updateammo, diff --git a/src/shared/w_deagle.qc b/src/shared/w_deagle.qc index 5a4dce6..0b6287b 100644 --- a/src/shared/w_deagle.qc +++ b/src/shared/w_deagle.qc @@ -106,10 +106,9 @@ w_deagle_deathmsg(void) } int -w_deagle_pickup(int new, int startammo) +w_deagle_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -128,11 +127,10 @@ w_deagle_pickup(int new, int startammo) } void -w_deagle_draw(void) +w_deagle_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_deagle.mdl"); - Weapons_ViewAnimation(DEAGLE_DRAW); + Weapons_ViewAnimation(pl, DEAGLE_DRAW); #ifdef CLIENT pl.cs_cross_mindist = 8; @@ -141,9 +139,8 @@ w_deagle_draw(void) } void -w_deagle_primary(void) +w_deagle_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -157,15 +154,15 @@ w_deagle_primary(void) pl.deagle_mag--; if (pl.deagle_mag <= 0) { - Weapons_ViewAnimation(DEAGLE_SHOOT_EMPTY); + Weapons_ViewAnimation(pl, DEAGLE_SHOOT_EMPTY); } else { int r = (float)input_sequence % 2; switch (r) { case 0: - Weapons_ViewAnimation(DEAGLE_SHOOT1); + Weapons_ViewAnimation(pl, DEAGLE_SHOOT1); break; default: - Weapons_ViewAnimation(DEAGLE_SHOOT2); + Weapons_ViewAnimation(pl, DEAGLE_SHOOT2); break; } } @@ -190,9 +187,8 @@ w_deagle_primary(void) } void -w_deagle_reload(void) +w_deagle_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { return; @@ -203,7 +199,7 @@ w_deagle_reload(void) if (!pl.ammo_50ae) { return; } - Weapons_ViewAnimation(DEAGLE_RELOAD); + Weapons_ViewAnimation(pl, DEAGLE_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::deagle_mag, player::ammo_50ae, 7); @@ -214,28 +210,27 @@ w_deagle_reload(void) } void -w_deagle_release(void) +w_deagle_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.deagle_mag == 0 && pl.ammo_50ae > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_deagle_aimanim(void) +w_deagle_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_ONEHAND : ANIM_AIM_ONEHAND; } void -w_deagle_hud(void) +w_deagle_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -247,9 +242,8 @@ w_deagle_hud(void) } int -w_deagle_isempty(void) +w_deagle_isempty(player pl) { - player pl = (player)self; if (pl.deagle_mag <= 0 && pl.ammo_50ae <= 0) return 1; @@ -258,13 +252,12 @@ w_deagle_isempty(void) } void -w_deagle_hudpic(int selected, vector pos, float a) +w_deagle_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_deagle_isempty()) + if (w_deagle_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -311,7 +304,7 @@ weapon_t w_deagle = .secondary = __NULL__, .reload = w_deagle_reload, .release = w_deagle_release, - .crosshair = w_deagle_hud, + .postdraw = w_deagle_hud, .precache = w_deagle_precache, .pickup = w_deagle_pickup, .updateammo = w_deagle_updateammo, diff --git a/src/shared/w_elites.qc b/src/shared/w_elites.qc index 778a1e7..3bbb12b 100644 --- a/src/shared/w_elites.qc +++ b/src/shared/w_elites.qc @@ -128,10 +128,9 @@ w_elites_deathmsg(void) } int -w_elites_pickup(int new, int startammo) +w_elites_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -150,11 +149,10 @@ w_elites_pickup(int new, int startammo) } void -w_elites_draw(void) +w_elites_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_elite.mdl"); - Weapons_ViewAnimation(ELITES_DRAW); + Weapons_ViewAnimation(pl, ELITES_DRAW); pl.mode_temp = 0; #ifdef CLIENT @@ -164,9 +162,8 @@ w_elites_draw(void) } void -w_elites_primary(void) +w_elites_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { return; @@ -187,45 +184,45 @@ w_elites_primary(void) int r = (float)input_sequence % 5; if (pl.mode_temp) { if (pl.elites_mag <= 0) { - Weapons_ViewAnimation(ELITES_SHOOT_LEFTLAST); + Weapons_ViewAnimation(pl, ELITES_SHOOT_LEFTLAST); } else { switch (r) { case 0: - Weapons_ViewAnimation(ELITES_SHOOT_LEFT1); + Weapons_ViewAnimation(pl, ELITES_SHOOT_LEFT1); break; case 1: - Weapons_ViewAnimation(ELITES_SHOOT_LEFT2); + Weapons_ViewAnimation(pl, ELITES_SHOOT_LEFT2); break; case 2: - Weapons_ViewAnimation(ELITES_SHOOT_LEFT3); + Weapons_ViewAnimation(pl, ELITES_SHOOT_LEFT3); break; case 3: - Weapons_ViewAnimation(ELITES_SHOOT_LEFT4); + Weapons_ViewAnimation(pl, ELITES_SHOOT_LEFT4); break; default: - Weapons_ViewAnimation(ELITES_SHOOT_LEFT1); + Weapons_ViewAnimation(pl, ELITES_SHOOT_LEFT1); break; } } } else { if (pl.elites_mag <= 0) { - Weapons_ViewAnimation(ELITES_SHOOT_RIGHTLAST); + Weapons_ViewAnimation(pl, ELITES_SHOOT_RIGHTLAST); } else { switch (r) { case 0: - Weapons_ViewAnimation(ELITES_SHOOT_RIGHT1); + Weapons_ViewAnimation(pl, ELITES_SHOOT_RIGHT1); break; case 1: - Weapons_ViewAnimation(ELITES_SHOOT_RIGHT2); + Weapons_ViewAnimation(pl, ELITES_SHOOT_RIGHT2); break; case 2: - Weapons_ViewAnimation(ELITES_SHOOT_RIGHT3); + Weapons_ViewAnimation(pl, ELITES_SHOOT_RIGHT3); break; case 3: - Weapons_ViewAnimation(ELITES_SHOOT_RIGHT4); + Weapons_ViewAnimation(pl, ELITES_SHOOT_RIGHT4); break; default: - Weapons_ViewAnimation(ELITES_SHOOT_RIGHT1); + Weapons_ViewAnimation(pl, ELITES_SHOOT_RIGHT1); break; } } @@ -262,9 +259,8 @@ w_elites_primary(void) } void -w_elites_reload(void) +w_elites_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -273,7 +269,7 @@ w_elites_reload(void) if (!pl.ammo_9mm) return; - Weapons_ViewAnimation(ELITES_RELOAD); + Weapons_ViewAnimation(pl, ELITES_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::elites_mag, player::ammo_9mm, 30); @@ -284,28 +280,27 @@ w_elites_reload(void) } void -w_elites_release(void) +w_elites_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.elites_mag == 0 && pl.ammo_9mm > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_elites_aimanim(void) +w_elites_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_DUALPISTOLS : ANIM_AIM_DUALPISTOLS; } void -w_elites_hud(void) +w_elites_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -317,9 +312,8 @@ w_elites_hud(void) } int -w_elites_isempty(void) +w_elites_isempty(player pl) { - player pl = (player)self; if (pl.elites_mag <= 0 && pl.ammo_9mm <= 0) return 1; @@ -328,13 +322,12 @@ w_elites_isempty(void) } void -w_elites_hudpic(int selected, vector pos, float a) +w_elites_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_elites_isempty()) + if (w_elites_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -381,7 +374,7 @@ weapon_t w_elites = .secondary = __NULL__, .reload = w_elites_reload, .release = w_elites_release, - .crosshair = w_elites_hud, + .postdraw = w_elites_hud, .precache = w_elites_precache, .pickup = w_elites_pickup, .updateammo = w_elites_updateammo, diff --git a/src/shared/w_fiveseven.qc b/src/shared/w_fiveseven.qc index b56b6c6..a76123e 100644 --- a/src/shared/w_fiveseven.qc +++ b/src/shared/w_fiveseven.qc @@ -73,10 +73,9 @@ w_fiveseven_deathmsg(void) } int -w_fiveseven_pickup(int new, int startammo) +w_fiveseven_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -95,11 +94,10 @@ w_fiveseven_pickup(int new, int startammo) } void -w_fiveseven_draw(void) +w_fiveseven_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_fiveseven.mdl"); - Weapons_ViewAnimation(FIVESEVEN_DRAW); + Weapons_ViewAnimation(pl, FIVESEVEN_DRAW); #ifdef CLIENT pl.cs_cross_mindist = 8; @@ -108,9 +106,8 @@ w_fiveseven_draw(void) } void -w_fiveseven_primary(void) +w_fiveseven_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { return; @@ -128,15 +125,15 @@ w_fiveseven_primary(void) pl.fiveseven_mag--; if (pl.fiveseven_mag <= 0) { - Weapons_ViewAnimation(FIVESEVEN_SHOOT_EMPTY); + Weapons_ViewAnimation(pl, FIVESEVEN_SHOOT_EMPTY); } else { int r = (float)input_sequence % 2; switch (r) { case 0: - Weapons_ViewAnimation(FIVESEVEN_SHOOT1); + Weapons_ViewAnimation(pl, FIVESEVEN_SHOOT1); break; default: - Weapons_ViewAnimation(FIVESEVEN_SHOOT2); + Weapons_ViewAnimation(pl, FIVESEVEN_SHOOT2); break; } } @@ -161,9 +158,8 @@ w_fiveseven_primary(void) } void -w_fiveseven_reload(void) +w_fiveseven_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -172,7 +168,7 @@ w_fiveseven_reload(void) if (!pl.ammo_57mm) return; - Weapons_ViewAnimation(FIVESEVEN_RELOAD); + Weapons_ViewAnimation(pl, FIVESEVEN_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::fiveseven_mag, player::ammo_57mm, 20); @@ -183,28 +179,27 @@ w_fiveseven_reload(void) } void -w_fiveseven_release(void) +w_fiveseven_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.fiveseven_mag == 0 && pl.ammo_57mm > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_fiveseven_aimanim(void) +w_fiveseven_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_ONEHAND : ANIM_AIM_ONEHAND; } void -w_fiveseven_hud(void) +w_fiveseven_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -216,9 +211,8 @@ w_fiveseven_hud(void) } int -w_fiveseven_isempty(void) +w_fiveseven_isempty(player pl) { - player pl = (player)self; if (pl.fiveseven_mag <= 0 && pl.ammo_57mm <= 0) return 1; @@ -227,13 +221,12 @@ w_fiveseven_isempty(void) } void -w_fiveseven_hudpic(int selected, vector pos, float a) +w_fiveseven_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_fiveseven_isempty()) + if (w_fiveseven_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -280,7 +273,7 @@ weapon_t w_fiveseven = .secondary = __NULL__, .reload = w_fiveseven_reload, .release = w_fiveseven_release, - .crosshair = w_fiveseven_hud, + .postdraw = w_fiveseven_hud, .precache = w_fiveseven_precache, .pickup = w_fiveseven_pickup, .updateammo = w_fiveseven_updateammo, diff --git a/src/shared/w_flashbang.qc b/src/shared/w_flashbang.qc index 84a6062..f0f1a2a 100644 --- a/src/shared/w_flashbang.qc +++ b/src/shared/w_flashbang.qc @@ -56,10 +56,9 @@ w_flashbang_updateammo(player pl) } int -w_flashbang_pickup(int new, int startammo) +w_flashbang_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (pl.ammo_fbgrenade < AMMO_MAX_FLASHBANG) { pl.ammo_fbgrenade = bound(0, pl.ammo_fbgrenade + 1, AMMO_MAX_FLASHBANG); @@ -89,17 +88,16 @@ w_flashbang_deathmsg(void) } void -w_flashbang_draw(void) +w_flashbang_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_flashbang.mdl"); - Weapons_ViewAnimation(FLASHBANG_DRAW); + Weapons_ViewAnimation(pl, FLASHBANG_DRAW); pl.mode_temp = 0; } #ifdef SERVER void -w_flashbang_throw(void) +w_flashbang_throw(player pl) { static void flashbang_explode(void) { @@ -118,7 +116,6 @@ w_flashbang_throw(void) self.frame = 0; } - player pl = (player)self; vector vPLAngle = pl.v_angle; if (vPLAngle[0] < 0) { vPLAngle[0] = -10 + vPLAngle[0] * ((90 - 10) / 90.0); @@ -152,9 +149,8 @@ w_flashbang_throw(void) #endif void -w_flashbang_primary(void) +w_flashbang_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { return; } @@ -169,7 +165,7 @@ w_flashbang_primary(void) return; } - Weapons_ViewAnimation(FLASHBANG_PULLPIN); + Weapons_ViewAnimation(pl, FLASHBANG_PULLPIN); pl.mode_temp = 1; pl.w_attack_next = 0.975f; @@ -177,10 +173,8 @@ w_flashbang_primary(void) } void -w_flashbang_release(void) +w_flashbang_release(player pl) { - player pl = (player)self; - w_cstrike_weaponrelease(); if (pl.w_idle_next > 0.0) { @@ -190,16 +184,16 @@ w_flashbang_release(void) if (pl.mode_temp == 1) { pl.ammo_fbgrenade--; #ifdef CLIENT - Weapons_ViewAnimation(FLASHBANG_THROW); + Weapons_ViewAnimation(pl, FLASHBANG_THROW); #else - w_flashbang_throw(); + w_flashbang_throw(pl); #endif pl.mode_temp = 2; pl.w_attack_next = 1.0f; pl.w_idle_next = 0.5f; } else if (pl.mode_temp == 2) { #ifdef CLIENT - Weapons_ViewAnimation(FLASHBANG_DRAW); + Weapons_ViewAnimation(pl, FLASHBANG_DRAW); #else if (!pl.ammo_fbgrenade) { Weapons_RemoveItem(pl, WEAPON_FLASHBANG); @@ -212,13 +206,13 @@ w_flashbang_release(void) } float -w_flashbang_aimanim(void) +w_flashbang_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_GRENADE : ANIM_AIM_GRENADE; } void -w_flashbang_hud(void) +w_flashbang_hud(player pl) { #ifdef CLIENT @@ -229,9 +223,8 @@ w_flashbang_hud(void) } int -w_flashbang_isempty(void) +w_flashbang_isempty(player pl) { - player pl = (player)self; if (pl.ammo_fbgrenade <= 0) return 1; @@ -240,10 +233,9 @@ w_flashbang_isempty(void) } void -w_flashbang_hudpic(int selected, vector pos, float a) +w_flashbang_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; HUD_DrawAmmoBar(pos, pl.ammo_fbgrenade, AMMO_MAX_FLASHBANG, a); @@ -286,7 +278,7 @@ weapon_t w_flashbang = .secondary = __NULL__, .reload = __NULL__, .release = w_flashbang_release, - .crosshair = w_flashbang_hud, + .postdraw = w_flashbang_hud, .precache = w_flashbang_precache, .pickup = w_flashbang_pickup, .updateammo = w_flashbang_updateammo, diff --git a/src/shared/w_g3sg1.qc b/src/shared/w_g3sg1.qc index 6431f47..92775ac 100644 --- a/src/shared/w_g3sg1.qc +++ b/src/shared/w_g3sg1.qc @@ -72,10 +72,9 @@ w_g3sg1_deathmsg(void) } int -w_g3sg1_pickup(int new, int startammo) +w_g3sg1_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -94,11 +93,10 @@ w_g3sg1_pickup(int new, int startammo) } void -w_g3sg1_draw(void) +w_g3sg1_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_g3sg1.mdl"); - Weapons_ViewAnimation(G3SG1_DRAW); + Weapons_ViewAnimation(pl, G3SG1_DRAW); #ifdef CLIENT pl.cs_cross_mindist = 6; @@ -107,9 +105,8 @@ w_g3sg1_draw(void) } void -w_g3sg1_primary(void) +w_g3sg1_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { return; @@ -125,10 +122,10 @@ w_g3sg1_primary(void) int r = (float)input_sequence % 2; switch (r) { case 0: - Weapons_ViewAnimation(SCOUT_SHOOT1); + Weapons_ViewAnimation(pl, SCOUT_SHOOT1); break; default: - Weapons_ViewAnimation(SCOUT_SHOOT2); + Weapons_ViewAnimation(pl, SCOUT_SHOOT2); break; } @@ -151,9 +148,8 @@ w_g3sg1_primary(void) } void -w_g3sg1_secondary(void) +w_g3sg1_secondary(player pl) { - player pl = (player)self; if (pl.w_attack_next) { return; } @@ -172,9 +168,8 @@ w_g3sg1_secondary(void) } void -w_g3sg1_reload(void) +w_g3sg1_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -183,7 +178,7 @@ w_g3sg1_reload(void) if (!pl.ammo_762mm) return; - Weapons_ViewAnimation(G3SG1_RELOAD); + Weapons_ViewAnimation(pl, G3SG1_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::g3sg1_mag, player::ammo_762mm, 20); @@ -195,31 +190,29 @@ w_g3sg1_reload(void) } void -w_g3sg1_release(void) +w_g3sg1_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.g3sg1_mag == 0 && pl.ammo_762mm > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_g3sg1_aimanim(void) +w_g3sg1_aimanim(player pl) { - return w_ak47_aimanim(); + return w_ak47_aimanim(pl); } void -w_g3sg1_hud(void) +w_g3sg1_hud(player pl) { #ifdef CLIENT - player pl = (player)self; if (pl.viewzoom < 1.0f) { Cstrike_DrawScope(); } @@ -231,9 +224,8 @@ w_g3sg1_hud(void) } int -w_g3sg1_isempty(void) +w_g3sg1_isempty(player pl) { - player pl = (player)self; if (pl.g3sg1_mag <= 0 && pl.ammo_762mm <= 0) return 1; @@ -242,13 +234,12 @@ w_g3sg1_isempty(void) } void -w_g3sg1_hudpic(int selected, vector pos, float a) +w_g3sg1_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_g3sg1_isempty()) + if (w_g3sg1_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -295,7 +286,7 @@ weapon_t w_g3sg1 = .secondary = w_g3sg1_secondary, .reload = w_g3sg1_reload, .release = w_g3sg1_release, - .crosshair = w_g3sg1_hud, + .postdraw = w_g3sg1_hud, .precache = w_g3sg1_precache, .pickup = w_g3sg1_pickup, .updateammo = w_g3sg1_updateammo, diff --git a/src/shared/w_glock18.qc b/src/shared/w_glock18.qc index 9eb73cb..74d8bb1 100644 --- a/src/shared/w_glock18.qc +++ b/src/shared/w_glock18.qc @@ -83,10 +83,9 @@ w_glock18_deathmsg(void) } int -w_glock18_pickup(int new, int startammo) +w_glock18_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -105,18 +104,17 @@ w_glock18_pickup(int new, int startammo) } void -w_glock18_draw(void) +w_glock18_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_glock18.mdl"); int r = (float)input_sequence % 2; switch (r) { case 0: - Weapons_ViewAnimation(GLOCK_DRAW1); + Weapons_ViewAnimation(pl, GLOCK_DRAW1); break; default: - Weapons_ViewAnimation(GLOCK_DRAW2); + Weapons_ViewAnimation(pl, GLOCK_DRAW2); break; } @@ -127,9 +125,8 @@ w_glock18_draw(void) } void -w_glock18_primary(void) +w_glock18_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -158,18 +155,18 @@ w_glock18_primary(void) int r = (float)input_sequence % 2; switch (r) { case 0: - Weapons_ViewAnimation(GLOCK_SHOOT_BURST1); + Weapons_ViewAnimation(pl, GLOCK_SHOOT_BURST1); break; default: - Weapons_ViewAnimation(GLOCK_SHOOT_BURST2); + Weapons_ViewAnimation(pl, GLOCK_SHOOT_BURST2); break; } pl.w_attack_next = 0.5f; } else { if (pl.glock18_mag <= 0) { - Weapons_ViewAnimation(GLOCK_SHOOT_EMPTY); + Weapons_ViewAnimation(pl, GLOCK_SHOOT_EMPTY); } else { - Weapons_ViewAnimation(GLOCK_SHOOT); + Weapons_ViewAnimation(pl, GLOCK_SHOOT); } pl.w_attack_next = 0.15f; } @@ -195,9 +192,8 @@ w_glock18_primary(void) } void -w_glock18_secondary(void) +w_glock18_secondary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0) { return; @@ -219,9 +215,8 @@ w_glock18_secondary(void) } void -w_glock18_reload(void) +w_glock18_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -233,10 +228,10 @@ w_glock18_reload(void) int r = (float)input_sequence % 2; switch (r) { case 0: - Weapons_ViewAnimation(GLOCK_RELOAD1); + Weapons_ViewAnimation(pl, GLOCK_RELOAD1); break; default: - Weapons_ViewAnimation(GLOCK_RELOAD2); + Weapons_ViewAnimation(pl, GLOCK_RELOAD2); break; } @@ -250,28 +245,27 @@ w_glock18_reload(void) } void -w_glock18_release(void) +w_glock18_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.glock18_mag == 0 && pl.ammo_9mm > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_glock18_aimanim(void) +w_glock18_aimanim(player pl) { - return w_deagle_aimanim(); + return w_deagle_aimanim(pl); } void -w_glock18_hud(void) +w_glock18_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -283,9 +277,8 @@ w_glock18_hud(void) } int -w_glock18_isempty(void) +w_glock18_isempty(player pl) { - player pl = (player)self; if (pl.glock18_mag <= 0 && pl.ammo_9mm <= 0) return 1; @@ -294,13 +287,12 @@ w_glock18_isempty(void) } void -w_glock18_hudpic(int selected, vector pos, float a) +w_glock18_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_glock18_isempty()) + if (w_glock18_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -347,7 +339,7 @@ weapon_t w_glock18 = .secondary = w_glock18_secondary, .reload = w_glock18_reload, .release = w_glock18_release, - .crosshair = w_glock18_hud, + .postdraw = w_glock18_hud, .precache = w_glock18_precache, .pickup = w_glock18_pickup, .updateammo = w_glock18_updateammo, diff --git a/src/shared/w_hegrenade.qc b/src/shared/w_hegrenade.qc index 6450e50..e0a1b61 100644 --- a/src/shared/w_hegrenade.qc +++ b/src/shared/w_hegrenade.qc @@ -56,10 +56,9 @@ w_hegrenade_updateammo(player pl) } int -w_hegrenade_pickup(int new, int startammo) +w_hegrenade_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (pl.ammo_hegrenade < AMMO_MAX_HENADE) { pl.ammo_hegrenade = bound(0, pl.ammo_hegrenade + 1, AMMO_MAX_HENADE); @@ -89,17 +88,16 @@ w_hegrenade_deathmsg(void) } void -w_hegrenade_draw(void) +w_hegrenade_draw(player pl) { Weapons_SetModel("models/v_hegrenade.mdl"); - Weapons_ViewAnimation(HEGRENADE_DRAW); - player pl = (player)self; + Weapons_ViewAnimation(pl, HEGRENADE_DRAW); pl.mode_temp = 0; } #ifdef SERVER void -w_hegrenade_throw(void) +w_hegrenade_throw(player pl) { static void hegrenade_explode(void) { @@ -120,7 +118,6 @@ w_hegrenade_throw(void) self.frame = 0; } - player pl = (player)self; vector vPLAngle = pl.v_angle; if (vPLAngle[0] < 0) { vPLAngle[0] = -10 + vPLAngle[0] * ((90 - 10) / 90.0); @@ -154,9 +151,8 @@ w_hegrenade_throw(void) #endif void -w_hegrenade_primary(void) +w_hegrenade_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { return; } @@ -171,7 +167,7 @@ w_hegrenade_primary(void) return; } - Weapons_ViewAnimation(HEGRENADE_PULLPIN); + Weapons_ViewAnimation(pl, HEGRENADE_PULLPIN); pl.mode_temp = 1; pl.w_attack_next = 0.975f; @@ -179,9 +175,8 @@ w_hegrenade_primary(void) } void -w_hegrenade_release(void) +w_hegrenade_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); @@ -192,16 +187,16 @@ w_hegrenade_release(void) if (pl.mode_temp == 1) { pl.ammo_hegrenade--; #ifdef CLIENT - Weapons_ViewAnimation(HEGRENADE_THROW); + Weapons_ViewAnimation(pl, HEGRENADE_THROW); #else - w_hegrenade_throw(); + w_hegrenade_throw(pl); #endif pl.mode_temp = 2; pl.w_attack_next = 1.0f; pl.w_idle_next = 0.5f; } else if (pl.mode_temp == 2) { #ifdef CLIENT - Weapons_ViewAnimation(HEGRENADE_DRAW); + Weapons_ViewAnimation(pl, HEGRENADE_DRAW); #else if (!pl.ammo_hegrenade) { Weapons_RemoveItem(pl, WEAPON_HEGRENADE); @@ -214,13 +209,13 @@ w_hegrenade_release(void) } float -w_hegrenade_aimanim(void) +w_hegrenade_aimanim(player pl) { - return w_flashbang_aimanim(); + return w_flashbang_aimanim(pl); } void -w_hegrenade_hud(void) +w_hegrenade_hud(player pl) { #ifdef CLIENT @@ -231,9 +226,8 @@ w_hegrenade_hud(void) } int -w_hegrenade_isempty(void) +w_hegrenade_isempty(player pl) { - player pl = (player)self; if (pl.ammo_hegrenade <= 0) return 1; @@ -242,10 +236,9 @@ w_hegrenade_isempty(void) } void -w_hegrenade_hudpic(int selected, vector pos, float a) +w_hegrenade_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; HUD_DrawAmmoBar(pos, pl.ammo_hegrenade, AMMO_MAX_HENADE, a); @@ -288,7 +281,7 @@ weapon_t w_hegrenade = .secondary = __NULL__, .reload = __NULL__, .release = w_hegrenade_release, - .crosshair = w_hegrenade_hud, + .postdraw = w_hegrenade_hud, .precache = w_hegrenade_precache, .pickup = w_hegrenade_pickup, .updateammo = w_hegrenade_updateammo, diff --git a/src/shared/w_knife.qc b/src/shared/w_knife.qc index 69bee08..a7306a6 100644 --- a/src/shared/w_knife.qc +++ b/src/shared/w_knife.qc @@ -77,16 +77,15 @@ w_knife_deathmsg(void) } void -w_knife_draw(void) +w_knife_draw(player pl) { Weapons_SetModel("models/v_knife.mdl"); - Weapons_ViewAnimation(KNIFE_DRAW); + Weapons_ViewAnimation(pl, KNIFE_DRAW); } void -w_knife_primary(void) +w_knife_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { return; @@ -96,10 +95,10 @@ w_knife_primary(void) int r = (float)input_sequence % 2; switch (r) { case 0: - Weapons_ViewAnimation(KNIFE_SLASH1); + Weapons_ViewAnimation(pl, KNIFE_SLASH1); break; default: - Weapons_ViewAnimation(KNIFE_SLASH2); + Weapons_ViewAnimation(pl, KNIFE_SLASH2); break; } @@ -110,7 +109,7 @@ w_knife_primary(void) #ifdef SERVER vector src; - Weapons_MakeVectors(); + Weapons_MakeVectors(pl); src = pl.origin + pl.view_ofs; traceline(src, src + (v_forward * 32), FALSE, pl); @@ -134,9 +133,8 @@ w_knife_primary(void) } void -w_knife_secondary(void) +w_knife_secondary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { return; @@ -144,7 +142,7 @@ w_knife_secondary(void) pl.w_attack_next = 1.2f; - Weapons_ViewAnimation(KNIFE_STAB); + Weapons_ViewAnimation(pl, KNIFE_STAB); if (self.flags & FL_CROUCHING) Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_KNIFE, 1.33f); @@ -153,7 +151,7 @@ w_knife_secondary(void) #ifdef SERVER vector src; - Weapons_MakeVectors(); + Weapons_MakeVectors(pl); src = pl.origin + pl.view_ofs; traceline(src, src + (v_forward * 32), FALSE, pl); @@ -178,19 +176,19 @@ w_knife_secondary(void) } float -w_knife_aimanim(void) +w_knife_aimanim(player pl) { return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_KNIFE : ANIM_AIM_KNIFE; } int -w_knife_isempty(void) +w_knife_isempty(player pl) { return 0; } 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) { @@ -232,7 +230,7 @@ weapon_t w_knife = .secondary = w_knife_secondary, .reload = __NULL__, .release = __NULL__, - .crosshair = __NULL__, + .postdraw = __NULL__, .precache = w_knife_precache, .pickup = __NULL__, .updateammo = w_knife_updateammo, diff --git a/src/shared/w_m3.qc b/src/shared/w_m3.qc index 942d106..beb3c28 100644 --- a/src/shared/w_m3.qc +++ b/src/shared/w_m3.qc @@ -117,10 +117,9 @@ w_m3_deathmsg(void) } int -w_m3_pickup(int new, int startammo) +w_m3_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -139,11 +138,10 @@ w_m3_pickup(int new, int startammo) } void -w_m3_draw(void) +w_m3_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_m3.mdl"); - Weapons_ViewAnimation(M3_DRAW); + Weapons_ViewAnimation(pl, M3_DRAW); pl.mode_temp = 0; #ifdef CLIENT @@ -152,31 +150,30 @@ w_m3_draw(void) #endif } -void w_m3_release(void); +void w_m3_release(player pl); void -w_m3_primary(void) +w_m3_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { - w_m3_release(); + w_m3_release(pl); return; } /* interrupt reloading if no longer empty */ if (pl.mode_temp == M3S_RELOAD && pl.m3_mag >= 1) { pl.mode_temp = M3S_RELOAD_END; - w_m3_release(); + w_m3_release(pl); return; } else if (pl.mode_temp > M3S_IDLE) { - w_m3_release(); + w_m3_release(pl); return; } /* Ammo check */ if (pl.m3_mag <= 0) { - w_m3_release(); + w_m3_release(pl); return; } @@ -185,10 +182,10 @@ w_m3_primary(void) int r = (float)input_sequence % 2; switch (r) { case 0: - Weapons_ViewAnimation(M3_SHOOT1); + Weapons_ViewAnimation(pl, M3_SHOOT1); break; default: - Weapons_ViewAnimation(M3_SHOOT2); + Weapons_ViewAnimation(pl, M3_SHOOT2); break; } @@ -219,9 +216,8 @@ w_m3_primary(void) } void -w_m3_reload(void) +w_m3_reload(player pl) { - player pl = (player)self; if (pl.m3_mag >= 8) { return; @@ -238,16 +234,15 @@ w_m3_reload(void) } void -w_m3_release(void) +w_m3_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.mode_temp == M3S_IDLE && pl.m3_mag == 0 && pl.ammo_buckshot > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } @@ -256,11 +251,11 @@ w_m3_release(void) } if (pl.mode_temp == M3S_RELOAD_START) { - Weapons_ViewAnimation(M3_RELOAD_START); + Weapons_ViewAnimation(pl, M3_RELOAD_START); pl.mode_temp = M3S_RELOAD; pl.w_idle_next = 0.65f; } else if (pl.mode_temp == M3S_RELOAD) { - Weapons_ViewAnimation(M3_INSERT); + Weapons_ViewAnimation(pl, M3_INSERT); pl.m3_mag++; pl.ammo_buckshot--; w_m3_updateammo(pl); @@ -269,7 +264,7 @@ w_m3_release(void) } pl.w_idle_next = 0.5f; } else if (pl.mode_temp == M3S_RELOAD_END) { - Weapons_ViewAnimation(M3_RELOAD_END); + Weapons_ViewAnimation(pl, M3_RELOAD_END); pl.mode_temp = M3S_IDLE; pl.w_idle_next = 10.0f; pl.w_attack_next = 0.5f; @@ -277,13 +272,13 @@ w_m3_release(void) } float -w_m3_aimanim(void) +w_m3_aimanim(player pl) { - return w_ak47_aimanim(); + return w_ak47_aimanim(pl); } void -w_m3_hud(void) +w_m3_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -295,9 +290,8 @@ w_m3_hud(void) } int -w_m3_isempty(void) +w_m3_isempty(player pl) { - player pl = (player)self; if (pl.m3_mag <= 0 && pl.ammo_buckshot <= 0) return 1; @@ -306,13 +300,12 @@ w_m3_isempty(void) } void -w_m3_hudpic(int selected, vector pos, float a) +w_m3_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_m3_isempty()) + if (w_m3_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -359,7 +352,7 @@ weapon_t w_m3 = .secondary = __NULL__, .reload = w_m3_reload, .release = w_m3_release, - .crosshair = w_m3_hud, + .postdraw = w_m3_hud, .precache = w_m3_precache, .pickup = w_m3_pickup, .updateammo = w_m3_updateammo, diff --git a/src/shared/w_m4a1.qc b/src/shared/w_m4a1.qc index 1325f2c..74a1a12 100644 --- a/src/shared/w_m4a1.qc +++ b/src/shared/w_m4a1.qc @@ -83,10 +83,9 @@ w_m4a1_deathmsg(void) } int -w_m4a1_pickup(int new, int startammo) +w_m4a1_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -105,16 +104,15 @@ w_m4a1_pickup(int new, int startammo) } void -w_m4a1_draw(void) +w_m4a1_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_m4a1.mdl"); if (pl.mode_m4a1 == 1) { - Weapons_ViewAnimation(M4A1_DRAW); + Weapons_ViewAnimation(pl, M4A1_DRAW); } else { - Weapons_ViewAnimation(M4A1_DRAWUNSIL); + Weapons_ViewAnimation(pl, M4A1_DRAWUNSIL); } #ifdef CLIENT @@ -124,9 +122,8 @@ w_m4a1_draw(void) } void -w_m4a1_primary(void) +w_m4a1_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { return; @@ -143,25 +140,25 @@ w_m4a1_primary(void) if (pl.mode_m4a1 == 1) { switch (r) { case 0: - Weapons_ViewAnimation(M4A1_SHOOT1); + Weapons_ViewAnimation(pl, M4A1_SHOOT1); break; case 1: - Weapons_ViewAnimation(M4A1_SHOOT2); + Weapons_ViewAnimation(pl, M4A1_SHOOT2); break; default: - Weapons_ViewAnimation(M4A1_SHOOT3); + Weapons_ViewAnimation(pl, M4A1_SHOOT3); break; } } else { switch (r) { case 0: - Weapons_ViewAnimation(M4A1_SHOOT1UNSIL); + Weapons_ViewAnimation(pl, M4A1_SHOOT1UNSIL); break; case 1: - Weapons_ViewAnimation(M4A1_SHOOT2UNSIL); + Weapons_ViewAnimation(pl, M4A1_SHOOT2UNSIL); break; default: - Weapons_ViewAnimation(M4A1_SHOOT3UNSIL); + Weapons_ViewAnimation(pl, M4A1_SHOOT3UNSIL); break; } } @@ -196,9 +193,8 @@ w_m4a1_primary(void) } void -w_m4a1_secondary(void) +w_m4a1_secondary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0) { return; @@ -209,9 +205,9 @@ w_m4a1_secondary(void) /* play the animation */ if (pl.mode_m4a1) { - Weapons_ViewAnimation(M4A1_ADDSIL); + Weapons_ViewAnimation(pl, M4A1_ADDSIL); } else { - Weapons_ViewAnimation(M4A1_DETACHSIL); + Weapons_ViewAnimation(pl, M4A1_DETACHSIL); } pl.w_attack_next = 2.0f; @@ -219,9 +215,8 @@ w_m4a1_secondary(void) } void -w_m4a1_reload(void) +w_m4a1_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -231,9 +226,9 @@ w_m4a1_reload(void) return; if (pl.mode_m4a1 == 1) - Weapons_ViewAnimation(M4A1_RELOAD); + Weapons_ViewAnimation(pl, M4A1_RELOAD); else - Weapons_ViewAnimation(M4A1_RELOADUNSIL); + Weapons_ViewAnimation(pl, M4A1_RELOADUNSIL); #ifdef SERVER Weapons_ReloadWeapon(pl, player::m4a1_mag, player::ammo_556mm, 30); @@ -244,13 +239,13 @@ w_m4a1_reload(void) } float -w_m4a1_aimanim(void) +w_m4a1_aimanim(player pl) { - return w_ak47_aimanim(); + return w_ak47_aimanim(pl); } void -w_m4a1_hud(void) +w_m4a1_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -262,16 +257,15 @@ w_m4a1_hud(void) } void -w_m4a1_release(void) +w_m4a1_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.m4a1_mag == 0 && pl.ammo_556mm > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } @@ -280,17 +274,16 @@ w_m4a1_release(void) } if (pl.mode_m4a1) { - Weapons_ViewAnimation(M4A1_IDLE); + Weapons_ViewAnimation(pl, M4A1_IDLE); } else { - Weapons_ViewAnimation(M4A1_IDLEUNSIL); + Weapons_ViewAnimation(pl, M4A1_IDLEUNSIL); } pl.w_idle_next = 5.0f; } int -w_m4a1_isempty(void) +w_m4a1_isempty(player pl) { - player pl = (player)self; if (pl.m4a1_mag <= 0 && pl.ammo_556mm <= 0) return 1; @@ -299,13 +292,12 @@ w_m4a1_isempty(void) } void -w_m4a1_hudpic(int selected, vector pos, float a) +w_m4a1_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_m4a1_isempty()) + if (w_m4a1_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -352,7 +344,7 @@ weapon_t w_m4a1 = .secondary = w_m4a1_secondary, .reload = w_m4a1_reload, .release = w_m4a1_release, - .crosshair = w_m4a1_hud, + .postdraw = w_m4a1_hud, .precache = w_m4a1_precache, .pickup = w_m4a1_pickup, .updateammo = w_m4a1_updateammo, diff --git a/src/shared/w_mac10.qc b/src/shared/w_mac10.qc index 0761fc2..aa47d66 100644 --- a/src/shared/w_mac10.qc +++ b/src/shared/w_mac10.qc @@ -73,10 +73,9 @@ w_mac10_deathmsg(void) } int -w_mac10_pickup(int new, int startammo) +w_mac10_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -95,11 +94,10 @@ w_mac10_pickup(int new, int startammo) } void -w_mac10_draw(void) +w_mac10_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_mac10.mdl"); - Weapons_ViewAnimation(MAC10_DRAW); + Weapons_ViewAnimation(pl, MAC10_DRAW); #ifdef CLIENT pl.cs_cross_mindist = 9; @@ -108,9 +106,8 @@ w_mac10_draw(void) } void -w_mac10_primary(void) +w_mac10_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { return; @@ -126,13 +123,13 @@ w_mac10_primary(void) int r = (float)input_sequence % 3; switch (r) { case 0: - Weapons_ViewAnimation(MAC10_SHOOT1); + Weapons_ViewAnimation(pl, MAC10_SHOOT1); break; case 1: - Weapons_ViewAnimation(MAC10_SHOOT2); + Weapons_ViewAnimation(pl, MAC10_SHOOT2); break; default: - Weapons_ViewAnimation(MAC10_SHOOT3); + Weapons_ViewAnimation(pl, MAC10_SHOOT3); break; } @@ -155,9 +152,8 @@ w_mac10_primary(void) } void -w_mac10_reload(void) +w_mac10_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -166,7 +162,7 @@ w_mac10_reload(void) if (!pl.ammo_45acp) return; - Weapons_ViewAnimation(MAC10_RELOAD); + Weapons_ViewAnimation(pl, MAC10_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::mac10_mag, player::ammo_45acp, 30); @@ -178,28 +174,27 @@ w_mac10_reload(void) } void -w_mac10_release(void) +w_mac10_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.mac10_mag == 0 && pl.ammo_45acp > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_mac10_aimanim(void) +w_mac10_aimanim(player pl) { - return w_deagle_aimanim(); + return w_deagle_aimanim(pl); } void -w_mac10_hud(void) +w_mac10_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -211,9 +206,8 @@ w_mac10_hud(void) } int -w_mac10_isempty(void) +w_mac10_isempty(player pl) { - player pl = (player)self; if (pl.mac10_mag <= 0 && pl.ammo_45acp <= 0) return 1; @@ -222,13 +216,12 @@ w_mac10_isempty(void) } void -w_mac10_hudpic(int selected, vector pos, float a) +w_mac10_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_mac10_isempty()) + if (w_mac10_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -275,7 +268,7 @@ weapon_t w_mac10 = .secondary = __NULL__, .reload = w_mac10_reload, .release = w_mac10_release, - .crosshair = w_mac10_hud, + .postdraw = w_mac10_hud, .precache = w_mac10_precache, .pickup = w_mac10_pickup, .updateammo = w_mac10_updateammo, diff --git a/src/shared/w_mp5.qc b/src/shared/w_mp5.qc index 3b1d9d2..16897c3 100644 --- a/src/shared/w_mp5.qc +++ b/src/shared/w_mp5.qc @@ -73,10 +73,9 @@ w_mp5_deathmsg(void) } int -w_mp5_pickup(int new, int startammo) +w_mp5_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -95,11 +94,10 @@ w_mp5_pickup(int new, int startammo) } void -w_mp5_draw(void) +w_mp5_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_mp5.mdl"); - Weapons_ViewAnimation(MP5_DRAW); + Weapons_ViewAnimation(pl, MP5_DRAW); #ifdef CLIENT pl.cs_cross_mindist = 5; @@ -108,9 +106,8 @@ w_mp5_draw(void) } void -w_mp5_primary(void) +w_mp5_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -124,13 +121,13 @@ w_mp5_primary(void) int r = (float)input_sequence % 3; switch (r) { case 0: - Weapons_ViewAnimation(MP5_SHOOT1); + Weapons_ViewAnimation(pl, MP5_SHOOT1); break; case 1: - Weapons_ViewAnimation(MP5_SHOOT2); + Weapons_ViewAnimation(pl, MP5_SHOOT2); break; default: - Weapons_ViewAnimation(MP5_SHOOT3); + Weapons_ViewAnimation(pl, MP5_SHOOT3); break; } @@ -153,9 +150,8 @@ w_mp5_primary(void) } void -w_mp5_reload(void) +w_mp5_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -164,7 +160,7 @@ w_mp5_reload(void) if (!pl.ammo_9mm) return; - Weapons_ViewAnimation(MP5_RELOAD); + Weapons_ViewAnimation(pl, MP5_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::mp5_mag, player::ammo_9mm, 30); @@ -176,28 +172,27 @@ w_mp5_reload(void) } void -w_mp5_release(void) +w_mp5_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.mp5_mag == 0 && pl.ammo_9mm > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_mp5_aimanim(void) +w_mp5_aimanim(player pl) { - return w_ak47_aimanim(); + return w_ak47_aimanim(pl); } void -w_mp5_hud(void) +w_mp5_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -209,9 +204,8 @@ w_mp5_hud(void) } int -w_mp5_isempty(void) +w_mp5_isempty(player pl) { - player pl = (player)self; if (pl.mp5_mag <= 0 && pl.ammo_9mm <= 0) return 1; @@ -220,13 +214,12 @@ w_mp5_isempty(void) } void -w_mp5_hudpic(int selected, vector pos, float a) +w_mp5_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_mp5_isempty()) + if (w_mp5_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -273,7 +266,7 @@ weapon_t w_mp5 = .secondary = __NULL__, .reload = w_mp5_reload, .release = w_mp5_release, - .crosshair = w_mp5_hud, + .postdraw = w_mp5_hud, .precache = w_mp5_precache, .pickup = w_mp5_pickup, .updateammo = w_mp5_updateammo, diff --git a/src/shared/w_p228.qc b/src/shared/w_p228.qc index a1f6465..70405c1 100644 --- a/src/shared/w_p228.qc +++ b/src/shared/w_p228.qc @@ -74,10 +74,9 @@ w_p228_deathmsg(void) } int -w_p228_pickup(int new, int startammo) +w_p228_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -96,11 +95,10 @@ w_p228_pickup(int new, int startammo) } void -w_p228_draw(void) +w_p228_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_p228.mdl"); - Weapons_ViewAnimation(P228_DRAW); + Weapons_ViewAnimation(pl, P228_DRAW); #ifdef CLIENT pl.cs_cross_mindist = 8; @@ -109,9 +107,8 @@ w_p228_draw(void) } void -w_p228_primary(void) +w_p228_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -125,18 +122,18 @@ w_p228_primary(void) pl.p228_mag--; if (pl.p228_mag <= 0) { - Weapons_ViewAnimation(P228_SHOOT_EMPTY); + Weapons_ViewAnimation(pl, P228_SHOOT_EMPTY); } else { int r = (float)input_sequence % 3; switch (r) { case 0: - Weapons_ViewAnimation(P228_SHOOT1); + Weapons_ViewAnimation(pl, P228_SHOOT1); break; case 1: - Weapons_ViewAnimation(P228_SHOOT2); + Weapons_ViewAnimation(pl, P228_SHOOT2); break; default: - Weapons_ViewAnimation(P228_SHOOT3); + Weapons_ViewAnimation(pl, P228_SHOOT3); break; } } @@ -161,9 +158,8 @@ w_p228_primary(void) } void -w_p228_reload(void) +w_p228_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -172,7 +168,7 @@ w_p228_reload(void) if (!pl.ammo_357sig) return; - Weapons_ViewAnimation(P228_RELOAD); + Weapons_ViewAnimation(pl, P228_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::p228_mag, player::ammo_357sig, 13); @@ -184,28 +180,27 @@ w_p228_reload(void) } void -w_p228_release(void) +w_p228_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.p228_mag == 0 && pl.ammo_357sig > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_p228_aimanim(void) +w_p228_aimanim(player pl) { - return w_deagle_aimanim(); + return w_deagle_aimanim(pl); } void -w_p228_hud(void) +w_p228_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -217,9 +212,8 @@ w_p228_hud(void) } int -w_p228_isempty(void) +w_p228_isempty(player pl) { - player pl = (player)self; if (pl.p228_mag <= 0 && pl.ammo_357sig <= 0) return 1; @@ -228,13 +222,12 @@ w_p228_isempty(void) } void -w_p228_hudpic(int selected, vector pos, float a) +w_p228_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_p228_isempty()) + if (w_p228_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -281,7 +274,7 @@ weapon_t w_p228 = .secondary = __NULL__, .reload = w_p228_reload, .release = w_p228_release, - .crosshair = w_p228_hud, + .postdraw = w_p228_hud, .precache = w_p228_precache, .pickup = w_p228_pickup, .updateammo = w_p228_updateammo, diff --git a/src/shared/w_p90.qc b/src/shared/w_p90.qc index dd3955e..6e83530 100644 --- a/src/shared/w_p90.qc +++ b/src/shared/w_p90.qc @@ -73,10 +73,9 @@ w_p90_deathmsg(void) } int -w_p90_pickup(int new, int startammo) +w_p90_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -95,11 +94,10 @@ w_p90_pickup(int new, int startammo) } void -w_p90_draw(void) +w_p90_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_p90.mdl"); - Weapons_ViewAnimation(P90_DRAW); + Weapons_ViewAnimation(pl, P90_DRAW); #ifdef CLIENT pl.cs_cross_mindist = 7; @@ -108,9 +106,8 @@ w_p90_draw(void) } void -w_p90_primary(void) +w_p90_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -124,13 +121,13 @@ w_p90_primary(void) int r = (float)input_sequence % 3; switch (r) { case 0: - Weapons_ViewAnimation(P90_SHOOT1); + Weapons_ViewAnimation(pl, P90_SHOOT1); break; case 1: - Weapons_ViewAnimation(P90_SHOOT2); + Weapons_ViewAnimation(pl, P90_SHOOT2); break; default: - Weapons_ViewAnimation(P90_SHOOT3); + Weapons_ViewAnimation(pl, P90_SHOOT3); break; } @@ -153,9 +150,8 @@ w_p90_primary(void) } void -w_p90_reload(void) +w_p90_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -164,7 +160,7 @@ w_p90_reload(void) if (!pl.ammo_57mm) return; - Weapons_ViewAnimation(P90_RELOAD); + Weapons_ViewAnimation(pl, P90_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::p90_mag, player::ammo_57mm, 50); @@ -176,28 +172,27 @@ w_p90_reload(void) } void -w_p90_release(void) +w_p90_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.p90_mag == 0 && pl.ammo_57mm > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_p90_aimanim(void) +w_p90_aimanim(player pl) { - return w_ak47_aimanim(); + return w_ak47_aimanim(pl); } void -w_p90_hud(void) +w_p90_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -209,9 +204,8 @@ w_p90_hud(void) } int -w_p90_isempty(void) +w_p90_isempty(player pl) { - player pl = (player)self; if (pl.p90_mag <= 0 && pl.ammo_57mm <= 0) return 1; @@ -220,13 +214,12 @@ w_p90_isempty(void) } void -w_p90_hudpic(int selected, vector pos, float a) +w_p90_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_p90_isempty()) + if (w_p90_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -273,7 +266,7 @@ weapon_t w_p90 = .secondary = __NULL__, .reload = w_p90_reload, .release = w_p90_release, - .crosshair = w_p90_hud, + .postdraw = w_p90_hud, .precache = w_p90_precache, .pickup = w_p90_pickup, .updateammo = w_p90_updateammo, diff --git a/src/shared/w_para.qc b/src/shared/w_para.qc index 8e41cba..ae1b88a 100644 --- a/src/shared/w_para.qc +++ b/src/shared/w_para.qc @@ -72,10 +72,9 @@ w_para_deathmsg(void) } int -w_para_pickup(int new, int startammo) +w_para_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -94,11 +93,10 @@ w_para_pickup(int new, int startammo) } void -w_para_draw(void) +w_para_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_m249.mdl"); - Weapons_ViewAnimation(PARA_DRAW); + Weapons_ViewAnimation(pl, PARA_DRAW); #ifdef CLIENT pl.cs_cross_mindist = 6; @@ -107,9 +105,8 @@ w_para_draw(void) } void -w_para_primary(void) +w_para_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -123,10 +120,10 @@ w_para_primary(void) int r = (float)input_sequence % 2; switch (r) { case 0: - Weapons_ViewAnimation(SCOUT_SHOOT1); + Weapons_ViewAnimation(pl, SCOUT_SHOOT1); break; default: - Weapons_ViewAnimation(SCOUT_SHOOT2); + Weapons_ViewAnimation(pl, SCOUT_SHOOT2); break; } @@ -149,9 +146,8 @@ w_para_primary(void) } void -w_para_reload(void) +w_para_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -160,7 +156,7 @@ w_para_reload(void) if (!pl.ammo_556mmbox) return; - Weapons_ViewAnimation(PARA_RELOAD); + Weapons_ViewAnimation(pl, PARA_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::para_mag, player::ammo_556mmbox, 100); @@ -172,28 +168,27 @@ w_para_reload(void) } void -w_para_release(void) +w_para_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.para_mag == 0 && pl.ammo_556mmbox > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_para_aimanim(void) +w_para_aimanim(player pl) { - return w_ak47_aimanim(); + return w_ak47_aimanim(pl); } void -w_para_hud(void) +w_para_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -205,9 +200,8 @@ w_para_hud(void) } int -w_para_isempty(void) +w_para_isempty(player pl) { - player pl = (player)self; if (pl.para_mag <= 0 && pl.ammo_556mmbox <= 0) return 1; @@ -216,13 +210,12 @@ w_para_isempty(void) } void -w_para_hudpic(int selected, vector pos, float a) +w_para_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_para_isempty()) + if (w_para_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -269,7 +262,7 @@ weapon_t w_para = .secondary = __NULL__, .reload = w_para_reload, .release = w_para_release, - .crosshair = w_para_hud, + .postdraw = w_para_hud, .precache = w_para_precache, .pickup = w_para_pickup, .updateammo = w_para_updateammo, diff --git a/src/shared/w_scout.qc b/src/shared/w_scout.qc index 77cbf34..d144488 100644 --- a/src/shared/w_scout.qc +++ b/src/shared/w_scout.qc @@ -72,10 +72,9 @@ w_scout_deathmsg(void) } int -w_scout_pickup(int new, int startammo) +w_scout_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -94,11 +93,10 @@ w_scout_pickup(int new, int startammo) } void -w_scout_draw(void) +w_scout_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_scout.mdl"); - Weapons_ViewAnimation(SCOUT_DRAW); + Weapons_ViewAnimation(pl, SCOUT_DRAW); pl.mode_temp = 0; #ifdef CLIENT @@ -109,16 +107,15 @@ w_scout_draw(void) void -w_scout_release(void) +w_scout_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.scout_mag == 0 && pl.ammo_762mm > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } @@ -141,9 +138,8 @@ w_scout_release(void) } void -w_scout_secondary(void) +w_scout_secondary(player pl) { - player pl = (player)self; if (pl.w_attack_next) return; @@ -162,16 +158,15 @@ w_scout_secondary(void) pl.w_attack_next = 0.3f; pl.w_idle_next = 0.0f; - w_scout_release(); + w_scout_release(pl); } void -w_scout_primary(void) +w_scout_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { - w_scout_release(); + w_scout_release(pl); return; } if (!pl.scout_mag) { @@ -185,10 +180,10 @@ w_scout_primary(void) int r = (float)input_sequence % 2; switch (r) { case 0: - Weapons_ViewAnimation(SCOUT_SHOOT1); + Weapons_ViewAnimation(pl, SCOUT_SHOOT1); break; default: - Weapons_ViewAnimation(SCOUT_SHOOT2); + Weapons_ViewAnimation(pl, SCOUT_SHOOT2); break; } @@ -212,9 +207,8 @@ w_scout_primary(void) } void -w_scout_reload(void) +w_scout_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -223,7 +217,7 @@ w_scout_reload(void) if (!pl.ammo_762mm) return; - Weapons_ViewAnimation(SCOUT_RELOAD); + Weapons_ViewAnimation(pl, SCOUT_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::scout_mag, player::ammo_762mm, 10); @@ -235,16 +229,15 @@ w_scout_reload(void) } float -w_scout_aimanim(void) +w_scout_aimanim(player pl) { - return w_ak47_aimanim(); + return w_ak47_aimanim(pl); } void -w_scout_hud(void) +w_scout_hud(player pl) { #ifdef CLIENT - player pl = (player)self; if (pl.viewzoom < 1.0f) { Cstrike_DrawScope(); } @@ -256,9 +249,8 @@ w_scout_hud(void) } int -w_scout_isempty(void) +w_scout_isempty(player pl) { - player pl = (player)self; if (pl.scout_mag <= 0 && pl.ammo_762mm <= 0) return 1; @@ -267,13 +259,12 @@ w_scout_isempty(void) } void -w_scout_hudpic(int selected, vector pos, float a) +w_scout_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_scout_isempty()) + if (w_scout_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -320,7 +311,7 @@ weapon_t w_scout = .secondary = w_scout_secondary, .reload = w_scout_reload, .release = w_scout_release, - .crosshair = w_scout_hud, + .postdraw = w_scout_hud, .precache = w_scout_precache, .pickup = w_scout_pickup, .updateammo = w_scout_updateammo, diff --git a/src/shared/w_sg550.qc b/src/shared/w_sg550.qc index 7bc3a9a..bbb4a17 100644 --- a/src/shared/w_sg550.qc +++ b/src/shared/w_sg550.qc @@ -72,10 +72,9 @@ w_sg550_deathmsg(void) } int -w_sg550_pickup(int new, int startammo) +w_sg550_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -94,11 +93,10 @@ w_sg550_pickup(int new, int startammo) } void -w_sg550_draw(void) +w_sg550_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_sg550.mdl"); - Weapons_ViewAnimation(SG550_DRAW); + Weapons_ViewAnimation(pl, SG550_DRAW); #ifdef CLIENT pl.cs_cross_mindist = 5; @@ -107,9 +105,8 @@ w_sg550_draw(void) } void -w_sg550_primary(void) +w_sg550_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -123,10 +120,10 @@ w_sg550_primary(void) int r = (float)input_sequence % 2; switch (r) { case 0: - Weapons_ViewAnimation(SCOUT_SHOOT1); + Weapons_ViewAnimation(pl, SCOUT_SHOOT1); break; default: - Weapons_ViewAnimation(SCOUT_SHOOT2); + Weapons_ViewAnimation(pl, SCOUT_SHOOT2); break; } @@ -150,9 +147,8 @@ w_sg550_primary(void) } void -w_sg550_secondary(void) +w_sg550_secondary(player pl) { - player pl = (player)self; if (pl.w_attack_next) return; @@ -173,9 +169,8 @@ w_sg550_secondary(void) } void -w_sg550_reload(void) +w_sg550_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -184,7 +179,7 @@ w_sg550_reload(void) if (!pl.ammo_556mm) return; - Weapons_ViewAnimation(SG550_RELOAD); + Weapons_ViewAnimation(pl, SG550_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::sg550_mag, player::ammo_556mm, 30); @@ -196,31 +191,29 @@ w_sg550_reload(void) } void -w_sg550_release(void) +w_sg550_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.sg550_mag == 0 && pl.ammo_556mm > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_sg550_aimanim(void) +w_sg550_aimanim(player pl) { - return w_ak47_aimanim(); + return w_ak47_aimanim(pl); } void -w_sg550_hud(void) +w_sg550_hud(player pl) { #ifdef CLIENT - player pl = (player)self; if (pl.viewzoom < 1.0f) { Cstrike_DrawScope(); } @@ -232,9 +225,8 @@ w_sg550_hud(void) } int -w_sg550_isempty(void) +w_sg550_isempty(player pl) { - player pl = (player)self; if (pl.sg550_mag <= 0 && pl.ammo_556mm <= 0) return 1; @@ -243,13 +235,12 @@ w_sg550_isempty(void) } void -w_sg550_hudpic(int selected, vector pos, float a) +w_sg550_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_sg550_isempty()) + if (w_sg550_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -296,7 +287,7 @@ weapon_t w_sg550 = .secondary = w_sg550_secondary, .reload = w_sg550_reload, .release = w_sg550_release, - .crosshair = w_sg550_hud, + .postdraw = w_sg550_hud, .precache = w_sg550_precache, .pickup = w_sg550_pickup, .updateammo = w_sg550_updateammo, diff --git a/src/shared/w_sg552.qc b/src/shared/w_sg552.qc index b42ded8..338d357 100644 --- a/src/shared/w_sg552.qc +++ b/src/shared/w_sg552.qc @@ -73,10 +73,9 @@ w_sg552_deathmsg(void) } int -w_sg552_pickup(int new, int startammo) +w_sg552_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -95,11 +94,10 @@ w_sg552_pickup(int new, int startammo) } void -w_sg552_draw(void) +w_sg552_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_sg552.mdl"); - Weapons_ViewAnimation(SG552_DRAW); + Weapons_ViewAnimation(pl, SG552_DRAW); #ifdef CLIENT pl.cs_cross_mindist = 5; @@ -108,9 +106,8 @@ w_sg552_draw(void) } void -w_sg552_primary(void) +w_sg552_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -124,13 +121,13 @@ w_sg552_primary(void) int r = (float)input_sequence % 3; switch (r) { case 0: - Weapons_ViewAnimation(SG552_SHOOT1); + Weapons_ViewAnimation(pl, SG552_SHOOT1); break; case 1: - Weapons_ViewAnimation(SG552_SHOOT2); + Weapons_ViewAnimation(pl, SG552_SHOOT2); break; default: - Weapons_ViewAnimation(SG552_SHOOT3); + Weapons_ViewAnimation(pl, SG552_SHOOT3); break; } @@ -157,9 +154,8 @@ w_sg552_primary(void) } void -w_sg552_secondary(void) +w_sg552_secondary(player pl) { - player pl = (player)self; if (pl.w_attack_next) return; @@ -174,9 +170,8 @@ w_sg552_secondary(void) } void -w_sg552_reload(void) +w_sg552_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -185,7 +180,7 @@ w_sg552_reload(void) if (!pl.ammo_556mm) return; - Weapons_ViewAnimation(SG552_RELOAD); + Weapons_ViewAnimation(pl, SG552_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::sg552_mag, player::ammo_556mm, 30); @@ -197,31 +192,29 @@ w_sg552_reload(void) } void -w_sg552_release(void) +w_sg552_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.sg552_mag == 0 && pl.ammo_556mm > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_sg552_aimanim(void) +w_sg552_aimanim(player pl) { - return w_ak47_aimanim(); + return w_ak47_aimanim(pl); } void -w_sg552_hud(void) +w_sg552_hud(player pl) { #ifdef CLIENT - player pl = (player)self; if (pl.viewzoom == 1.0f) { Cstrike_DrawCrosshair(); } else { @@ -235,9 +228,8 @@ w_sg552_hud(void) } int -w_sg552_isempty(void) +w_sg552_isempty(player pl) { - player pl = (player)self; if (pl.sg552_mag <= 0 && pl.ammo_556mm <= 0) return 1; @@ -246,13 +238,12 @@ w_sg552_isempty(void) } void -w_sg552_hudpic(int selected, vector pos, float a) +w_sg552_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_sg552_isempty()) + if (w_sg552_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -299,7 +290,7 @@ weapon_t w_sg552 = .secondary = w_sg552_secondary, .reload = w_sg552_reload, .release = w_sg552_release, - .crosshair = w_sg552_hud, + .postdraw = w_sg552_hud, .precache = w_sg552_precache, .pickup = w_sg552_pickup, .updateammo = w_sg552_updateammo, diff --git a/src/shared/w_smokegrenade.qc b/src/shared/w_smokegrenade.qc index 772abb3..3ae5d80 100644 --- a/src/shared/w_smokegrenade.qc +++ b/src/shared/w_smokegrenade.qc @@ -56,10 +56,9 @@ w_smokegrenade_updateammo(player pl) } int -w_smokegrenade_pickup(int new, int startammo) +w_smokegrenade_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (pl.ammo_smokegrenade < AMMO_MAX_SMOKE) { pl.ammo_smokegrenade = bound(0, pl.ammo_smokegrenade + 1, AMMO_MAX_SMOKE); @@ -89,17 +88,16 @@ w_smokegrenade_deathmsg(void) } void -w_smokegrenade_draw(void) +w_smokegrenade_draw(player pl) { Weapons_SetModel("models/v_smokegrenade.mdl"); - Weapons_ViewAnimation(SMOKEGRENADE_DRAW); - player pl = (player)self; + Weapons_ViewAnimation(pl, SMOKEGRENADE_DRAW); pl.mode_temp = 0; } #ifdef SERVER void -w_smokegrenade_throw(void) +w_smokegrenade_throw(player pl) { static void smokegrenade_explode(void) { @@ -118,7 +116,6 @@ w_smokegrenade_throw(void) self.frame = 0; } - player pl = (player)self; vector vPLAngle = pl.v_angle; if (vPLAngle[0] < 0) { vPLAngle[0] = -10 + vPLAngle[0] * ((90 - 10) / 90.0); @@ -152,9 +149,8 @@ w_smokegrenade_throw(void) #endif void -w_smokegrenade_primary(void) +w_smokegrenade_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { return; } @@ -169,16 +165,15 @@ w_smokegrenade_primary(void) return; } - Weapons_ViewAnimation(SMOKEGRENADE_PULLPIN); + Weapons_ViewAnimation(pl, SMOKEGRENADE_PULLPIN); pl.mode_temp = 1; pl.w_attack_next = 0.975f; pl.w_idle_next = pl.w_attack_next; } void -w_smokegrenade_release(void) +w_smokegrenade_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); @@ -189,16 +184,16 @@ w_smokegrenade_release(void) if (pl.mode_temp == 1) { pl.ammo_smokegrenade--; #ifdef CLIENT - Weapons_ViewAnimation(SMOKEGRENADE_THROW); + Weapons_ViewAnimation(pl, SMOKEGRENADE_THROW); #else - w_smokegrenade_throw(); + w_smokegrenade_throw(pl); #endif pl.mode_temp = 2; pl.w_attack_next = 1.0f; pl.w_idle_next = 0.5f; } else if (pl.mode_temp == 2) { #ifdef CLIENT - Weapons_ViewAnimation(SMOKEGRENADE_DRAW); + Weapons_ViewAnimation(pl, SMOKEGRENADE_DRAW); #else if (!pl.ammo_smokegrenade) { Weapons_RemoveItem(pl, WEAPON_SMOKEGRENADE); @@ -211,13 +206,13 @@ w_smokegrenade_release(void) } float -w_smokegrenade_aimanim(void) +w_smokegrenade_aimanim(player pl) { - return w_flashbang_aimanim(); + return w_flashbang_aimanim(pl); } void -w_smokegrenade_hud(void) +w_smokegrenade_hud(player pl) { #ifdef CLIENT HUD_DrawAmmo2(); @@ -227,9 +222,8 @@ w_smokegrenade_hud(void) } int -w_smokegrenade_isempty(void) +w_smokegrenade_isempty(player pl) { - player pl = (player)self; if (pl.ammo_smokegrenade <= 0) return 1; @@ -238,10 +232,9 @@ w_smokegrenade_isempty(void) } void -w_smokegrenade_hudpic(int selected, vector pos, float a) +w_smokegrenade_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; HUD_DrawAmmoBar(pos, pl.ammo_smokegrenade, AMMO_MAX_SMOKE, a); @@ -284,7 +277,7 @@ weapon_t w_smokegrenade = .secondary = __NULL__, .reload = __NULL__, .release = w_smokegrenade_release, - .crosshair = w_smokegrenade_hud, + .postdraw = w_smokegrenade_hud, .precache = w_smokegrenade_precache, .pickup = w_smokegrenade_pickup, .updateammo = w_smokegrenade_updateammo, diff --git a/src/shared/w_tmp.qc b/src/shared/w_tmp.qc index 83183ab..3727258 100644 --- a/src/shared/w_tmp.qc +++ b/src/shared/w_tmp.qc @@ -73,10 +73,9 @@ w_tmp_deathmsg(void) } int -w_tmp_pickup(int new, int startammo) +w_tmp_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -95,11 +94,10 @@ w_tmp_pickup(int new, int startammo) } void -w_tmp_draw(void) +w_tmp_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_tmp.mdl"); - Weapons_ViewAnimation(TMP_DRAW); + Weapons_ViewAnimation(pl, TMP_DRAW); #ifdef CLIENT pl.cs_cross_mindist = 7; @@ -108,9 +106,8 @@ w_tmp_draw(void) } void -w_tmp_primary(void) +w_tmp_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -124,13 +121,13 @@ w_tmp_primary(void) int r = (float)input_sequence % 3; switch (r) { case 0: - Weapons_ViewAnimation(TMP_SHOOT1); + Weapons_ViewAnimation(pl, TMP_SHOOT1); break; case 1: - Weapons_ViewAnimation(TMP_SHOOT2); + Weapons_ViewAnimation(pl, TMP_SHOOT2); break; default: - Weapons_ViewAnimation(TMP_SHOOT3); + Weapons_ViewAnimation(pl, TMP_SHOOT3); break; } @@ -153,9 +150,8 @@ w_tmp_primary(void) } void -w_tmp_reload(void) +w_tmp_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -164,7 +160,7 @@ w_tmp_reload(void) if (!pl.ammo_9mm) return; - Weapons_ViewAnimation(TMP_RELOAD); + Weapons_ViewAnimation(pl, TMP_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::tmp_mag, player::ammo_9mm, 30); @@ -176,28 +172,27 @@ w_tmp_reload(void) } void -w_tmp_release(void) +w_tmp_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.tmp_mag == 0 && pl.ammo_9mm > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_tmp_aimanim(void) +w_tmp_aimanim(player pl) { - return w_ak47_aimanim(); + return w_ak47_aimanim(pl); } void -w_tmp_hud(void) +w_tmp_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -209,9 +204,8 @@ w_tmp_hud(void) } int -w_tmp_isempty(void) +w_tmp_isempty(player pl) { - player pl = (player)self; if (pl.tmp_mag <= 0 && pl.ammo_9mm <= 0) return 1; @@ -220,13 +214,12 @@ w_tmp_isempty(void) } void -w_tmp_hudpic(int selected, vector pos, float a) +w_tmp_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_tmp_isempty()) + if (w_tmp_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -273,7 +266,7 @@ weapon_t w_tmp = .secondary = __NULL__, .reload = w_tmp_reload, .release = w_tmp_release, - .crosshair = w_tmp_hud, + .postdraw = w_tmp_hud, .precache = w_tmp_precache, .pickup = w_tmp_pickup, .updateammo = w_tmp_updateammo, diff --git a/src/shared/w_ump45.qc b/src/shared/w_ump45.qc index a2dfceb..cd0a038 100644 --- a/src/shared/w_ump45.qc +++ b/src/shared/w_ump45.qc @@ -73,10 +73,9 @@ w_ump45_deathmsg(void) } int -w_ump45_pickup(int new, int startammo) +w_ump45_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -95,11 +94,10 @@ w_ump45_pickup(int new, int startammo) } void -w_ump45_draw(void) +w_ump45_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_ump45.mdl"); - Weapons_ViewAnimation(UMP45_DRAW); + Weapons_ViewAnimation(pl, UMP45_DRAW); #ifdef CLIENT pl.cs_cross_mindist = 6; @@ -108,9 +106,8 @@ w_ump45_draw(void) } void -w_ump45_primary(void) +w_ump45_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -124,13 +121,13 @@ w_ump45_primary(void) int r = (float)input_sequence % 3; switch (r) { case 0: - Weapons_ViewAnimation(UMP45_SHOOT1); + Weapons_ViewAnimation(pl, UMP45_SHOOT1); break; case 1: - Weapons_ViewAnimation(UMP45_SHOOT2); + Weapons_ViewAnimation(pl, UMP45_SHOOT2); break; default: - Weapons_ViewAnimation(UMP45_SHOOT3); + Weapons_ViewAnimation(pl, UMP45_SHOOT3); break; } @@ -153,9 +150,8 @@ w_ump45_primary(void) } void -w_ump45_reload(void) +w_ump45_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -164,7 +160,7 @@ w_ump45_reload(void) if (!pl.ammo_45acp) return; - Weapons_ViewAnimation(UMP45_RELOAD); + Weapons_ViewAnimation(pl, UMP45_RELOAD); #ifdef SERVER Weapons_ReloadWeapon(pl, player::ump45_mag, player::ammo_45acp, 25); @@ -176,28 +172,27 @@ w_ump45_reload(void) } void -w_ump45_release(void) +w_ump45_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.ump45_mag == 0 && pl.ammo_45acp > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_ump45_aimanim(void) +w_ump45_aimanim(player pl) { - return w_ak47_aimanim(); + return w_ak47_aimanim(pl); } void -w_ump45_hud(void) +w_ump45_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -209,9 +204,8 @@ w_ump45_hud(void) } int -w_ump45_isempty(void) +w_ump45_isempty(player pl) { - player pl = (player)self; if (pl.ump45_mag <= 0 && pl.ammo_45acp <= 0) return 1; @@ -220,13 +214,12 @@ w_ump45_isempty(void) } void -w_ump45_hudpic(int selected, vector pos, float a) +w_ump45_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_ump45_isempty()) + if (w_ump45_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -273,7 +266,7 @@ weapon_t w_ump45 = .secondary = __NULL__, .reload = w_ump45_reload, .release = w_ump45_release, - .crosshair = w_ump45_hud, + .postdraw = w_ump45_hud, .precache = w_ump45_precache, .pickup = w_ump45_pickup, .updateammo = w_ump45_updateammo, diff --git a/src/shared/w_usp45.qc b/src/shared/w_usp45.qc index 5a0659e..a473c37 100644 --- a/src/shared/w_usp45.qc +++ b/src/shared/w_usp45.qc @@ -86,10 +86,9 @@ w_usp45_deathmsg(void) } int -w_usp45_pickup(int new, int startammo) +w_usp45_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -108,15 +107,14 @@ w_usp45_pickup(int new, int startammo) } void -w_usp45_draw(void) +w_usp45_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_usp.mdl"); if (pl.mode_usp45 == 1) { - Weapons_ViewAnimation(USP45_DRAW); + Weapons_ViewAnimation(pl, USP45_DRAW); } else { - Weapons_ViewAnimation(USP45_DRAWUNSIL); + Weapons_ViewAnimation(pl, USP45_DRAWUNSIL); } #ifdef CLIENT @@ -126,9 +124,8 @@ w_usp45_draw(void) } void -w_usp45_primary(void) +w_usp45_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -145,33 +142,33 @@ w_usp45_primary(void) int r = (float)input_sequence % 3; if (pl.mode_usp45 == 1) { if (pl.usp45_mag <= 0) { - Weapons_ViewAnimation(USP45_SHOOTLAST); + Weapons_ViewAnimation(pl, USP45_SHOOTLAST); } else { switch (r) { case 0: - Weapons_ViewAnimation(USP45_SHOOT1); + Weapons_ViewAnimation(pl, USP45_SHOOT1); break; case 1: - Weapons_ViewAnimation(USP45_SHOOT2); + Weapons_ViewAnimation(pl, USP45_SHOOT2); break; default: - Weapons_ViewAnimation(USP45_SHOOT3); + Weapons_ViewAnimation(pl, USP45_SHOOT3); break; } } } else { if (pl.usp45_mag <= 0) { - Weapons_ViewAnimation(USP45_SHOOTLASTUNSIL); + Weapons_ViewAnimation(pl, USP45_SHOOTLASTUNSIL); } else { switch (r) { case 0: - Weapons_ViewAnimation(USP45_SHOOT1UNSIL); + Weapons_ViewAnimation(pl, USP45_SHOOT1UNSIL); break; case 1: - Weapons_ViewAnimation(USP45_SHOOT2UNSIL); + Weapons_ViewAnimation(pl, USP45_SHOOT2UNSIL); break; default: - Weapons_ViewAnimation(USP45_SHOOT3UNSIL); + Weapons_ViewAnimation(pl, USP45_SHOOT3UNSIL); break; } } @@ -209,9 +206,8 @@ w_usp45_primary(void) } void -w_usp45_secondary(void) +w_usp45_secondary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0) return; @@ -221,18 +217,17 @@ w_usp45_secondary(void) /* play the animation */ if (pl.mode_usp45) - Weapons_ViewAnimation(USP45_ADDSIL); + Weapons_ViewAnimation(pl, USP45_ADDSIL); else - Weapons_ViewAnimation(USP45_DETACHSIL); + Weapons_ViewAnimation(pl, USP45_DETACHSIL); pl.w_attack_next = 3.1f; pl.w_idle_next = pl.w_attack_next; } void -w_usp45_reload(void) +w_usp45_reload(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) return; @@ -242,9 +237,9 @@ w_usp45_reload(void) return; if (pl.mode_usp45 == 1) - Weapons_ViewAnimation(USP45_RELOAD); + Weapons_ViewAnimation(pl, USP45_RELOAD); else - Weapons_ViewAnimation(USP45_RELOADUNSIL); + Weapons_ViewAnimation(pl, USP45_RELOADUNSIL); #ifdef SERVER Weapons_ReloadWeapon(pl, player::usp45_mag, player::ammo_45acp, 12); @@ -254,28 +249,27 @@ w_usp45_reload(void) } void -w_usp45_release(void) +w_usp45_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.usp45_mag == 0 && pl.ammo_45acp > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } } float -w_usp45_aimanim(void) +w_usp45_aimanim(player pl) { - return w_deagle_aimanim(); + return w_deagle_aimanim(pl); } void -w_usp45_hud(void) +w_usp45_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -287,9 +281,8 @@ w_usp45_hud(void) } int -w_usp45_isempty(void) +w_usp45_isempty(player pl) { - player pl = (player)self; if (pl.usp45_mag <= 0 && pl.ammo_45acp <= 0) return 1; @@ -298,13 +291,12 @@ w_usp45_isempty(void) } void -w_usp45_hudpic(int selected, vector pos, float a) +w_usp45_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_usp45_isempty()) + if (w_usp45_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -351,7 +343,7 @@ weapon_t w_usp45 = .secondary = w_usp45_secondary, .reload = w_usp45_reload, .release = w_usp45_release, - .crosshair = w_usp45_hud, + .postdraw = w_usp45_hud, .precache = w_usp45_precache, .pickup = w_usp45_pickup, .updateammo = w_usp45_updateammo, diff --git a/src/shared/w_xm1014.qc b/src/shared/w_xm1014.qc index 538ba6c..895962e 100644 --- a/src/shared/w_xm1014.qc +++ b/src/shared/w_xm1014.qc @@ -116,10 +116,9 @@ w_xm1014_deathmsg(void) } int -w_xm1014_pickup(int new, int startammo) +w_xm1014_pickup(player pl, int new, int startammo) { #ifdef SERVER - player pl = (player)self; if (new) { if (startammo == -1) @@ -138,11 +137,10 @@ w_xm1014_pickup(int new, int startammo) } void -w_xm1014_draw(void) +w_xm1014_draw(player pl) { - player pl = (player)self; Weapons_SetModel("models/v_xm1014.mdl"); - Weapons_ViewAnimation(XM1014_DRAW); + Weapons_ViewAnimation(pl, XM1014_DRAW); pl.mode_temp = 0; #ifdef CLIENT @@ -152,31 +150,30 @@ w_xm1014_draw(void) } -void w_xm1014_release(void); +void w_xm1014_release(player pl); void -w_xm1014_primary(void) +w_xm1014_primary(player pl) { - player pl = (player)self; if (pl.w_attack_next > 0.0) { - w_xm1014_release(); + w_xm1014_release(pl); return; } /* interrupt reloading if no longer empty */ if (pl.mode_temp == XM1014S_RELOAD && pl.xm1014_mag >= 1) { pl.mode_temp = XM1014S_RELOAD_END; - w_xm1014_release(); + w_xm1014_release(pl); return; } else if (pl.mode_temp > XM1014S_IDLE) { - w_xm1014_release(); + w_xm1014_release(pl); return; } /* Ammo check */ if (pl.xm1014_mag <= 0) { - w_xm1014_release(); + w_xm1014_release(pl); return; } @@ -185,10 +182,10 @@ w_xm1014_primary(void) int r = (float)input_sequence % 3; switch (r) { case 0: - Weapons_ViewAnimation(XM1014_SHOOT1); + Weapons_ViewAnimation(pl, XM1014_SHOOT1); break; default: - Weapons_ViewAnimation(XM1014_SHOOT2); + Weapons_ViewAnimation(pl, XM1014_SHOOT2); break; } @@ -218,9 +215,8 @@ w_xm1014_primary(void) } void -w_xm1014_reload(void) +w_xm1014_reload(player pl) { - player pl = (player)self; if (pl.xm1014_mag >= 7) { return; @@ -237,16 +233,15 @@ w_xm1014_reload(void) } void -w_xm1014_release(void) +w_xm1014_release(player pl) { - player pl = (player)self; w_cstrike_weaponrelease(); /* auto-reload if need be */ if (pl.w_attack_next <= 0.0) if (pl.mode_temp == XM1014S_IDLE && pl.xm1014_mag == 0 && pl.ammo_buckshot > 0) { - Weapons_Reload(); + Weapons_Reload(pl); return; } @@ -255,11 +250,11 @@ w_xm1014_release(void) } if (pl.mode_temp == XM1014S_RELOAD_START) { - Weapons_ViewAnimation(XM1014_RELOAD_START); + Weapons_ViewAnimation(pl, XM1014_RELOAD_START); pl.mode_temp = XM1014S_RELOAD; pl.w_idle_next = 0.65f; } else if (pl.mode_temp == XM1014S_RELOAD) { - Weapons_ViewAnimation(XM1014_INSERT); + Weapons_ViewAnimation(pl, XM1014_INSERT); pl.xm1014_mag++; pl.ammo_buckshot--; w_xm1014_updateammo(pl); @@ -271,7 +266,7 @@ w_xm1014_release(void) } pl.w_idle_next = 0.5f; } else if (pl.mode_temp == XM1014S_RELOAD_END) { - Weapons_ViewAnimation(XM1014_RELOAD_END); + Weapons_ViewAnimation(pl, XM1014_RELOAD_END); pl.mode_temp = XM1014S_IDLE; pl.w_idle_next = 10.0f; pl.w_attack_next = 0.5f; @@ -279,13 +274,13 @@ w_xm1014_release(void) } float -w_xm1014_aimanim(void) +w_xm1014_aimanim(player pl) { - return w_ak47_aimanim(); + return w_ak47_aimanim(pl); } void -w_xm1014_hud(void) +w_xm1014_hud(player pl) { #ifdef CLIENT Cstrike_DrawCrosshair(); @@ -297,9 +292,8 @@ w_xm1014_hud(void) } int -w_xm1014_isempty(void) +w_xm1014_isempty(player pl) { - player pl = (player)self; if (pl.xm1014_mag <= 0 && pl.ammo_buckshot <= 0) return 1; @@ -308,13 +302,12 @@ w_xm1014_isempty(void) } void -w_xm1014_hudpic(int selected, vector pos, float a) +w_xm1014_hudpic(player pl, int selected, vector pos, float a) { #ifdef CLIENT - player pl = (player)self; vector hud_col; - if (w_xm1014_isempty()) + if (w_xm1014_isempty(pl)) hud_col = [1,0,0]; else hud_col = g_hud_color; @@ -361,7 +354,7 @@ weapon_t w_xm1014 = .secondary = __NULL__, .reload = w_xm1014_reload, .release = w_xm1014_release, - .crosshair = w_xm1014_hud, + .postdraw = w_xm1014_hud, .precache = w_xm1014_precache, .pickup = w_xm1014_pickup, .updateammo = w_xm1014_updateammo,