Added auto-strafe
This commit is contained in:
parent
2de25ae24f
commit
6d37075ef8
|
@ -12,6 +12,7 @@ void GUI::DrawConfigurationWindow() {
|
||||||
ImGui::PushItemWidth(-1);
|
ImGui::PushItemWidth(-1);
|
||||||
|
|
||||||
ImGui::Checkbox("Auto-bunnyhop", &GUI::BunnyHop::Enabled);
|
ImGui::Checkbox("Auto-bunnyhop", &GUI::BunnyHop::Enabled);
|
||||||
|
ImGui::Checkbox("Auto-strafe", &GUI::BunnyHop::StrafeEnabled);
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
|
|
||||||
ImGui::Checkbox("No sky", &GUI::NoSky::Enabled);
|
ImGui::Checkbox("No sky", &GUI::NoSky::Enabled);
|
||||||
|
|
|
@ -8,6 +8,7 @@ namespace GUI {
|
||||||
|
|
||||||
namespace BunnyHop {
|
namespace BunnyHop {
|
||||||
extern bool Enabled;
|
extern bool Enabled;
|
||||||
|
extern bool StrafeEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NoSky {
|
namespace NoSky {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
typedef void (*CreateMove_t) (IBaseClientDLL*, int, float, bool);
|
typedef void (*CreateMove_t) (IBaseClientDLL*, int, float, bool);
|
||||||
|
|
||||||
bool GUI::BunnyHop::Enabled = true;
|
bool GUI::BunnyHop::Enabled = true;
|
||||||
|
bool GUI::BunnyHop::StrafeEnabled = true;
|
||||||
|
|
||||||
void Hooks::CreateMove(IBaseClientDLL* thisptr, int sequence, float frametime, bool active) {
|
void Hooks::CreateMove(IBaseClientDLL* thisptr, int sequence, float frametime, bool active) {
|
||||||
// Get the original function and store it statically.
|
// 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))
|
if (GUI::BunnyHop::Enabled && cmd->buttons & IN_JUMP && !(localplayer->GetFlags() & FL_ONGROUND))
|
||||||
cmd->buttons &= ~IN_JUMP;
|
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.
|
// Re-calculate the command checksum after making changes.
|
||||||
input->VerifyUserCmd(cmd, sequence);
|
input->VerifyUserCmd(cmd, sequence);
|
||||||
}
|
}
|
Loading…
Reference in New Issue