From c5b04ca60d4f9122dff7fa6fad9351d6064f3350 Mon Sep 17 00:00:00 2001 From: khang Date: Wed, 21 Feb 2024 10:59:11 -0500 Subject: [PATCH] use pmove->movetype instead of HwDLL's noclip_anglehack --- BunnymodXT/modules/HwDLL.cpp | 6 ------ BunnymodXT/modules/ServerDLL.cpp | 9 +++++---- BunnymodXT/modules/ServerDLL.hpp | 1 + 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/BunnymodXT/modules/HwDLL.cpp b/BunnymodXT/modules/HwDLL.cpp index 25b9d3d7..cd4c39fe 100644 --- a/BunnymodXT/modules/HwDLL.cpp +++ b/BunnymodXT/modules/HwDLL.cpp @@ -1324,12 +1324,6 @@ void HwDLL::FindStuff() EngineDevMsg("[hw dll] Found g_sv_delta at %p.\n", g_sv_delta); else EngineDevWarning("[hw dll] Could not find g_sv_delta.\n"); - - noclip_anglehack = reinterpret_cast(MemUtils::GetSymbolAddress(m_Handle, "noclip_anglehack")); - if (noclip_anglehack) - EngineDevMsg("[hw dll] Found noclip_anglehack at %p.\n", noclip_anglehack); - else - EngineDevWarning("[hw dll] Could not find noclip_anglehack.\n"); } else { diff --git a/BunnymodXT/modules/ServerDLL.cpp b/BunnymodXT/modules/ServerDLL.cpp index c977cef9..2511bd8e 100644 --- a/BunnymodXT/modules/ServerDLL.cpp +++ b/BunnymodXT/modules/ServerDLL.cpp @@ -312,6 +312,7 @@ void ServerDLL::Clear() offBhopcap = 0; offMaxspeed = 0; offClientMaxspeed = 0; + offMoveType = 0; pBhopcapWindows = 0; pCZDS_Velocity_Byte = 0; pCBasePlayer__Jump_OldButtons_Check_Byte = 0; @@ -412,6 +413,7 @@ void ServerDLL::FindStuff() offBasevelocity = 0x74; offMaxspeed = 0x1f4; offClientMaxspeed = 0x1f8; + offMoveType = 0xdc; }); auto fPM_Jump = FindFunctionAsync( @@ -2811,12 +2813,11 @@ HOOK_DEF_2(ServerDLL, void, __cdecl, PM_Move, struct playermove_s*, ppmove, int, usercmd_t *cmd = reinterpret_cast(pmove + offCmd); float *maxspeed = reinterpret_cast(pmove + offMaxspeed); float *clientmaxspeed = reinterpret_cast(pmove + offClientMaxspeed); + int *movetype = reinterpret_cast(pmove + offMoveType); auto start_origin = Vector(origin); - auto &hw = HwDLL::GetInstance(); - - if (hw.noclip_anglehack && *hw.noclip_anglehack) { + if (*movetype == MOVETYPE_NOCLIP) { auto new_maxspeed = CVars::bxt_ch_noclip_speed.GetFloat(); ch_noclip_vel_prev_maxspeed = *maxspeed; @@ -2839,7 +2840,7 @@ HOOK_DEF_2(ServerDLL, void, __cdecl, PM_Move, struct playermove_s*, ppmove, int, */ CustomTriggers::Update(start_origin, Vector(origin), (*flags & FL_DUCKING) != 0); - if (hw.noclip_anglehack && *hw.noclip_anglehack) { + if (*movetype == MOVETYPE_NOCLIP) { *maxspeed = ch_noclip_vel_prev_maxspeed; *clientmaxspeed = ch_noclip_vel_prev_clientmaxspeed; } diff --git a/BunnymodXT/modules/ServerDLL.hpp b/BunnymodXT/modules/ServerDLL.hpp index 6d2f9fc7..5e201f3a 100644 --- a/BunnymodXT/modules/ServerDLL.hpp +++ b/BunnymodXT/modules/ServerDLL.hpp @@ -176,6 +176,7 @@ class ServerDLL : public IHookableDirFilter ptrdiff_t offBasevelocity; ptrdiff_t offMaxspeed; ptrdiff_t offClientMaxspeed; + ptrdiff_t offMoveType; void *pGlobalState;