diff --git a/src/client/component/gameplay.cpp b/src/client/component/gameplay.cpp index 696f8a2..51ccce6 100644 --- a/src/client/component/gameplay.cpp +++ b/src/client/component/gameplay.cpp @@ -28,6 +28,30 @@ namespace gameplay (results, start, end, bounds, capsule, contents, origin, angles); // CM_TransformedCapsuleTrace } } + + const auto pm_bouncing_stub_mp = utils::hook::assemble([](utils::hook::assembler& a) + { + const auto no_bounce = a.newLabel(); + const auto loc_14014DF48 = a.newLabel(); + + a.push(rax); + + a.mov(rax, qword_ptr(reinterpret_cast(&dvars::pm_bouncing))); + a.mov(al, byte_ptr(rax, 0x10)); + a.cmp(byte_ptr(rbp, -0x2D), al); + + a.pop(rax); + a.jz(no_bounce); + a.jmp(0x14014DFB0); + + a.bind(no_bounce); + a.cmp(dword_ptr(rsp, 0x70), 0); + a.jnz(loc_14014DF48); + a.jmp(0x14014DFA2); + + a.bind(loc_14014DF48); + a.jmp(0x14014DF48); + }); } class component final : public component_interface @@ -45,6 +69,11 @@ namespace gameplay dvars::g_playerCollision = game::Dvar_RegisterBool("g_playerCollision", true, game::DVAR_FLAG_REPLICATED, "Flag whether player collision is on or off"); utils::hook::call(0x1404563DA, cm_transformed_capsule_trace_stub); // SV_ClipMoveToEntity utils::hook::call(0x1401F7F8F, cm_transformed_capsule_trace_stub); // CG_ClipMoveToEntity + + // Implement bouncing dvar + utils::hook::jump(0x14014DF91, pm_bouncing_stub_mp, true); + dvars::pm_bouncing = game::Dvar_RegisterBool("pm_bouncing", false, + game::DvarFlags::DVAR_FLAG_REPLICATED, "Enable bouncing"); } }; } diff --git a/src/client/game/dvars.cpp b/src/client/game/dvars.cpp index 1cf292e..1d825b6 100644 --- a/src/client/game/dvars.cpp +++ b/src/client/game/dvars.cpp @@ -20,6 +20,8 @@ namespace dvars game::dvar_t* g_playerEjection = nullptr; game::dvar_t* g_playerCollision = nullptr; + game::dvar_t* pm_bouncing = nullptr; + game::dvar_t* r_fullbright = nullptr; std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain) diff --git a/src/client/game/dvars.hpp b/src/client/game/dvars.hpp index 37c5847..17e58bd 100644 --- a/src/client/game/dvars.hpp +++ b/src/client/game/dvars.hpp @@ -20,6 +20,8 @@ namespace dvars extern game::dvar_t* g_playerCollision; extern game::dvar_t* g_playerEjection; + extern game::dvar_t* pm_bouncing; + extern game::dvar_t* r_fullbright; std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain);