From d97482640a3e87edff05094926e609c3ced7d28c Mon Sep 17 00:00:00 2001 From: Sergey Shorokhov Date: Wed, 21 Dec 2022 22:52:46 +0300 Subject: [PATCH] fix: do not overwrite `CC4::Think()` Co-authored-by: Garey27 Co-authored-by: s1lentq --- regamedll/dlls/weapons.h | 2 +- regamedll/dlls/wpn_shared/wpn_c4.cpp | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index 3726e28f..b352f8ef 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -870,7 +870,6 @@ public: virtual BOOL Deploy(); virtual void Holster(int skiplocal); virtual void AttachToPlayer(CBasePlayer* pPlayer); - virtual void Think(); virtual float GetMaxSpeed(); virtual int iItemSlot() { return C4_SLOT; } virtual void PrimaryAttack(); @@ -884,6 +883,7 @@ public: #endif } + void EXPORT TrackPlayerHeldPosition(); Vector GetLastValidHeldPosition() const { return m_vecLastValidPlayerHeldPosition; } public: diff --git a/regamedll/dlls/wpn_shared/wpn_c4.cpp b/regamedll/dlls/wpn_shared/wpn_c4.cpp index 87b49a30..89851117 100644 --- a/regamedll/dlls/wpn_shared/wpn_c4.cpp +++ b/regamedll/dlls/wpn_shared/wpn_c4.cpp @@ -388,7 +388,7 @@ void CC4::AttachToPlayer(CBasePlayer* pPlayer) CBasePlayerWeapon::AttachToPlayer(pPlayer); #ifdef REGAMEDLL_ADD - SetThink(&CC4::Think); + SetThink(&CC4::TrackPlayerHeldPosition); pev->nextthink = gpGlobals->time + WEAPON_C4_UPDATE_LAST_VALID_PLAYER_HELD_POSITION_INTERVAL; if (pPlayer->IsPlayer() && pPlayer->IsAlive()) @@ -399,9 +399,8 @@ void CC4::AttachToPlayer(CBasePlayer* pPlayer) #endif } -void CC4::Think() +void CC4::TrackPlayerHeldPosition() { -#ifdef REGAMEDLL_ADD pev->nextthink = gpGlobals->time + WEAPON_C4_UPDATE_LAST_VALID_PLAYER_HELD_POSITION_INTERVAL; // If the bomb is held by an alive player standing on the ground, then we can use this @@ -412,7 +411,4 @@ void CC4::Think() entvars_t* pevPlayer = m_pPlayer->pev; m_vecLastValidPlayerHeldPosition = pevPlayer->origin + pevPlayer->mins; } -#else - CBasePlayerWeapon::Think(); -#endif }