This commit is contained in:
Skull 2022-10-12 17:11:45 +03:00
parent 5acd807356
commit a6920d08a0
3 changed files with 6 additions and 6 deletions

View File

@ -51,11 +51,11 @@ namespace gameplay
}); });
} }
void* bg_gravity_stub() void* g_gravity_stub()
{ {
return utils::hook::assemble([](utils::hook::assembler& a) return utils::hook::assemble([](utils::hook::assembler& a)
{ {
a.mov(rax, qword_ptr(reinterpret_cast<int64_t>(&dvars::bg_gravity))); a.mov(rax, qword_ptr(reinterpret_cast<int64_t>(&dvars::g_gravity)));
a.mov(eax, dword_ptr(rax, 0x10)); a.mov(eax, dword_ptr(rax, 0x10));
a.mov(dword_ptr(rdi, 0x78), eax); a.mov(dword_ptr(rdi, 0x78), eax);
@ -77,9 +77,9 @@ namespace gameplay
utils::hook::jump(0x70FBB7_b, bg_bounces_stub(), true); utils::hook::jump(0x70FBB7_b, bg_bounces_stub(), true);
// Implement gravity dvar // Implement gravity dvar
dvars::bg_gravity = game::Dvar_RegisterInt("bg_gravity", 800, 0, 1000, game::DVAR_FLAG_REPLICATED, "Game gravity in inches per second squared"); dvars::g_gravity = game::Dvar_RegisterInt("g_gravity", 800, 0, 1000, game::DVAR_FLAG_REPLICATED, "Game gravity in inches per second squared");
utils::hook::nop(0xAFA330_b, 13); utils::hook::nop(0xAFA330_b, 13);
utils::hook::jump(0xAFA330_b, bg_gravity_stub(), true); utils::hook::jump(0xAFA330_b, g_gravity_stub(), true);
dvars::g_playerEjection = game::Dvar_RegisterBool("g_playerEjection", true, game::DVAR_FLAG_REPLICATED, "Flag whether player ejection is on or off"); dvars::g_playerEjection = game::Dvar_RegisterBool("g_playerEjection", true, game::DVAR_FLAG_REPLICATED, "Flag whether player ejection is on or off");
stuck_in_client_hook.create(0xAFD9B0_b, stuck_in_client_stub); stuck_in_client_hook.create(0xAFD9B0_b, stuck_in_client_stub);

View File

@ -26,7 +26,7 @@ namespace dvars
game::dvar_t* r_fullbright = nullptr; game::dvar_t* r_fullbright = nullptr;
game::dvar_t* bg_bounces = nullptr; game::dvar_t* bg_bounces = nullptr;
game::dvar_t* bg_gravity = nullptr; game::dvar_t* g_gravity = nullptr;
game::dvar_t* g_playerEjection = nullptr; game::dvar_t* g_playerEjection = nullptr;

View File

@ -22,7 +22,7 @@ namespace dvars
extern game::dvar_t* r_fullbright; extern game::dvar_t* r_fullbright;
extern game::dvar_t* bg_bounces; extern game::dvar_t* bg_bounces;
extern game::dvar_t* bg_gravity; extern game::dvar_t* g_gravity;
extern game::dvar_t* g_playerEjection; extern game::dvar_t* g_playerEjection;