From 65eb2e34e01f3cefb4de4dc6bd11538c73bbf930 Mon Sep 17 00:00:00 2001 From: FutureRave Date: Wed, 19 Jan 2022 10:48:33 +0000 Subject: [PATCH] Change style a bit --- src/Components/Modules/Movement.cpp | 14 +++++++------- src/Components/Modules/Movement.hpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Components/Modules/Movement.cpp b/src/Components/Modules/Movement.cpp index 2fb7552e..c631b623 100644 --- a/src/Components/Modules/Movement.cpp +++ b/src/Components/Modules/Movement.cpp @@ -187,7 +187,7 @@ namespace Components void Movement::PM_ProjectVelocityStub(const float* velIn, const float* normal, float* velOut) { - auto lengthSquared2D = velIn[0] * velIn[0] + velIn[1] * velIn[1]; + const auto lengthSquared2D = velIn[0] * velIn[0] + velIn[1] * velIn[1]; if (std::fabsf(normal[2]) < 0.001f || lengthSquared2D == 0.0) { @@ -199,7 +199,7 @@ namespace Components auto newZ = velIn[0] * normal[0] + velIn[1] * normal[1]; newZ = -newZ / normal[2]; - auto lengthScale = std::sqrtf((velIn[2] * velIn[2] + lengthSquared2D) + const auto lengthScale = std::sqrtf((velIn[2] * velIn[2] + lengthSquared2D) / (newZ * newZ + lengthSquared2D)); if (Movement::BGBouncesAllAngles.get() @@ -212,7 +212,7 @@ namespace Components } // Double bounces - void Movement::Jump_ClearStateHk(Game::playerState_s* ps) + void Movement::Jump_ClearStateHook(Game::playerState_s* ps) { if (Movement::BGBounces->current.integer == Movement::DOUBLE) return; @@ -242,7 +242,7 @@ namespace Components { Dvar::OnInit([] { - static const char* bg_enableBouncesValues[] = + static const char* bg_bouncesValues[] = { "disabled", "enabled", @@ -268,7 +268,7 @@ namespace Components "The speed at which noclip camera moves"); Movement::BGBounces = Game::Dvar_RegisterEnum("bg_bounces", - bg_enableBouncesValues, Movement::DISABLED, Game::DVAR_FLAG_REPLICATED, "Bounce glitch settings"); + bg_bouncesValues, Movement::DISABLED, Game::DVAR_FLAG_REPLICATED, "Bounce glitch settings"); Movement::BGBouncesAllAngles = Dvar::Register("bg_bouncesAllAngles", false, Game::DVAR_FLAG_REPLICATED, "Force bounce from all angles"); @@ -290,9 +290,9 @@ namespace Components Utils::Hook(0x56F845, Movement::PM_MoveScaleStub, HOOK_CALL).install()->quick(); Utils::Hook(0x56FABD, Movement::PM_MoveScaleStub, HOOK_CALL).install()->quick(); + // Bounce logic Utils::Hook(0x4B1B2D, Movement::PM_StepSlideMoveStub, HOOK_JUMP).install()->quick(); - Utils::Hook(0x57383E, Movement::Jump_ClearStateHk, HOOK_CALL).install()->quick(); - + Utils::Hook(0x57383E, Movement::Jump_ClearStateHook, HOOK_CALL).install()->quick(); Utils::Hook(0x4B1B97, Movement::PM_ProjectVelocityStub, HOOK_CALL).install()->quick(); } diff --git a/src/Components/Modules/Movement.hpp b/src/Components/Modules/Movement.hpp index 791dfedc..fd91293a 100644 --- a/src/Components/Modules/Movement.hpp +++ b/src/Components/Modules/Movement.hpp @@ -30,7 +30,7 @@ namespace Components // Bounce logic static void PM_StepSlideMoveStub(); static void PM_ProjectVelocityStub(const float* velIn, const float* normal, float* velOut); - static void Jump_ClearStateHk(Game::playerState_s* ps); + static void Jump_ClearStateHook(Game::playerState_s* ps); static Game::dvar_t* Dvar_RegisterLastStandSpeedScale(const char* name, float value, float min, float max, int flags, const char* desc); static Game::dvar_t* Dvar_RegisterSpectateSpeedScale(const char* name, float value, float min, float max, int flags, const char* desc);