mirror of
https://github.com/XLabsProject/s1x-client.git
synced 2023-08-02 15:02:12 +02:00
Add g_speed
This commit is contained in:
parent
bdd3b8a688
commit
16034e7584
@ -81,6 +81,23 @@ namespace gameplay
|
||||
a.jmp(0x1402D5A6A);
|
||||
});
|
||||
|
||||
const auto client_think_real_stub = utils::hook::assemble([](utils::hook::assembler& a)
|
||||
{
|
||||
a.push(rax);
|
||||
|
||||
a.mov(rax, qword_ptr(reinterpret_cast<int64_t>(&dvars::g_speed)));
|
||||
a.mov(eax, dword_ptr(rax, 0x10));
|
||||
a.mov(word_ptr(rbx, 0x38), ax);
|
||||
|
||||
a.pop(rax);
|
||||
|
||||
// Game code hook skipped
|
||||
a.movzx(eax, word_ptr(rbx, 0x3C));
|
||||
a.add(eax, dword_ptr(rbx, 0x48));
|
||||
|
||||
a.jmp(0x1402D6A9C);
|
||||
});
|
||||
|
||||
void pm_player_trace_stub(void* pm, game::trace_t* results, const float* start,
|
||||
const float* end, const game::Bounds* bounds, int pass_entity_num, int content_mask)
|
||||
{
|
||||
@ -140,6 +157,12 @@ namespace gameplay
|
||||
utils::hook::jump(0x1402D5A5D, client_end_frame_stub, true);
|
||||
utils::hook::nop(0x1402D5A69, 1); // Nop skipped opcode
|
||||
|
||||
// Choosing the following min/max because the game would truncate larger values
|
||||
dvars::g_speed = game::Dvar_RegisterInt("g_speed", 190,
|
||||
std::numeric_limits<short>::min(), std::numeric_limits<short>::max(), game::DVAR_FLAG_REPLICATED, "Player speed");
|
||||
utils::hook::jump(0x1402D6A8C, client_think_real_stub, true);
|
||||
utils::hook::nop(0x1402D6A98, 4); // Nop skipped opcode
|
||||
|
||||
dvars::g_elevators = game::Dvar_RegisterBool("g_elevators", false,
|
||||
game::DVAR_FLAG_REPLICATED, "Enable elevators");
|
||||
utils::hook::call(0x140146134, pm_player_trace_stub);
|
||||
|
@ -22,6 +22,7 @@ namespace dvars
|
||||
|
||||
game::dvar_t* pm_bouncing = nullptr;
|
||||
game::dvar_t* g_gravity = nullptr;
|
||||
game::dvar_t* g_speed = nullptr;
|
||||
game::dvar_t* g_elevators = nullptr;
|
||||
|
||||
game::dvar_t* player_sustainAmmo = nullptr;
|
||||
|
@ -21,6 +21,7 @@ namespace dvars
|
||||
|
||||
extern game::dvar_t* pm_bouncing;
|
||||
extern game::dvar_t* g_gravity;
|
||||
extern game::dvar_t* g_speed;
|
||||
extern game::dvar_t* g_elevators;
|
||||
|
||||
extern game::dvar_t* player_sustainAmmo;
|
||||
|
Loading…
Reference in New Issue
Block a user