Elevators for trickshotting
This commit is contained in:
parent
b02d7f41ae
commit
ae627d5f8f
@ -105,6 +105,7 @@ namespace Components
|
||||
Loader::Register(new Chat());
|
||||
Loader::Register(new TextRenderer());
|
||||
Loader::Register(new Movement());
|
||||
Loader::Register(new Elevators());
|
||||
|
||||
Loader::Register(new Client());
|
||||
|
||||
|
@ -133,6 +133,7 @@ namespace Components
|
||||
#include "Modules/Chat.hpp"
|
||||
#include "Modules/TextRenderer.hpp"
|
||||
#include "Modules/Movement.hpp"
|
||||
#include "Modules/Elevators.hpp"
|
||||
|
||||
#include "Modules/Gamepad.hpp"
|
||||
#include "Modules/Client.hpp"
|
||||
|
81
src/Components/Modules/Elevators.cpp
Normal file
81
src/Components/Modules/Elevators.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
namespace Components
|
||||
{
|
||||
Game::dvar_t* Elevators::SV_EnableEasyElevators;
|
||||
|
||||
__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
|
||||
|
||||
push 0x5734FF
|
||||
retn
|
||||
|
||||
elevate:
|
||||
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:
|
||||
|
||||
push 0x570ED4
|
||||
retn
|
||||
|
||||
noStand:
|
||||
push 0x570EF4
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
Elevators::Elevators()
|
||||
{
|
||||
Dvar::OnInit([]
|
||||
{
|
||||
Elevators::SV_EnableEasyElevators = Game::Dvar_RegisterBool("sv_enableEasyElevators",
|
||||
false, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED,
|
||||
"Enable easy elevators for trickshotting");
|
||||
});
|
||||
|
||||
Utils::Hook(0x5734F9, Elevators::PM_CorrectAllSolidStub, HOOK_JUMP).install()->quick();
|
||||
Utils::Hook::Nop(0x5734FE, 1);
|
||||
|
||||
Utils::Hook(0x570ECD, Elevators::PM_CheckDuckStub, HOOK_JUMP).install()->quick();
|
||||
}
|
||||
|
||||
Elevators::~Elevators()
|
||||
{
|
||||
}
|
||||
}
|
17
src/Components/Modules/Elevators.hpp
Normal file
17
src/Components/Modules/Elevators.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
namespace Components
|
||||
{
|
||||
class Elevators : public Component
|
||||
{
|
||||
public:
|
||||
Elevators();
|
||||
~Elevators();
|
||||
|
||||
private:
|
||||
static Game::dvar_t* SV_EnableEasyElevators;
|
||||
|
||||
static void PM_CorrectAllSolidStub();
|
||||
static void PM_CheckDuckStub();
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user