This commit is contained in:
6arelyFuture 2022-05-13 13:12:46 +01:00
parent cfc8bc2e9f
commit 01359b0f00
No known key found for this signature in database
GPG Key ID: E883E2BC9657D955

View File

@ -6,6 +6,7 @@
namespace gameplay {
namespace {
game::dvar_s** player_sustainAmmo = nullptr;
game::dvar_s** player_sprintStrafeSpeedScale = nullptr;
utils::hook::detour pm_weapon_use_ammo_hook;
@ -14,6 +15,19 @@ void pm_weapon_use_ammo_stub(void* ps, int wp, int amount) {
pm_weapon_use_ammo_hook.invoke<void>(ps, wp, amount);
}
}
void __declspec(naked) bg_get_sprint_strafe_speed_scale_stub() {
__asm {
push eax
mov eax, player_sprintStrafeSpeedScale
mov eax, [eax] // Access pointer
fld dword ptr [eax + 0x18]; // dvar_s.current.value
pop eax
ret
}
}
} // namespace
class component final : public component_interface {
@ -23,6 +37,11 @@ public:
player_sustainAmmo = reinterpret_cast<game::dvar_s**>(0xBCD250);
pm_weapon_use_ammo_hook.create(0x6979B0, &pm_weapon_use_ammo_stub);
}
player_sprintStrafeSpeedScale =
reinterpret_cast<game::dvar_s**>(SELECT(0xC51AE8, 0xBCD18C));
utils::hook::jump(SELECT(0x6344B0, 0x611BC0),
bg_get_sprint_strafe_speed_scale_stub);
}
};
} // namespace gameplay