From 6d37075ef8e2c9555d16bf76c33ac9a4f7140dd7 Mon Sep 17 00:00:00 2001 From: Wizzard <25581244+Wizzard@users.noreply.toomuchslop.com> Date: Fri, 8 Dec 2023 19:10:12 -0500 Subject: [PATCH] Added auto-strafe --- src/GUI/Components.cpp | 1 + src/GUI/GUI.h | 1 + src/Hooks/CreateMove.cpp | 11 +++++++++++ 3 files changed, 13 insertions(+) diff --git a/src/GUI/Components.cpp b/src/GUI/Components.cpp index f7933a8..a8ba3be 100644 --- a/src/GUI/Components.cpp +++ b/src/GUI/Components.cpp @@ -12,6 +12,7 @@ void GUI::DrawConfigurationWindow() { ImGui::PushItemWidth(-1); ImGui::Checkbox("Auto-bunnyhop", &GUI::BunnyHop::Enabled); + ImGui::Checkbox("Auto-strafe", &GUI::BunnyHop::StrafeEnabled); ImGui::Spacing(); ImGui::Checkbox("No sky", &GUI::NoSky::Enabled); diff --git a/src/GUI/GUI.h b/src/GUI/GUI.h index 73a690f..49a98c1 100644 --- a/src/GUI/GUI.h +++ b/src/GUI/GUI.h @@ -8,6 +8,7 @@ namespace GUI { namespace BunnyHop { extern bool Enabled; + extern bool StrafeEnabled; } namespace NoSky { diff --git a/src/Hooks/CreateMove.cpp b/src/Hooks/CreateMove.cpp index 8cb53be..cbb4738 100644 --- a/src/Hooks/CreateMove.cpp +++ b/src/Hooks/CreateMove.cpp @@ -3,6 +3,7 @@ typedef void (*CreateMove_t) (IBaseClientDLL*, int, float, bool); bool GUI::BunnyHop::Enabled = true; +bool GUI::BunnyHop::StrafeEnabled = true; void Hooks::CreateMove(IBaseClientDLL* thisptr, int sequence, float frametime, bool active) { // Get the original function and store it statically. @@ -25,6 +26,16 @@ void Hooks::CreateMove(IBaseClientDLL* thisptr, int sequence, float frametime, b if (GUI::BunnyHop::Enabled && cmd->buttons & IN_JUMP && !(localplayer->GetFlags() & FL_ONGROUND)) cmd->buttons &= ~IN_JUMP; + if (GUI::BunnyHop::StrafeEnabled) { + f (!(localplayer->GetFlags() & FL_ONGROUND)) { + if (cmd->mousedx > 1 || cmd->mousedx < -1) { + cmd->sidemove = (cmd->mousedx < 0.f) ? -450.f : 450.f; + } else { + cmd->forwardmove = (abs(cmd->forwardmove) > 0.f) ? 450.f : 0.f; + cmd->sidemove = (cmd->sidemove != 0.f) ? ((cmd->sidemove > 0.f) ? 450.f : -450.f) : 0.f; + } + } + } // Re-calculate the command checksum after making changes. input->VerifyUserCmd(cmd, sequence); } \ No newline at end of file