Added auto-strafe

This commit is contained in:
Wizzard 2023-12-08 19:10:12 -05:00
parent 2de25ae24f
commit 6d37075ef8
3 changed files with 13 additions and 0 deletions

View File

@ -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);

View File

@ -8,6 +8,7 @@ namespace GUI {
namespace BunnyHop {
extern bool Enabled;
extern bool StrafeEnabled;
}
namespace NoSky {

View File

@ -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);
}