Skip to content

Commit

Permalink
use pmove->movetype instead of HwDLL's noclip_anglehack
Browse files Browse the repository at this point in the history
  • Loading branch information
khanghugo committed Mar 15, 2024
1 parent e987a04 commit c5b04ca
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
6 changes: 0 additions & 6 deletions BunnymodXT/modules/HwDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<qboolean*>(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
{
Expand Down
9 changes: 5 additions & 4 deletions BunnymodXT/modules/ServerDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -412,6 +413,7 @@ void ServerDLL::FindStuff()
offBasevelocity = 0x74;
offMaxspeed = 0x1f4;
offClientMaxspeed = 0x1f8;
offMoveType = 0xdc;
});

auto fPM_Jump = FindFunctionAsync(
Expand Down Expand Up @@ -2811,12 +2813,11 @@ HOOK_DEF_2(ServerDLL, void, __cdecl, PM_Move, struct playermove_s*, ppmove, int,
usercmd_t *cmd = reinterpret_cast<usercmd_t*>(pmove + offCmd);
float *maxspeed = reinterpret_cast<float*>(pmove + offMaxspeed);
float *clientmaxspeed = reinterpret_cast<float*>(pmove + offClientMaxspeed);
int *movetype = reinterpret_cast<int*>(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;
Expand All @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions BunnymodXT/modules/ServerDLL.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ class ServerDLL : public IHookableDirFilter
ptrdiff_t offBasevelocity;
ptrdiff_t offMaxspeed;
ptrdiff_t offClientMaxspeed;
ptrdiff_t offMoveType;

void *pGlobalState;

Expand Down

0 comments on commit c5b04ca

Please sign in to comment.