diff --git a/src/Components/Modules/Elevators.cpp b/src/Components/Modules/Elevators.cpp index 8195a273..fa1df9fd 100644 --- a/src/Components/Modules/Elevators.cpp +++ b/src/Components/Modules/Elevators.cpp @@ -2,7 +2,7 @@ namespace Components { - Dvar::Var Elevators::SV_Elevators; + Dvar::Var Elevators::BG_Elevators; int Elevators::PM_CorrectAllSolid(Game::pmove_s* pm, Game::pml_t* pml, Game::trace_t* trace) { @@ -13,8 +13,8 @@ namespace Components auto* ps = pm->ps; auto i = 0; - const auto EleSettings = Elevators::SV_Elevators.get(); - while (TRUE) + const auto elevatorSetting = Elevators::BG_Elevators.get(); + while (true) { point[0] = ps->origin[0] + Game::CorrectSolidDeltas[i][0]; point[1] = ps->origin[1] + Game::CorrectSolidDeltas[i][1]; @@ -23,7 +23,7 @@ namespace Components Game::PM_playerTrace(pm, trace, point, point, &pm->bounds, ps->clientNum, pm->tracemask); // If the player wishes to glitch without effort they can do so - if (!trace->startsolid || EleSettings == Elevators::EASY) + if (!trace->startsolid || elevatorSetting == Elevators::EASY) { ps->origin[0] = point[0]; ps->origin[1] = point[1]; @@ -34,7 +34,7 @@ namespace Components // If elevators are disabled we need to check that startsolid is false before proceeding // like later versions of the game do - if (!trace->startsolid || EleSettings >= Elevators::ENABLED) + if (!trace->startsolid || elevatorSetting >= Elevators::ENABLED) { pml->groundTrace.fraction = trace->fraction; pml->groundTrace.normal[0] = trace->normal[0]; @@ -73,13 +73,13 @@ namespace Components return 1; } - void Elevators::PM_TraceStub(Game::pmove_s* pm, Game::trace_t* trace, const float* f3, + void Elevators::PM_Trace_Hk(Game::pmove_s* pm, Game::trace_t* trace, const float* f3, const float* f4, const Game::Bounds* bounds, int a6, int a7) { Game::PM_Trace(pm, trace, f3, f4, bounds, a6, a7); // Allow the player to stand even when there is no headroom - if (Elevators::SV_Elevators.get() == Elevators::EASY) + if (Elevators::BG_Elevators.get() == Elevators::EASY) { trace->allsolid = false; } @@ -112,13 +112,13 @@ namespace Components { static const char* values[] = { - "Disable elevators", - "Enable elevators", - "Enable easy elevators", + "off", + "normal", + "easy", nullptr }; - Elevators::SV_Elevators = Game::Dvar_RegisterEnum("sv_Elevators", values, + Elevators::BG_Elevators = Game::Dvar_RegisterEnum("bg_elevators", values, Elevators::ENABLED, Game::DVAR_FLAG_REPLICATED, "Elevators glitch settings"); }); @@ -126,7 +126,7 @@ namespace Components Utils::Hook(0x57369E, Elevators::PM_CorrectAllSolidStub, HOOK_CALL).install()->quick(); // Place hook in PM_CheckDuck - Utils::Hook(0x570EC5, Elevators::PM_TraceStub, HOOK_CALL).install()->quick(); + Utils::Hook(0x570EC5, Elevators::PM_Trace_Hk, HOOK_CALL).install()->quick(); } Elevators::~Elevators() diff --git a/src/Components/Modules/Elevators.hpp b/src/Components/Modules/Elevators.hpp index ff490a31..02b0b64e 100644 --- a/src/Components/Modules/Elevators.hpp +++ b/src/Components/Modules/Elevators.hpp @@ -10,10 +10,10 @@ namespace Components private: enum ElevatorSettings { DISABLED, ENABLED, EASY }; - static Dvar::Var SV_Elevators; + static Dvar::Var BG_Elevators; static int PM_CorrectAllSolid(Game::pmove_s* move, Game::pml_t* pml, Game::trace_t* trace); static void PM_CorrectAllSolidStub(); - static void PM_TraceStub(Game::pmove_s*, Game::trace_t*, const float*, const float*, const Game::Bounds*, int, int); + static void PM_Trace_Hk(Game::pmove_s*, Game::trace_t*, const float*, const float*, const Game::Bounds*, int, int); }; } diff --git a/src/Game/Structs.hpp b/src/Game/Structs.hpp index 63acd2a4..bad13871 100644 --- a/src/Game/Structs.hpp +++ b/src/Game/Structs.hpp @@ -6985,16 +6985,15 @@ namespace Game TRACE_HITTYPE_GLASS = 4 }; -#pragma pack(push, 1) struct trace_t { float fraction; float normal[3]; int surfaceFlags; int contents; + const char* material; TraceHitType hitType; unsigned __int16 hitId; - float fractionForHitType; unsigned __int16 modelIndex; unsigned __int16 partName; unsigned __int16 partGroup; @@ -7002,7 +7001,8 @@ namespace Game bool startsolid; bool walkable; }; -#pragma pack(pop) + + static_assert(sizeof(trace_t) == 0x2C); struct pmove_s { @@ -7045,6 +7045,8 @@ namespace Game int holdrand; }; + static_assert(sizeof(pml_t) == 0x84); + enum EffectiveStance { PM_EFF_STANCE_DEFAULT = 0,