From c0a1a99d8bedc6e6bb42eee95f0baf36dcdf411d Mon Sep 17 00:00:00 2001 From: Jan Date: Sat, 11 Sep 2021 17:49:58 +0200 Subject: [PATCH] Add comments to gamepad patch to explain commented out code and magic flag numbers --- src/Components/Modules/Gamepad.cpp | 6 ++++++ src/Components/Modules/Materials.cpp | 1 + 2 files changed, 7 insertions(+) diff --git a/src/Components/Modules/Gamepad.cpp b/src/Components/Modules/Gamepad.cpp index 7c8d2b87..bb8055b1 100644 --- a/src/Components/Modules/Gamepad.cpp +++ b/src/Components/Modules/Gamepad.cpp @@ -345,9 +345,11 @@ namespace Components bool Gamepad::AimAssist_IsPlayerUsingOffhand(Game::AimAssistPlayerState* ps) { + // Check offhand flag if ((ps->weapFlags & 2) == 0) return false; + // If offhand weapon has no id we are not using one if (!ps->weapIndex) return false; @@ -520,6 +522,7 @@ namespace Components if (ps->weaponState >= Game::WEAPON_STUNNED_START && ps->weaponState <= Game::WEAPON_STUNNED_END) return false; + // The game checks for these flags. Their meaning is to be researched if necessary. if (ps->eFlags & 0x100C00) return false; @@ -809,7 +812,10 @@ namespace Components auto yaw = -CL_GamepadAxisValue(gamePadIndex, Game::GPAD_VIRTAXIS_YAW); auto forward = CL_GamepadAxisValue(gamePadIndex, Game::GPAD_VIRTAXIS_FORWARD); auto side = CL_GamepadAxisValue(gamePadIndex, Game::GPAD_VIRTAXIS_SIDE); + + // The game implements an attack axis at this location. This axis is unused however so for this patch it was not implemented. //auto attack = CL_GamepadAxisValue(gamePadIndex, Game::GPAD_VIRTAXIS_ATTACK); + auto moveScale = static_cast(std::numeric_limits::max()); if (std::fabs(side) > 0.0f || std::fabs(forward) > 0.0f) diff --git a/src/Components/Modules/Materials.cpp b/src/Components/Modules/Materials.cpp index a701b381..173feefd 100644 --- a/src/Components/Modules/Materials.cpp +++ b/src/Components/Modules/Materials.cpp @@ -325,6 +325,7 @@ namespace Components const auto width = text[1]; const auto materialNameLength = text[3]; + // This is how the game calculates width and height. Probably some 1 byte floating point number. auto v9 = font->pixelHeight * (width - 16) + 16; auto w = ((((v9 >> 24) & 0x1F) + v9) >> 5);