mirror of
https://github.com/diamante0018/BlackOpsPlugin.git
synced 2025-04-21 10:45:43 +00:00
Add dvar
This commit is contained in:
parent
cfc8bc2e9f
commit
01359b0f00
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user