From a483cad84c548aa42734770e23e678f157a9c444 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Mon, 13 Nov 2023 10:46:42 -0800 Subject: [PATCH] Remove code that's no longer being run --- src/server/player.qc | 83 ----------------------------------------- src/shared/player.qc | 64 +++++++++++++++---------------- src/shared/w_shotgun.qc | 78 ++++++++++++++++++++------------------ 3 files changed, 74 insertions(+), 151 deletions(-) diff --git a/src/server/player.qc b/src/server/player.qc index 191054d..68edb08 100644 --- a/src/server/player.qc +++ b/src/server/player.qc @@ -14,89 +14,6 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* -==================== -UseWorkaround -==================== -*/ -void -UseWorkaround(entity eTarget) -{ - eActivator = self; - entity eOldSelf = self; - self = eTarget; - self.PlayerUse(); - self = eOldSelf; -} - -void -UnUseWorkaround(entity eTarget) -{ - eActivator = self; - entity eOldSelf = self; - self = eTarget; - if (self.PlayerUseUnpressed) - self.PlayerUseUnpressed(); - self = eOldSelf; -} - -/* -==================== -Player_UseDown -==================== -*/ -void -Player_UseDown(void) -{ - vector vecSrc; - player pl = (player)self; - - if (self.health <= 0) { - return; - } else if (!(self.flags & FL_USE_RELEASED)) { - return; - } - - makevectors(self.v_angle); - vecSrc = self.origin + self.view_ofs; - - int oldmask = self.hitcontentsmaski; - self.hitcontentsmaski = CONTENTBITS_POINTSOLID; - traceline(vecSrc, vecSrc + (v_forward * 64), MOVE_HITMODEL, self); - self.hitcontentsmaski = oldmask; - - - if (trace_ent.PlayerUse) { - self.flags &= ~FL_USE_RELEASED; - - UseWorkaround(trace_ent); - pl.last_used = trace_ent; - - /* Some entities want to support Use spamming */ - if (!(self.flags & FL_USE_RELEASED)) { - sound(self, CHAN_ITEM, "common/wpn_select.wav", 0.25, ATTN_IDLE); - } - } else { - sound(self, CHAN_ITEM, "common/wpn_denyselect.wav", 0.25, ATTN_IDLE); - self.flags &= ~FL_USE_RELEASED; - } -} - -/* -==================== -Player_UseUp -==================== -*/ -void -Player_UseUp(void) { - player pl = (player)self; - if (!(self.flags & FL_USE_RELEASED)) { - UnUseWorkaround(pl.last_used); - pl.last_used = world; - self.flags |= FL_USE_RELEASED; - } -} - void Weapons_Draw(player pl); void diff --git a/src/shared/player.qc b/src/shared/player.qc index e14d352..78d214c 100644 --- a/src/shared/player.qc +++ b/src/shared/player.qc @@ -85,6 +85,38 @@ class player:NSClientPlayer #endif }; +void +player::player(void) +{ + anim_top = 0; + anim_top_time = 0; + anim_top_delay = 0; + anim_bottom = 0; + anim_bottom_time = 0; + glock_mag = 0; + mp5_mag = 0; + python_mag = 0; + shotgun_mag = 0; + crossbow_mag = 0; + rpg_mag = 0; + satchel_chg = 0; + ammo_9mm = 0; + ammo_357 = 0; + ammo_buckshot = 0; + ammo_bolt = 0; + ammo_rocket = 0; + ammo_uranium = 0; + ammo_handgrenade = 0; + ammo_satchel = 0; + ammo_tripmine = 0; + ammo_snark = 0; + ammo_hornet = 0; + ammo_m203_grenade = 0; + ammo_gauss_volume = 0; + ammo_rpg_state = 0; + mode_tempstate = 0; +} + void Animation_PlayerUpdate(player); void Animation_TimerUpdate(player, float); @@ -598,35 +630,3 @@ player::SendEntity(entity ePEnt, float flChanged) return (1); } #endif - -void -player::player(void) -{ - anim_top = 0; - anim_top_time = 0; - anim_top_delay = 0; - anim_bottom = 0; - anim_bottom_time = 0; - glock_mag = 0; - mp5_mag = 0; - python_mag = 0; - shotgun_mag = 0; - crossbow_mag = 0; - rpg_mag = 0; - satchel_chg = 0; - ammo_9mm = 0; - ammo_357 = 0; - ammo_buckshot = 0; - ammo_bolt = 0; - ammo_rocket = 0; - ammo_uranium = 0; - ammo_handgrenade = 0; - ammo_satchel = 0; - ammo_tripmine = 0; - ammo_snark = 0; - ammo_hornet = 0; - ammo_m203_grenade = 0; - ammo_gauss_volume = 0; - ammo_rpg_state = 0; - mode_tempstate = 0; -} diff --git a/src/shared/w_shotgun.qc b/src/shared/w_shotgun.qc index 77068df..17d9604 100644 --- a/src/shared/w_shotgun.qc +++ b/src/shared/w_shotgun.qc @@ -47,6 +47,7 @@ void w_shotgun_ejectshell(void) if (other == world) Sound_Play(self, CHAN_BODY, "modelevent_shotgunshell.land"); } + entity eShell = spawn(); setmodel(eShell, "models/shotgunshell.mdl"); eShell.solid = SOLID_BBOX; @@ -181,7 +182,7 @@ w_shotgun_primary(player pl) return; } - if (pl.w_attack_next) { + if (pl.w_attack_next > 0.0f) { w_shotgun_release(pl); return; } @@ -247,7 +248,7 @@ w_shotgun_secondary(player pl) return; } - if (pl.w_attack_next) { + if (pl.w_attack_next > 0.0f) { w_shotgun_release(pl); return; } @@ -310,7 +311,44 @@ w_shotgun_release(player pl) return; } - if (pl.mode_tempstate == SHOTTY_IDLE) { + switch (pl.mode_tempstate) { + case SHOTTY_RELOAD_START: + Weapons_ViewAnimation(pl, SHOTGUN_START_RELOAD); + pl.mode_tempstate = SHOTTY_RELOAD; + pl.w_idle_next = 0.65f; + break; + case SHOTTY_RELOAD: + Weapons_ViewAnimation(pl, SHOTGUN_RELOAD); + pl.shotgun_mag++; + pl.ammo_buckshot--; +#ifdef SERVER + Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.reload"); +#endif + if (pl.ammo_buckshot <= 0 || pl.shotgun_mag >= 8) { + pl.mode_tempstate = SHOTTY_RELOAD_END; + } + Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_buckshot, pl.mode_tempstate); + pl.w_idle_next = 0.5f; + break; + case SHOTTY_RELOAD_END: + Weapons_ViewAnimation(pl, SHOTGUN_PUMP); +#ifdef SERVER + Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.cock"); +#endif + pl.mode_tempstate = SHOTTY_IDLE; + pl.w_idle_next = 10.0f; + pl.w_attack_next = 0.5f; + break; + case SHOTTY_COCKSOUND: +#ifdef SERVER + Sound_Play(pl, CHAN_AUTO, "weapon_shotgun.cock"); +#endif + pl.mode_tempstate = SHOTTY_IDLE; + pl.w_idle_next = 10.0f; + pl.w_attack_next = 0.5f; + break; + case SHOTTY_IDLE: + default: int r = floor(pseudorandom() * 3.0f); switch (r) { case 1: @@ -326,39 +364,7 @@ w_shotgun_release(player pl) pl.w_idle_next = 2.222222f; break; } - } else if (pl.mode_tempstate == SHOTTY_RELOAD_START) { - Weapons_ViewAnimation(pl, SHOTGUN_START_RELOAD); - pl.mode_tempstate = SHOTTY_RELOAD; - pl.w_idle_next = 0.65f; - } else if (pl.mode_tempstate == SHOTTY_RELOAD) { - Weapons_ViewAnimation(pl, SHOTGUN_RELOAD); - pl.shotgun_mag++; - pl.ammo_buckshot--; -#ifdef SERVER - Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.reload"); -#endif - if (pl.ammo_buckshot <= 0 || pl.shotgun_mag >= 8) { - pl.mode_tempstate = SHOTTY_RELOAD_END; - } - Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_buckshot, pl.mode_tempstate); - pl.w_idle_next = 0.5f; - } else if (pl.mode_tempstate == SHOTTY_RELOAD_END) { - Weapons_ViewAnimation(pl, SHOTGUN_PUMP); -#ifdef SERVER - Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.cock"); -#endif - pl.mode_tempstate = SHOTTY_IDLE; - pl.w_idle_next = 10.0f; - pl.w_attack_next = 0.5f; - } else if (pl.mode_tempstate == SHOTTY_COCKSOUND) { -#ifdef CLIENT - -#else - Sound_Play(pl, CHAN_AUTO, "weapon_shotgun.cock"); -#endif - pl.mode_tempstate = SHOTTY_IDLE; - pl.w_idle_next = 10.0f; - pl.w_attack_next = 0.5f; + break; } }