From 2f8b36c4991f0a1136803fcfc4dc29970aef5d22 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Thu, 14 Jul 2022 21:29:53 -0700 Subject: [PATCH] Get rid of pmove_water.qc and all that. --- base/src/shared/include.src | 1 - base/src/shared/pmove_water.qc | 78 ---------------------------------- src/shared/NSClientPlayer.h | 6 +-- src/shared/player_pmove.qc | 31 +++++++------- 4 files changed, 18 insertions(+), 98 deletions(-) delete mode 100644 base/src/shared/pmove_water.qc diff --git a/base/src/shared/include.src b/base/src/shared/include.src index da60fc85..422cf395 100644 --- a/base/src/shared/include.src +++ b/base/src/shared/include.src @@ -5,7 +5,6 @@ weapon_common.h animations.h animations.qc pmove.qc -pmove_water.qc fx_blood.qc fx_breakmodel.qc diff --git a/base/src/shared/pmove_water.qc b/base/src/shared/pmove_water.qc deleted file mode 100644 index 8cbe5275..00000000 --- a/base/src/shared/pmove_water.qc +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2016-2022 Vera Visions LLC. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -void -GamePMove_WaterMove(player target) -{ - if (target.movetype == MOVETYPE_NOCLIP) { - return; - } - -#ifdef SERVER - if (target.health < 0) { - return; - } - - /* we've just exited water */ - if (target.waterlevel != 3) { - if (target.underwater_time < time) { - Sound_Play(target, CHAN_BODY, "player.gasplight"); - } else if (target.underwater_time < time + 9) { - Sound_Play(target, CHAN_BODY, "player.gaspheavy"); - } - target.underwater_time = time + 12; - } else if (target.underwater_time < time) { - /* we've been underwater... for too long. */ - if (target.pain_time < time) { - Damage_Apply(target, world, 5, 0, DMG_DROWN); - target.pain_time = time + 1; - } - } -#endif - - if (!target.waterlevel){ - if (target.flags & FL_INWATER) { -#ifdef SERVER - Sound_Play(target, CHAN_BODY, "player.waterexit"); -#endif - target.flags &= ~FL_INWATER; - } - return; - } - -#ifdef SERVER - if (target.watertype == CONTENT_LAVA) { - if (target.pain_time < time) { - target.pain_time = time + 0.2; - Damage_Apply(target, world, 10*target.waterlevel, 0, DMG_BURN); - } - } else if (target.watertype == CONTENT_SLIME) { - if (target.pain_time < time) { - target.pain_time = time + 1; - Damage_Apply(target, world, 4*target.waterlevel, 0, DMG_ACID); - } - } -#endif - - if (!(target.flags & FL_INWATER)) { -#ifdef SERVER - Sound_Play(target, CHAN_BODY, "player.waterenter"); - target.pain_time = 0; -#endif - target.flags |= FL_INWATER; - } -} - diff --git a/src/shared/NSClientPlayer.h b/src/shared/NSClientPlayer.h index 8ad2cd1b..e51741c9 100644 --- a/src/shared/NSClientPlayer.h +++ b/src/shared/NSClientPlayer.h @@ -101,9 +101,9 @@ NSClientPlayer:NSClientSpectator int step; float step_time; - float underwater_time; - float underwater_dmg; - float pain_time; + float m_flUnderwaterTime; + //float underwater_dmg; + float m_flPainTime; entity last_used; diff --git a/src/shared/player_pmove.qc b/src/shared/player_pmove.qc index 398b18f5..21e8f1e6 100644 --- a/src/shared/player_pmove.qc +++ b/src/shared/player_pmove.qc @@ -240,17 +240,17 @@ NSClientPlayer::Physics_WaterMove(void) /* we've just exited water */ if (WaterLevel() != 3) { - if (underwater_time < time) { + if (m_flUnderwaterTime < time) { Sound_Play(this, CHAN_BODY, "player.gasplight"); - } else if (underwater_time < time + 9) { + } else if (m_flUnderwaterTime < time + 9) { Sound_Play(this, CHAN_BODY, "player.gaspheavy"); } - underwater_time = time + 12; - } else if (underwater_time < time) { + m_flUnderwaterTime = time + 12; + } else if (m_flUnderwaterTime < time) { /* we've been underwater... for too long. */ - if (pain_time < time) { + if (m_flPainTime < time) { Damage_Apply(this, world, 5, 0, DMG_DROWN); - pain_time = time + 1; + m_flPainTime = time + 1; } } #endif @@ -267,14 +267,14 @@ NSClientPlayer::Physics_WaterMove(void) #ifdef SERVER if (WaterLevel() == CONTENT_LAVA) { - if (pain_time < time) { - pain_time = time + 0.2; - Damage_Apply(this, world, 10 * waterlevel, 0, DMG_BURN); + if (m_flPainTime < time) { + Damage_Apply(this, world, 10 * WaterLevel(), 0, DMG_BURN); + m_flPainTime = time + 0.2; } } else if (WaterLevel() == CONTENT_SLIME) { - if (pain_time < time) { - pain_time = time + 1; - Damage_Apply(this, world, 4 * waterlevel, 0, DMG_ACID); + if (m_flPainTime < time) { + Damage_Apply(this, world, 4 * WaterLevel(), 0, DMG_ACID); + m_flPainTime = time + 1; } } #endif @@ -282,7 +282,7 @@ NSClientPlayer::Physics_WaterMove(void) if (!(GetFlags() & FL_INWATER)) { #ifdef SERVER Sound_Play(this, CHAN_BODY, "player.waterenter"); - pain_time = 0; + m_flPainTime = 0; #endif AddFlags(FL_INWATER); } @@ -347,8 +347,7 @@ NSClientPlayer::Physics_InputPostMove(void) Animation_TimerUpdate((player)this, input_timelength); Animation_PlayerUpdate((player)this); - flags &= ~FL_FROZEN; - + RemoveFlags(FL_FROZEN); ClientInput(); } @@ -417,7 +416,7 @@ NSClientPlayer::Physics_Run(void) dest = src + v_forward * 64; traceline(src, dest, MOVE_NORMAL, this); - flags &= ~FL_ONUSABLE; + RemoveFlags(FL_ONUSABLE); if (trace_ent.identity == 1) { NSEntity foo = (NSEntity)trace_ent; if (foo.PlayerUse) {