Merge branch 'develop' of https://github.com/h1-mod/h1-mod into develop

This commit is contained in:
Federico Cecchetto 2022-05-05 21:08:02 +02:00
commit 82caaa1185
3 changed files with 21 additions and 0 deletions

View File

@ -88,6 +88,18 @@ namespace gameplay
a.jmp(0x1401EAF9D);
});
const auto g_speed_stub = utils::hook::assemble([](utils::hook::assembler& a)
{
a.mov(rax, qword_ptr(reinterpret_cast<int64_t>(&dvars::g_speed)));
a.mov(eax, dword_ptr(rax, 0x10));
// original code
a.mov(dword_ptr(r14, 0x36), ax);
a.movzx(eax, word_ptr(r14, 0x3A));
a.jmp(0x140323DBC);
});
const auto client_end_frame_stub = utils::hook::assemble([](utils::hook::assembler& a)
{
a.push(rax);
@ -130,6 +142,11 @@ namespace gameplay
"Flag whether player ejection is on or off");
utils::hook::call(0x140323333, stuck_in_client_stub);
utils::hook::nop(0x140323DAD, 15);
utils::hook::jump(0x140323DAD, g_speed_stub, true);
dvars::g_speed = dvars::register_int("g_speed", 190, std::numeric_limits<int>::min(), std::numeric_limits<int>::max(),
game::DVAR_FLAG_REPLICATED, "changes the speed of the player");
// Implement player collision dvar
dvars::g_playerCollision = dvars::register_bool("g_playerCollision", true, game::DVAR_FLAG_REPLICATED,
"Flag whether player collision is on or off");

View File

@ -30,6 +30,8 @@ namespace dvars
game::dvar_t* r_fullbright;
game::dvar_t* r_chams;
game::dvar_t* g_speed = nullptr;
game::dvar_t* g_gravity = nullptr;
game::dvar_t* pm_bouncing = nullptr;

View File

@ -33,6 +33,8 @@ namespace dvars
extern game::dvar_t* r_fullbright;
extern game::dvar_t* r_chams;
extern game::dvar_t* g_speed;
extern game::dvar_t* g_gravity;
extern game::dvar_t* pm_bouncing;