From bf9ea143333b9829925328e738f5b5778a18cf46 Mon Sep 17 00:00:00 2001 From: FutureRave Date: Mon, 29 Nov 2021 18:22:21 +0000 Subject: [PATCH] One feature at the time --- src/Components/Modules/Elevators.cpp | 70 ---------------------------- src/Components/Modules/Elevators.hpp | 3 -- 2 files changed, 73 deletions(-) diff --git a/src/Components/Modules/Elevators.cpp b/src/Components/Modules/Elevators.cpp index a932782c..38c69282 100644 --- a/src/Components/Modules/Elevators.cpp +++ b/src/Components/Modules/Elevators.cpp @@ -2,68 +2,8 @@ namespace Components { - Game::dvar_t* Elevators::SV_EnableEasyElevators; Game::dvar_t* Elevators::SV_DisableElevators; - __declspec(naked) void Elevators::PM_CorrectAllSolidStub() - { - __asm - { - push ecx - mov ecx, Elevators::SV_EnableEasyElevators - cmp byte ptr [ecx + 16], 1 - pop ecx - - // Always elevate if SV_EnableEasyElevators is set to 1 - je elevate - - // Original code - cmp byte ptr [eax + 0x29], 0 - - // Original code flow - jz elevate - - // Go to conditional check for the loop - push 0x5734FF - retn - - elevate: - // Continue with loop execution - push 0x57353D - retn - } - } - - __declspec(naked) void Elevators::PM_CheckDuckStub() - { - __asm - { - push eax - mov eax, Elevators::SV_EnableEasyElevators - cmp byte ptr [eax + 16], 1 - pop eax - - // Always stand if SV_EnableEasyElevators is set to 1 - je stand - - // Original code - cmp byte ptr [esp + 0x38], 0 - - // Original code flow - jnz noStand - - stand: - // Player is allowed to stand - push 0x570ED4 - retn - - noStand: - // Player will remain ducked - push 0x570EF4 - retn - } - } - __declspec(naked) void Elevators::PM_GroundTraceStub() { __asm @@ -101,21 +41,11 @@ namespace Components { Dvar::OnInit([] { - Elevators::SV_EnableEasyElevators = Game::Dvar_RegisterBool("sv_enableEasyElevators", - false, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED, - "Enable easy elevators for trickshotting"); Elevators::SV_DisableElevators = Game::Dvar_RegisterBool("sv_disableElevators", false, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED, "Disable elevators"); }); - // Hook PM_CorrectAllSolid so we may skip PM_Trace check - Utils::Hook(0x5734F9, Elevators::PM_CorrectAllSolidStub, HOOK_JUMP).install()->quick(); - Utils::Hook::Nop(0x5734FE, 1); - - // Hook PM_CheckDuck so we may skip PM_Trace check - Utils::Hook(0x570ECD, Elevators::PM_CheckDuckStub, HOOK_JUMP).install()->quick(); - // Hook PM_GroundTrace so me way skip PM_CorrectAllSolid (disable elevators) Utils::Hook(0x573689, Elevators::PM_GroundTraceStub, HOOK_JUMP).install()->quick(); } diff --git a/src/Components/Modules/Elevators.hpp b/src/Components/Modules/Elevators.hpp index c01b2c98..73af502a 100644 --- a/src/Components/Modules/Elevators.hpp +++ b/src/Components/Modules/Elevators.hpp @@ -9,11 +9,8 @@ namespace Components ~Elevators(); private: - static Game::dvar_t* SV_EnableEasyElevators; static Game::dvar_t* SV_DisableElevators; - static void PM_CorrectAllSolidStub(); - static void PM_CheckDuckStub(); static void PM_GroundTraceStub(); }; }