implement pm_bouncing & g_gravity
This commit is contained in:
parent
c1bdbe8526
commit
007e947611
@ -32,6 +32,47 @@ namespace gameplay
|
||||
utils::hook::invoke<void>(0x1401E2D00, ps, pml);
|
||||
}
|
||||
}
|
||||
|
||||
const auto pm_bouncing_stub_mp = utils::hook::assemble([](utils::hook::assembler& a)
|
||||
{
|
||||
const auto no_bounce = a.newLabel();
|
||||
const auto loc_1401EAF9D = a.newLabel();
|
||||
|
||||
a.push(rax);
|
||||
|
||||
a.mov(rax, qword_ptr(reinterpret_cast<int64_t>(&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(0x1401EB000);
|
||||
|
||||
a.bind(no_bounce);
|
||||
a.cmp(dword_ptr(rsp, 0x70), 0);
|
||||
a.jnz(loc_1401EAF9D);
|
||||
a.jmp(0x1401EAFF1);
|
||||
|
||||
a.bind(loc_1401EAF9D);
|
||||
a.jmp(0x1401EAF9D);
|
||||
});
|
||||
|
||||
const auto client_end_frame_stub = utils::hook::assemble([](utils::hook::assembler& a)
|
||||
{
|
||||
a.push(rax);
|
||||
|
||||
a.mov(rax, qword_ptr(reinterpret_cast<int64_t>(&dvars::g_gravity)));
|
||||
a.mov(eax, dword_ptr(rax, 0x10));
|
||||
a.mov(word_ptr(rbx, 0x34), ax);
|
||||
|
||||
a.pop(rax);
|
||||
|
||||
// Game code hook skipped
|
||||
a.mov(eax, dword_ptr(rbx, 0x494C));
|
||||
a.mov(rdi, rcx);
|
||||
|
||||
a.jmp(0x140322F82);
|
||||
});
|
||||
}
|
||||
|
||||
class component final : public component_interface
|
||||
@ -49,6 +90,16 @@ namespace gameplay
|
||||
|
||||
utils::hook::call(0x1401E490F, pm_crashland_stub);
|
||||
jump_enableFallDamage = dvars::register_bool("jump_enableFallDamage", true, game::DVAR_FLAG_REPLICATED, "Enable fall damage");
|
||||
|
||||
// Implement bouncing dvar
|
||||
dvars::pm_bouncing = dvars::register_bool("pm_bouncing", false,
|
||||
game::DVAR_FLAG_REPLICATED, "Enable bouncing");
|
||||
utils::hook::jump(0x1401EAFE4, pm_bouncing_stub_mp, true);
|
||||
|
||||
dvars::g_gravity = dvars::register_int("g_gravity", 800, std::numeric_limits<short>::min(),
|
||||
std::numeric_limits<short>::max(), game::DVAR_FLAG_REPLICATED, "");
|
||||
utils::hook::jump(0x140322F72, client_end_frame_stub, true);
|
||||
utils::hook::nop(0x140322F68, 1); // Nop skipped opcode
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -27,6 +27,10 @@ namespace dvars
|
||||
game::dvar_t* r_fullbright;
|
||||
game::dvar_t* r_chams;
|
||||
|
||||
game::dvar_t* g_gravity = nullptr;
|
||||
|
||||
game::dvar_t* pm_bouncing = nullptr;
|
||||
|
||||
game::dvar_t* cg_legacyCrashHandling;
|
||||
|
||||
std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain)
|
||||
|
@ -30,6 +30,10 @@ namespace dvars
|
||||
extern game::dvar_t* r_fullbright;
|
||||
extern game::dvar_t* r_chams;
|
||||
|
||||
extern game::dvar_t* g_gravity;
|
||||
|
||||
extern game::dvar_t* pm_bouncing;
|
||||
|
||||
extern game::dvar_t* cg_legacyCrashHandling;
|
||||
|
||||
extern std::vector<dvar_info> dvar_list;
|
||||
|
Loading…
Reference in New Issue
Block a user