[PlayerMovement]: Add more options to bounces dvar (#806)
This commit is contained in:
parent
bd92c47eb9
commit
cda6214d63
@ -116,7 +116,22 @@ namespace Components
|
|||||||
// Do not bounce if BGBounces is 0
|
// Do not bounce if BGBounces is 0
|
||||||
jle noBounce
|
jle noBounce
|
||||||
|
|
||||||
|
push eax
|
||||||
|
|
||||||
|
mov eax, BGBouncesAllAngles
|
||||||
|
mov eax, dword ptr [eax + 0x10]
|
||||||
|
cmp eax, 2
|
||||||
|
|
||||||
|
pop eax
|
||||||
|
|
||||||
|
// Do not apply all angles patch if BGBouncesAllAngles is not set to "all surfaces"
|
||||||
|
jne regularBounce
|
||||||
|
|
||||||
|
push 0x4B1B7D
|
||||||
|
ret
|
||||||
|
|
||||||
// Bounce
|
// Bounce
|
||||||
|
regularBounce:
|
||||||
push 0x4B1B34
|
push 0x4B1B34
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -131,10 +146,12 @@ namespace Components
|
|||||||
// Double bounces
|
// Double bounces
|
||||||
void PlayerMovement::Jump_ClearState_Hk(Game::playerState_s* ps)
|
void PlayerMovement::Jump_ClearState_Hk(Game::playerState_s* ps)
|
||||||
{
|
{
|
||||||
if (BGBounces->current.integer != DOUBLE)
|
if (BGBounces->current.integer == DOUBLE)
|
||||||
{
|
{
|
||||||
Game::Jump_ClearState(ps);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Game::Jump_ClearState(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(naked) void PlayerMovement::PM_ProjectVelocityStub()
|
__declspec(naked) void PlayerMovement::PM_ProjectVelocityStub()
|
||||||
@ -143,19 +160,21 @@ namespace Components
|
|||||||
{
|
{
|
||||||
push eax
|
push eax
|
||||||
mov eax, BGBouncesAllAngles
|
mov eax, BGBouncesAllAngles
|
||||||
cmp byte ptr [eax + 0x10], 1
|
mov eax, dword ptr [eax + 0x10]
|
||||||
|
test eax, eax
|
||||||
pop eax
|
pop eax
|
||||||
|
|
||||||
je bounce
|
je noBounce
|
||||||
|
|
||||||
|
// Force the bounce
|
||||||
|
push 0x417B6F
|
||||||
|
ret
|
||||||
|
|
||||||
|
noBounce:
|
||||||
fstp ST(0)
|
fstp ST(0)
|
||||||
pop esi
|
pop esi
|
||||||
add esp, 0x10
|
add esp, 0x10
|
||||||
ret
|
ret
|
||||||
|
|
||||||
bounce:
|
|
||||||
push 0x417B6F
|
|
||||||
ret
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,9 +257,6 @@ namespace Components
|
|||||||
3.0f, 0.001f, 1000.0f, Game::DVAR_CHEAT | Game::DVAR_CODINFO,
|
3.0f, 0.001f, 1000.0f, Game::DVAR_CHEAT | Game::DVAR_CODINFO,
|
||||||
"The speed at which noclip camera moves");
|
"The speed at which noclip camera moves");
|
||||||
|
|
||||||
BGBouncesAllAngles = Game::Dvar_RegisterBool("bg_bouncesAllAngles",
|
|
||||||
false, Game::DVAR_CODINFO, "Force bounce from all angles");
|
|
||||||
|
|
||||||
BGRocketJump = Dvar::Register<bool>("bg_rocketJump",
|
BGRocketJump = Dvar::Register<bool>("bg_rocketJump",
|
||||||
false, Game::DVAR_CODINFO, "Enable CoD4 rocket jumps");
|
false, Game::DVAR_CODINFO, "Enable CoD4 rocket jumps");
|
||||||
|
|
||||||
@ -270,10 +286,19 @@ namespace Components
|
|||||||
"disabled",
|
"disabled",
|
||||||
"enabled",
|
"enabled",
|
||||||
"double",
|
"double",
|
||||||
nullptr
|
nullptr,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char* bg_bouncesAllAnglesValues[] =
|
||||||
|
{
|
||||||
|
"disabled",
|
||||||
|
"simple",
|
||||||
|
"all surfaces",
|
||||||
|
nullptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
BGBounces = Game::Dvar_RegisterEnum("bg_bounces", bg_bouncesValues, DISABLED, Game::DVAR_CODINFO, "Bounce glitch settings");
|
BGBounces = Game::Dvar_RegisterEnum("bg_bounces", bg_bouncesValues, DISABLED, Game::DVAR_CODINFO, "Bounce glitch settings");
|
||||||
|
BGBouncesAllAngles = Game::Dvar_RegisterEnum("bg_bouncesAllAngles", bg_bouncesAllAnglesValues, DISABLED, Game::DVAR_CODINFO, "Force bounce from all angles");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Hook Dvar_RegisterFloat. Only thing that's changed is that the 0x80 flag is not used
|
// Hook Dvar_RegisterFloat. Only thing that's changed is that the 0x80 flag is not used
|
||||||
|
@ -8,7 +8,7 @@ namespace Components
|
|||||||
PlayerMovement();
|
PlayerMovement();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum BouncesSettings { DISABLED, ENABLED, DOUBLE };
|
enum BouncesSettings : int { DISABLED, ENABLED, DOUBLE };
|
||||||
|
|
||||||
static constexpr auto SURF_LADDER = 0x8;
|
static constexpr auto SURF_LADDER = 0x8;
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ namespace Components
|
|||||||
|
|
||||||
RCon::RCon()
|
RCon::RCon()
|
||||||
{
|
{
|
||||||
AddCommands();
|
Events::OnSVInit(AddCommands);
|
||||||
|
|
||||||
if (!Dedicated::IsEnabled())
|
if (!Dedicated::IsEnabled())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user