Added auto-strafe
This commit is contained in:
parent
2de25ae24f
commit
6d37075ef8
|
@ -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);
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace GUI {
|
|||
|
||||
namespace BunnyHop {
|
||||
extern bool Enabled;
|
||||
extern bool StrafeEnabled;
|
||||
}
|
||||
|
||||
namespace NoSky {
|
||||
|
|
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue