BG_WeaponRecoilMultiplier
This commit is contained in:
parent
353c36cf46
commit
1800341b95
@ -12,6 +12,7 @@ namespace Components
|
|||||||
const Game::dvar_t* PlayerMovement::BGPlayerEjection;
|
const Game::dvar_t* PlayerMovement::BGPlayerEjection;
|
||||||
const Game::dvar_t* PlayerMovement::BGPlayerCollision;
|
const Game::dvar_t* PlayerMovement::BGPlayerCollision;
|
||||||
const Game::dvar_t* PlayerMovement::BGClimbAnything;
|
const Game::dvar_t* PlayerMovement::BGClimbAnything;
|
||||||
|
const Game::dvar_t* PlayerMovement::BGRecoilMultiplier;
|
||||||
const Game::dvar_t* PlayerMovement::CGNoclipScaler;
|
const Game::dvar_t* PlayerMovement::CGNoclipScaler;
|
||||||
const Game::dvar_t* PlayerMovement::CGUfoScaler;
|
const Game::dvar_t* PlayerMovement::CGUfoScaler;
|
||||||
const Game::dvar_t* PlayerMovement::PlayerSpectateSpeedScale;
|
const Game::dvar_t* PlayerMovement::PlayerSpectateSpeedScale;
|
||||||
@ -273,6 +274,33 @@ namespace Components
|
|||||||
return PlayerSpectateSpeedScale;
|
return PlayerSpectateSpeedScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlayerMovement::BG_WeaponFireRecoil_Stub(
|
||||||
|
void* ps,
|
||||||
|
float* recoilSpeed,
|
||||||
|
float* kickAVel,
|
||||||
|
unsigned int* holdrand,
|
||||||
|
Game::PlayerHandIndex hand
|
||||||
|
)
|
||||||
|
{
|
||||||
|
float adjustedRecoilSpeed[3]{};
|
||||||
|
float adjustedKick[3]{};
|
||||||
|
|
||||||
|
|
||||||
|
Utils::Hook::Call<void(void*, float*, float*, unsigned int*, Game::PlayerHandIndex)>(0x4A5FE0)(
|
||||||
|
ps,
|
||||||
|
adjustedRecoilSpeed,
|
||||||
|
adjustedKick,
|
||||||
|
holdrand,
|
||||||
|
hand
|
||||||
|
);
|
||||||
|
|
||||||
|
for (size_t axis = 0; axis < 3; axis++)
|
||||||
|
{
|
||||||
|
recoilSpeed [axis] = adjustedRecoilSpeed[axis] * BGRecoilMultiplier->current.value;
|
||||||
|
kickAVel [axis] = adjustedKick[axis] * BGRecoilMultiplier->current.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PlayerMovement::RegisterMovementDvars()
|
void PlayerMovement::RegisterMovementDvars()
|
||||||
{
|
{
|
||||||
PlayerDuckedSpeedScale = Game::Dvar_RegisterFloat("player_duckedSpeedScale",
|
PlayerDuckedSpeedScale = Game::Dvar_RegisterFloat("player_duckedSpeedScale",
|
||||||
@ -313,8 +341,13 @@ namespace Components
|
|||||||
|
|
||||||
BGClimbAnything = Game::Dvar_RegisterBool("bg_climbAnything",
|
BGClimbAnything = Game::Dvar_RegisterBool("bg_climbAnything",
|
||||||
false, Game::DVAR_CODINFO, "Treat any surface as a ladder");
|
false, Game::DVAR_CODINFO, "Treat any surface as a ladder");
|
||||||
|
|
||||||
|
BGRecoilMultiplier = Game::Dvar_RegisterFloat("bg_recoilMultiplier",
|
||||||
|
1.0f, 0.0f, 1000.0f, Game::DVAR_CODINFO,
|
||||||
|
"The scale applied to the player recoil when firing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PlayerMovement::PlayerMovement()
|
PlayerMovement::PlayerMovement()
|
||||||
{
|
{
|
||||||
AssertOffset(Game::playerState_s, eFlags, 0xB0);
|
AssertOffset(Game::playerState_s, eFlags, 0xB0);
|
||||||
@ -374,6 +407,9 @@ namespace Components
|
|||||||
Utils::Hook(0x570020, PM_CrashLand_Stub, HOOK_CALL).install()->quick(); // Vec3Scale
|
Utils::Hook(0x570020, PM_CrashLand_Stub, HOOK_CALL).install()->quick(); // Vec3Scale
|
||||||
Utils::Hook(0x4E9889, Jump_Check_Stub, HOOK_JUMP).install()->quick();
|
Utils::Hook(0x4E9889, Jump_Check_Stub, HOOK_JUMP).install()->quick();
|
||||||
|
|
||||||
|
Utils::Hook(0x44D90B, BG_WeaponFireRecoil_Stub, HOOK_CALL).install()->quick();
|
||||||
|
Utils::Hook(0x4FB2D7, BG_WeaponFireRecoil_Stub, HOOK_CALL).install()->quick();
|
||||||
|
|
||||||
GSC::Script::AddMethod("IsSprinting", GScr_IsSprinting);
|
GSC::Script::AddMethod("IsSprinting", GScr_IsSprinting);
|
||||||
|
|
||||||
RegisterMovementDvars();
|
RegisterMovementDvars();
|
||||||
|
@ -17,6 +17,7 @@ namespace Components
|
|||||||
static const Game::dvar_t* BGPlayerEjection;
|
static const Game::dvar_t* BGPlayerEjection;
|
||||||
static const Game::dvar_t* BGPlayerCollision;
|
static const Game::dvar_t* BGPlayerCollision;
|
||||||
static const Game::dvar_t* BGClimbAnything;
|
static const Game::dvar_t* BGClimbAnything;
|
||||||
|
static const Game::dvar_t* BGRecoilMultiplier;
|
||||||
static const Game::dvar_t* CGNoclipScaler;
|
static const Game::dvar_t* CGNoclipScaler;
|
||||||
static const Game::dvar_t* CGUfoScaler;
|
static const Game::dvar_t* CGUfoScaler;
|
||||||
static const Game::dvar_t* PlayerSpectateSpeedScale;
|
static const Game::dvar_t* PlayerSpectateSpeedScale;
|
||||||
@ -53,6 +54,8 @@ namespace Components
|
|||||||
|
|
||||||
static const Game::dvar_t* Dvar_RegisterSpectateSpeedScale(const char* dvarName, float value, float min, float max, unsigned __int16 flags, const char* description);
|
static const Game::dvar_t* Dvar_RegisterSpectateSpeedScale(const char* dvarName, float value, float min, float max, unsigned __int16 flags, const char* description);
|
||||||
|
|
||||||
|
static void BG_WeaponFireRecoil_Stub(void* ps, float* recoilSpeed, float* kickAVel, unsigned int* holdrand, Game::PlayerHandIndex hand);
|
||||||
|
|
||||||
static void RegisterMovementDvars();
|
static void RegisterMovementDvars();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user