From 0eeb27a65a648a2114cfcdca5a6617c6d33b9982 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Thu, 4 Mar 2021 02:07:08 +0100 Subject: [PATCH] Rename all instances of ::ammo_handgrenade_state to ::mode_tempstate as it's used in plenty of other instances, by other weapons, as it's not meant to be persistent. --- gearbox/src/shared/player.qc | 16 ++++++++-------- hunger/src/shared/player.qc | 16 ++++++++-------- hunger/src/shared/w_chaingun.qc | 19 +++++++++++-------- hunger/src/shared/w_sniper.qc | 9 ++++++--- hunger/src/shared/w_tnt.qc | 11 +++++++---- scihunt/src/shared/player.qc | 16 ++++++++-------- valve/src/shared/player.qc | 16 ++++++++-------- valve/src/shared/w_handgrenade.qc | 15 +++++++++------ 8 files changed, 65 insertions(+), 53 deletions(-) diff --git a/gearbox/src/shared/player.qc b/gearbox/src/shared/player.qc index 3bc10950..742edcef 100644 --- a/gearbox/src/shared/player.qc +++ b/gearbox/src/shared/player.qc @@ -135,8 +135,8 @@ class player:base_player int ammo_egon_state_net; int ammo_rpg_state; int ammo_rpg_state_net; - int ammo_handgrenade_state; - int ammo_handgrenade_state_net; + int mode_tempstate; + int mode_tempstate_net; /* gearbox */ int eagle_mag; int eagle_mag_net; @@ -312,7 +312,7 @@ player::ReceiveEntity(float new) ammo_gauss_volume = readbyte(); ammo_egon_state = readbyte(); ammo_rpg_state = readbyte(); - ammo_handgrenade_state = readbyte(); + mode_tempstate = readbyte(); /* gearbox */ mode_displacer = readbyte(); @@ -364,7 +364,7 @@ player::PredictPreFrame(void) ammo_gauss_volume_net = ammo_gauss_volume; ammo_egon_state_net = ammo_egon_state; ammo_rpg_state_net = ammo_rpg_state; - ammo_handgrenade_state_net = ammo_handgrenade_state; + mode_tempstate_net = mode_tempstate; /* gearbox */ eagle_mag_net = eagle_mag; @@ -419,7 +419,7 @@ player::PredictPostFrame(void) ammo_gauss_volume = ammo_gauss_volume_net; ammo_egon_state = ammo_egon_state_net; ammo_rpg_state = ammo_rpg_state_net; - ammo_handgrenade_state = ammo_handgrenade_state_net; + mode_tempstate = mode_tempstate_net; /* gearbox */ eagle_mag = eagle_mag_net; @@ -580,7 +580,7 @@ player::EvaluateEntity(void) if (ammo_rpg_state != ammo_rpg_state_net) { SendFlags |= PLAYER_AMMO3; } - if (ammo_handgrenade_state != ammo_handgrenade_state_net) { + if (mode_tempstate != mode_tempstate_net) { SendFlags |= PLAYER_AMMO3; } @@ -627,7 +627,7 @@ player::EvaluateEntity(void) ammo_gauss_volume_net = ammo_gauss_volume; ammo_egon_state_net = ammo_egon_state; ammo_rpg_state_net = ammo_rpg_state; - ammo_handgrenade_state_net = ammo_handgrenade_state; + mode_tempstate_net = mode_tempstate; /* gearbox */ if (eagle_mag_net != eagle_mag) @@ -790,7 +790,7 @@ player::SendEntity(entity ePEnt, float fChanged) WriteByte(MSG_ENTITY, ammo_gauss_volume); WriteByte(MSG_ENTITY, ammo_egon_state); WriteByte(MSG_ENTITY, ammo_rpg_state); - WriteByte(MSG_ENTITY, ammo_handgrenade_state); + WriteByte(MSG_ENTITY, mode_tempstate); /* gearbox */ WriteByte(MSG_ENTITY, mode_displacer); diff --git a/hunger/src/shared/player.qc b/hunger/src/shared/player.qc index 0fe10250..292277e6 100644 --- a/hunger/src/shared/player.qc +++ b/hunger/src/shared/player.qc @@ -135,8 +135,8 @@ class player:base_player int ammo_egon_state_net; int ammo_rpg_state; int ammo_rpg_state_net; - int ammo_handgrenade_state; - int ammo_handgrenade_state_net; + int mode_tempstate; + int mode_tempstate_net; /* hunger */ int sniper_mag; int sniper_mag_net; @@ -311,7 +311,7 @@ player::ReceiveEntity(float new) ammo_gauss_volume = readbyte(); ammo_egon_state = readbyte(); ammo_rpg_state = readbyte(); - ammo_handgrenade_state = readbyte(); + mode_tempstate = readbyte(); mode_silencer = readbyte(); } @@ -357,7 +357,7 @@ player::PredictPreFrame(void) ammo_gauss_volume_net = ammo_gauss_volume; ammo_egon_state_net = ammo_egon_state; ammo_rpg_state_net = ammo_rpg_state; - ammo_handgrenade_state_net = ammo_handgrenade_state; + mode_tempstate_net = mode_tempstate; /* gearbox */ sniper_mag_net = sniper_mag; @@ -411,7 +411,7 @@ player::PredictPostFrame(void) ammo_gauss_volume = ammo_gauss_volume_net; ammo_egon_state = ammo_egon_state_net; ammo_rpg_state = ammo_rpg_state_net; - ammo_handgrenade_state = ammo_handgrenade_state_net; + mode_tempstate = mode_tempstate_net; /* hunger */ sniper_mag = sniper_mag_net; @@ -571,7 +571,7 @@ player::EvaluateEntity(void) if (ammo_rpg_state != ammo_rpg_state_net) { SendFlags |= PLAYER_AMMO3; } - if (ammo_handgrenade_state != ammo_handgrenade_state_net) { + if (mode_tempstate != mode_tempstate_net) { SendFlags |= PLAYER_AMMO3; } @@ -618,7 +618,7 @@ player::EvaluateEntity(void) ammo_gauss_volume_net = ammo_gauss_volume; ammo_egon_state_net = ammo_egon_state; ammo_rpg_state_net = ammo_rpg_state; - ammo_handgrenade_state_net = ammo_handgrenade_state; + mode_tempstate_net = mode_tempstate; /* hunger */ if (sniper_mag != sniper_mag_net) @@ -776,7 +776,7 @@ player::SendEntity(entity ePEnt, float fChanged) WriteByte(MSG_ENTITY, ammo_gauss_volume); WriteByte(MSG_ENTITY, ammo_egon_state); WriteByte(MSG_ENTITY, ammo_rpg_state); - WriteByte(MSG_ENTITY, ammo_handgrenade_state); + WriteByte(MSG_ENTITY, mode_tempstate); WriteByte(MSG_ENTITY, mode_silencer); } diff --git a/hunger/src/shared/w_chaingun.qc b/hunger/src/shared/w_chaingun.qc index 70e7a6a9..3b7db8fc 100644 --- a/hunger/src/shared/w_chaingun.qc +++ b/hunger/src/shared/w_chaingun.qc @@ -88,6 +88,9 @@ void w_chaingun_draw(void) { #ifdef CLIENT + player pl = (player)self; + pl.mode_tempstate = 0; + Weapons_SetModel("models/v_tfac.mdl"); Weapons_ViewAnimation(CHAINGUN_DRAW); #endif @@ -116,8 +119,8 @@ w_chaingun_release(void) } /* end firing */ - if (pl.ammo_handgrenade_state == 1) { - pl.ammo_handgrenade_state = 0; + if (pl.mode_tempstate == 1) { + pl.mode_tempstate = 0; #ifdef SERVER Sound_Play(pl, CHAN_WEAPON, "weapon_chaingun.spindown"); #endif @@ -128,8 +131,8 @@ w_chaingun_release(void) } /* end reload */ - if (pl.ammo_handgrenade_state == 2) { - pl.ammo_handgrenade_state = 0; + if (pl.mode_tempstate == 2) { + pl.mode_tempstate = 0; Weapons_ViewAnimation(CHAINGUN_DRAW); pl.w_attack_next = 1.0f; pl.w_idle_next = pl.w_attack_next; @@ -152,7 +155,7 @@ w_chaingun_primary(void) player pl = (player)self; /* in case we're spamming primary while reloading */ - if (pl.ammo_handgrenade_state == 2) { + if (pl.mode_tempstate == 2) { w_chaingun_release(); return; } @@ -167,8 +170,8 @@ w_chaingun_primary(void) } /* spin up first */ - if (pl.ammo_handgrenade_state == 0) { - pl.ammo_handgrenade_state = 1; + if (pl.mode_tempstate == 0) { + pl.mode_tempstate = 1; Weapons_ViewAnimation(CHAINGUN_SPINUP); #ifdef SERVER Sound_Play(pl, CHAN_WEAPON, "weapon_chaingun.spinup"); @@ -217,7 +220,7 @@ w_chaingun_reload(void) Weapons_ReloadWeapon(pl, player::chaingun_mag, player::ammo_9mm, 100); #endif - pl.ammo_handgrenade_state = 2; + pl.mode_tempstate = 2; pl.w_attack_next = 10.0f; pl.w_idle_next = 1.5f; } diff --git a/hunger/src/shared/w_sniper.qc b/hunger/src/shared/w_sniper.qc index 5941c429..8515834e 100644 --- a/hunger/src/shared/w_sniper.qc +++ b/hunger/src/shared/w_sniper.qc @@ -84,6 +84,9 @@ void w_sniper_draw(void) { #ifdef CLIENT + player pl = (player)self; + pl.mode_tempstate = 0; + Weapons_SetModel("models/v_tfc_sniper.mdl"); Weapons_ViewAnimation(SNIPER_DRAW); #endif @@ -113,9 +116,9 @@ w_sniper_release(void) return; } - if (pl.ammo_handgrenade_state == 1) { + if (pl.mode_tempstate == 1) { Weapons_ViewAnimation(SNIPER_DRAW); - pl.ammo_handgrenade_state = 0; + pl.mode_tempstate = 0; pl.w_attack_next = 0.0f; pl.w_idle_next = 15.0f; return; @@ -213,7 +216,7 @@ w_sniper_reload(void) Weapons_ReloadWeapon(pl, player::sniper_mag, player::ammo_sniper, 5); #endif - pl.ammo_handgrenade_state = 1; + pl.mode_tempstate = 1; pl.w_attack_next = 2.5f; pl.w_idle_next = 2.0f; } diff --git a/hunger/src/shared/w_tnt.qc b/hunger/src/shared/w_tnt.qc index 901276e1..7c0e71c7 100644 --- a/hunger/src/shared/w_tnt.qc +++ b/hunger/src/shared/w_tnt.qc @@ -120,6 +120,9 @@ void w_tnt_throw(void) void w_tnt_draw(void) { #ifdef CLIENT + player pl = (player)self; + pl.mode_tempstate = 0; + Weapons_SetModel("models/v_tnt.mdl"); Weapons_ViewAnimation(HANDGRENADE_DRAW); #endif @@ -152,7 +155,7 @@ void w_tnt_release(void) return; } - if (pl.ammo_handgrenade_state == 1) { + if (pl.mode_tempstate == 1) { #ifdef CLIENT pl.ammo_handgrenade--; Weapons_ViewAnimation(HANDGRENADE_THROW1); @@ -160,10 +163,10 @@ void w_tnt_release(void) pl.ammo_handgrenade--; w_tnt_throw(); #endif - pl.ammo_handgrenade_state = 2; + pl.mode_tempstate = 2; pl.w_attack_next = 1.0f; pl.w_idle_next = 0.5f; - } else if (pl.ammo_handgrenade_state == 2) { + } else if (pl.mode_tempstate == 2) { #ifdef CLIENT Weapons_ViewAnimation(HANDGRENADE_DRAW); #else @@ -173,7 +176,7 @@ void w_tnt_release(void) #endif pl.w_attack_next = 0.5f; pl.w_idle_next = 0.5f; - pl.ammo_handgrenade_state = 0; + pl.mode_tempstate = 0; } else { int r = (float)input_sequence % 8; if (r == 1) { diff --git a/scihunt/src/shared/player.qc b/scihunt/src/shared/player.qc index b57f13ac..9e64dd9e 100644 --- a/scihunt/src/shared/player.qc +++ b/scihunt/src/shared/player.qc @@ -140,8 +140,8 @@ class player:base_player int ammo_egon_state_net; int ammo_rpg_state; int ammo_rpg_state_net; - int ammo_handgrenade_state; - int ammo_handgrenade_state_net; + int mode_tempstate; + int mode_tempstate_net; int ammo_chainsaw_state; int ammo_chainsaw_state_net; int ammo_hammer_state; @@ -297,7 +297,7 @@ player::ReceiveEntity(float new) ammo_gauss_volume = readbyte(); ammo_egon_state = readbyte(); ammo_rpg_state = readbyte(); - ammo_handgrenade_state = readbyte(); + mode_tempstate = readbyte(); ammo_chainsaw_state = readbyte(); ammo_hammer_state = readbyte(); } @@ -345,7 +345,7 @@ player::PredictPreFrame(void) ammo_gauss_volume_net = ammo_gauss_volume; ammo_egon_state_net = ammo_egon_state; ammo_rpg_state_net = ammo_rpg_state; - ammo_handgrenade_state_net = ammo_handgrenade_state; + mode_tempstate_net = mode_tempstate; ammo_chainsaw_state_net = ammo_chainsaw_state; ammo_hammer_state_net = ammo_hammer_state; } @@ -388,7 +388,7 @@ player::PredictPostFrame(void) ammo_gauss_volume = ammo_gauss_volume_net; ammo_egon_state = ammo_egon_state_net; ammo_rpg_state = ammo_rpg_state_net; - ammo_handgrenade_state = ammo_handgrenade_state_net; + mode_tempstate = mode_tempstate_net; ammo_chainsaw_state = ammo_chainsaw_state_net; ammo_hammer_state = ammo_hammer_state_net; } @@ -538,7 +538,7 @@ player::EvaluateEntity(void) if (ammo_rpg_state != ammo_rpg_state_net) { SendFlags |= PLAYER_AMMO3; } - if (ammo_handgrenade_state != ammo_handgrenade_state_net) { + if (mode_tempstate != mode_tempstate_net) { SendFlags |= PLAYER_AMMO3; } if (ammo_chainsaw_state != ammo_chainsaw_state_net) { @@ -592,7 +592,7 @@ player::EvaluateEntity(void) ammo_gauss_volume_net = ammo_gauss_volume; ammo_egon_state_net = ammo_egon_state; ammo_rpg_state_net = ammo_rpg_state; - ammo_handgrenade_state_net = ammo_handgrenade_state; + mode_tempstate_net = mode_tempstate; ammo_chainsaw_state_net = ammo_chainsaw_state; ammo_hammer_state_net = ammo_hammer_state; } @@ -700,7 +700,7 @@ player::SendEntity(entity ePEnt, float fChanged) WriteByte(MSG_ENTITY, ammo_gauss_volume); WriteByte(MSG_ENTITY, ammo_egon_state); WriteByte(MSG_ENTITY, ammo_rpg_state); - WriteByte(MSG_ENTITY, ammo_handgrenade_state); + WriteByte(MSG_ENTITY, mode_tempstate); WriteByte(MSG_ENTITY, ammo_chainsaw_state); WriteByte(MSG_ENTITY, ammo_hammer_state); } diff --git a/valve/src/shared/player.qc b/valve/src/shared/player.qc index eda604ac..53733033 100644 --- a/valve/src/shared/player.qc +++ b/valve/src/shared/player.qc @@ -135,8 +135,8 @@ class player:base_player int ammo_egon_state_net; int ammo_rpg_state; int ammo_rpg_state_net; - int ammo_handgrenade_state; - int ammo_handgrenade_state_net; + int mode_tempstate; + int mode_tempstate_net; #ifdef CLIENT /* External model */ @@ -283,7 +283,7 @@ player::ReceiveEntity(float new) ammo_gauss_volume = readbyte(); ammo_egon_state = readbyte(); ammo_rpg_state = readbyte(); - ammo_handgrenade_state = readbyte(); + mode_tempstate = readbyte(); } if (fl & PLAYER_AMMO1 || fl & PLAYER_AMMO2 || fl & PLAYER_AMMO3) @@ -328,7 +328,7 @@ player::PredictPreFrame(void) ammo_gauss_volume_net = ammo_gauss_volume; ammo_egon_state_net = ammo_egon_state; ammo_rpg_state_net = ammo_rpg_state; - ammo_handgrenade_state_net = ammo_handgrenade_state; + mode_tempstate_net = mode_tempstate; } /* @@ -367,7 +367,7 @@ player::PredictPostFrame(void) ammo_gauss_volume = ammo_gauss_volume_net; ammo_egon_state = ammo_egon_state_net; ammo_rpg_state = ammo_rpg_state_net; - ammo_handgrenade_state = ammo_handgrenade_state_net; + mode_tempstate = mode_tempstate_net; } #else @@ -512,7 +512,7 @@ player::EvaluateEntity(void) if (ammo_rpg_state != ammo_rpg_state_net) { SendFlags |= PLAYER_AMMO3; } - if (ammo_handgrenade_state != ammo_handgrenade_state_net) { + if (mode_tempstate != mode_tempstate_net) { SendFlags |= PLAYER_AMMO3; } @@ -559,7 +559,7 @@ player::EvaluateEntity(void) ammo_gauss_volume_net = ammo_gauss_volume; ammo_egon_state_net = ammo_egon_state; ammo_rpg_state_net = ammo_rpg_state; - ammo_handgrenade_state_net = ammo_handgrenade_state; + mode_tempstate_net = mode_tempstate; } /* @@ -664,7 +664,7 @@ player::SendEntity(entity ePEnt, float fChanged) WriteByte(MSG_ENTITY, ammo_gauss_volume); WriteByte(MSG_ENTITY, ammo_egon_state); WriteByte(MSG_ENTITY, ammo_rpg_state); - WriteByte(MSG_ENTITY, ammo_handgrenade_state); + WriteByte(MSG_ENTITY, mode_tempstate); } return TRUE; diff --git a/valve/src/shared/w_handgrenade.qc b/valve/src/shared/w_handgrenade.qc index b6377c6b..69c8b73b 100644 --- a/valve/src/shared/w_handgrenade.qc +++ b/valve/src/shared/w_handgrenade.qc @@ -134,6 +134,9 @@ void w_handgrenade_throw(void) void w_handgrenade_draw(void) { #ifdef CLIENT + player pl = (player)self; + pl.mode_tempstate = 0; + Weapons_SetModel("models/v_grenade.mdl"); Weapons_ViewAnimation(HANDGRENADE_DRAW); #endif @@ -151,7 +154,7 @@ void w_handgrenade_primary(void) } /* We're abusing this network variable for the holding check */ - if (pl.ammo_handgrenade_state > 0) { + if (pl.mode_tempstate > 0) { return; } @@ -164,7 +167,7 @@ void w_handgrenade_primary(void) Weapons_ViewAnimation(HANDGRENADE_PULLPIN); #endif - pl.ammo_handgrenade_state = 1; + pl.mode_tempstate = 1; pl.w_attack_next = 0.5f; pl.w_idle_next = 0.5f; } @@ -186,17 +189,17 @@ void w_handgrenade_release(void) return; } - if (pl.ammo_handgrenade_state == 1) { + if (pl.mode_tempstate == 1) { #ifdef CLIENT Weapons_ViewAnimation(HANDGRENADE_THROW1); #else w_handgrenade_throw(); #endif pl.ammo_handgrenade--; - pl.ammo_handgrenade_state = 2; + pl.mode_tempstate = 2; pl.w_attack_next = 1.0f; pl.w_idle_next = 0.5f; - } else if (pl.ammo_handgrenade_state == 2) { + } else if (pl.mode_tempstate == 2) { #ifdef CLIENT Weapons_ViewAnimation(HANDGRENADE_DRAW); #else @@ -206,7 +209,7 @@ void w_handgrenade_release(void) #endif pl.w_attack_next = 0.5f; pl.w_idle_next = 0.5f; - pl.ammo_handgrenade_state = 0; + pl.mode_tempstate = 0; } else { int r = (float)input_sequence % 8; if (r == 1) {