[PlayerMovement]: Add bunny hop (#818)
This commit is contained in:
parent
a663d98685
commit
91aaf16e59
@ -15,6 +15,8 @@ namespace Components
|
|||||||
const Game::dvar_t* PlayerMovement::PlayerSpectateSpeedScale;
|
const Game::dvar_t* PlayerMovement::PlayerSpectateSpeedScale;
|
||||||
const Game::dvar_t* PlayerMovement::BGBounces;
|
const Game::dvar_t* PlayerMovement::BGBounces;
|
||||||
const Game::dvar_t* PlayerMovement::BGBouncesAllAngles;
|
const Game::dvar_t* PlayerMovement::BGBouncesAllAngles;
|
||||||
|
const Game::dvar_t* PlayerMovement::BGBunnyHopSlowdown;
|
||||||
|
const Game::dvar_t* PlayerMovement::BGBunnyHopAuto;
|
||||||
const Game::dvar_t* PlayerMovement::PlayerDuckedSpeedScale;
|
const Game::dvar_t* PlayerMovement::PlayerDuckedSpeedScale;
|
||||||
const Game::dvar_t* PlayerMovement::PlayerProneSpeedScale;
|
const Game::dvar_t* PlayerMovement::PlayerProneSpeedScale;
|
||||||
|
|
||||||
@ -217,6 +219,38 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlayerMovement::PM_CrashLand_Stub(const float* v, float scale, const float* result)
|
||||||
|
{
|
||||||
|
if (!BGBunnyHopSlowdown->current.enabled)
|
||||||
|
{
|
||||||
|
Utils::Hook::Call<void(const float*, float, const float*)>(0x4C12B0)(v, scale, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
__declspec(naked) void PlayerMovement::Jump_Check_Stub()
|
||||||
|
{
|
||||||
|
using namespace Game;
|
||||||
|
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push eax
|
||||||
|
mov eax, BGBunnyHopAuto
|
||||||
|
cmp byte ptr [eax + 0x10], 1
|
||||||
|
pop eax
|
||||||
|
|
||||||
|
je autoHop
|
||||||
|
|
||||||
|
// Game's code
|
||||||
|
test dword ptr [ebp + 0x30], CMD_BUTTON_UP
|
||||||
|
push 0x4E9890
|
||||||
|
ret
|
||||||
|
|
||||||
|
autoHop:
|
||||||
|
push 0x4E989F
|
||||||
|
ret
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PlayerMovement::GScr_IsSprinting(const Game::scr_entref_t entref)
|
void PlayerMovement::GScr_IsSprinting(const Game::scr_entref_t entref)
|
||||||
{
|
{
|
||||||
const auto* client = Game::GetEntity(entref)->client;
|
const auto* client = Game::GetEntity(entref)->client;
|
||||||
@ -257,6 +291,12 @@ 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");
|
||||||
|
|
||||||
|
BGBunnyHopSlowdown = Game::Dvar_RegisterBool("bg_bunnyHopSlowdown",
|
||||||
|
false, Game::DVAR_CODINFO, "Toggle landing slowdown");
|
||||||
|
|
||||||
|
BGBunnyHopAuto = Game::Dvar_RegisterBool("bg_bunnyHopAuto",
|
||||||
|
false, Game::DVAR_CODINFO, "Constantly jump when holding space");
|
||||||
|
|
||||||
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");
|
||||||
|
|
||||||
@ -330,6 +370,9 @@ namespace Components
|
|||||||
Utils::Hook(0x573F39, PM_PlayerTraceStub, HOOK_CALL).install()->quick();
|
Utils::Hook(0x573F39, PM_PlayerTraceStub, HOOK_CALL).install()->quick();
|
||||||
Utils::Hook(0x573E93, PM_PlayerTraceStub, HOOK_CALL).install()->quick();
|
Utils::Hook(0x573E93, PM_PlayerTraceStub, HOOK_CALL).install()->quick();
|
||||||
|
|
||||||
|
Utils::Hook(0x570020, PM_CrashLand_Stub, HOOK_CALL).install()->quick(); // Vec3Scale
|
||||||
|
Utils::Hook(0x4E9889, Jump_Check_Stub, HOOK_JUMP).install()->quick();
|
||||||
|
|
||||||
GSC::Script::AddMethod("IsSprinting", GScr_IsSprinting);
|
GSC::Script::AddMethod("IsSprinting", GScr_IsSprinting);
|
||||||
|
|
||||||
RegisterMovementDvars();
|
RegisterMovementDvars();
|
||||||
|
@ -23,6 +23,8 @@ namespace Components
|
|||||||
static const Game::dvar_t* PlayerSpectateSpeedScale;
|
static const Game::dvar_t* PlayerSpectateSpeedScale;
|
||||||
static const Game::dvar_t* BGBounces;
|
static const Game::dvar_t* BGBounces;
|
||||||
static const Game::dvar_t* BGBouncesAllAngles;
|
static const Game::dvar_t* BGBouncesAllAngles;
|
||||||
|
static const Game::dvar_t* BGBunnyHopSlowdown;
|
||||||
|
static const Game::dvar_t* BGBunnyHopAuto;
|
||||||
static const Game::dvar_t* PlayerDuckedSpeedScale;
|
static const Game::dvar_t* PlayerDuckedSpeedScale;
|
||||||
static const Game::dvar_t* PlayerProneSpeedScale;
|
static const Game::dvar_t* PlayerProneSpeedScale;
|
||||||
|
|
||||||
@ -45,6 +47,9 @@ namespace Components
|
|||||||
static int StuckInClient_Hk(Game::gentity_s* self);
|
static int StuckInClient_Hk(Game::gentity_s* self);
|
||||||
static void CM_TransformedCapsuleTrace_Hk(Game::trace_t* results, const float* start, const float* end, const Game::Bounds* bounds, const Game::Bounds* capsule, int contents, const float* origin, const float* angles);
|
static void CM_TransformedCapsuleTrace_Hk(Game::trace_t* results, const float* start, const float* end, const Game::Bounds* bounds, const Game::Bounds* capsule, int contents, const float* origin, const float* angles);
|
||||||
|
|
||||||
|
static void PM_CrashLand_Stub(const float* v, float scale, const float* result);
|
||||||
|
static void Jump_Check_Stub();
|
||||||
|
|
||||||
static void GScr_IsSprinting(Game::scr_entref_t entref);
|
static void GScr_IsSprinting(Game::scr_entref_t entref);
|
||||||
|
|
||||||
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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user