code refactor
This commit is contained in:
parent
44a7343aa8
commit
43ad5d8aa0
@ -46,22 +46,10 @@ namespace cheat::feature
|
|||||||
void NoClip::DrawMain()
|
void NoClip::DrawMain()
|
||||||
{
|
{
|
||||||
ConfigWidget("Enabled", f_Enabled, "Enables no-clip (fast speed + no collision).\n" \
|
ConfigWidget("Enabled", f_Enabled, "Enables no-clip (fast speed + no collision).\n" \
|
||||||
"To move, use WASD, Space (go up), and Shift (go down).");
|
"To move, use WASD, Space (go up), and Shift (go down), or customize your own keys.");
|
||||||
|
|
||||||
ConfigWidget("No Animation", f_NoAnimation, "Disables player animations.");
|
ConfigWidget("No Animation", f_NoAnimation, "Disables player animations.");
|
||||||
|
|
||||||
ConfigWidget("Use Custom Keys", f_UseCustomKeys, "Enable the Use of Custom HotKeys");
|
|
||||||
|
|
||||||
if (f_UseCustomKeys) {
|
|
||||||
ConfigWidget("Forward HotKey", f_ForwardKey, "Set Forward Key");
|
|
||||||
ConfigWidget("Left HotKey", f_LeftKey, "Set Left Key");
|
|
||||||
ConfigWidget("Back HotKey", f_BackKey, "Set Back Key");
|
|
||||||
ConfigWidget("Right HotKey", f_RightKey, "Set Right Key");
|
|
||||||
ConfigWidget("Ascend HotKey", f_AscendKey, "Set Ascend Key");
|
|
||||||
ConfigWidget("Descend HotKey", f_DescendKey, "Set Descend Key");
|
|
||||||
ConfigWidget("Alt Speed Key", f_AltSpeedKey, "Set AltSpeed HotKey");
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigWidget("Speed", f_Speed, 0.1f, 2.0f, 100.0f,
|
ConfigWidget("Speed", f_Speed, 0.1f, 2.0f, 100.0f,
|
||||||
"No-clip move speed.\n" \
|
"No-clip move speed.\n" \
|
||||||
"Not recommended setting above 5.0.");
|
"Not recommended setting above 5.0.");
|
||||||
@ -81,6 +69,18 @@ namespace cheat::feature
|
|||||||
ConfigWidget("Velocity mode", f_VelocityMode, "Use velocity instead of position to move.");
|
ConfigWidget("Velocity mode", f_VelocityMode, "Use velocity instead of position to move.");
|
||||||
ConfigWidget("Freeflight mode", f_FreeflightMode, "Don't remove collisions");
|
ConfigWidget("Freeflight mode", f_FreeflightMode, "Don't remove collisions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfigWidget("Use Custom Keys", f_UseCustomKeys, "Enable the Use of Custom HotKeys");
|
||||||
|
|
||||||
|
if (f_UseCustomKeys) {
|
||||||
|
ConfigWidget("Forward HotKey", f_ForwardKey, "Set Forward Key");
|
||||||
|
ConfigWidget("Left HotKey", f_LeftKey, "Set Left Key");
|
||||||
|
ConfigWidget("Back HotKey", f_BackKey, "Set Back Key");
|
||||||
|
ConfigWidget("Right HotKey", f_RightKey, "Set Right Key");
|
||||||
|
ConfigWidget("Ascend HotKey", f_AscendKey, "Set Ascend Key");
|
||||||
|
ConfigWidget("Descend HotKey", f_DescendKey, "Set Descend Key");
|
||||||
|
ConfigWidget("Alt Speed Key", f_AltSpeedKey, "Set AltSpeed HotKey");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NoClip::NeedStatusDraw() const
|
bool NoClip::NeedStatusDraw() const
|
||||||
@ -149,56 +149,28 @@ namespace cheat::feature
|
|||||||
auto relativeEntity = f_CameraRelative ? &cameraEntity : avatarEntity;
|
auto relativeEntity = f_CameraRelative ? &cameraEntity : avatarEntity;
|
||||||
|
|
||||||
float speed = f_Speed.value();
|
float speed = f_Speed.value();
|
||||||
if (f_AltSpeedEnabled) {
|
if (f_AltSpeedEnabled ? f_UseCustomKeys ? f_AltSpeedKey.value().IsPressed() : Hotkey(ImGuiKey_ModCtrl).IsPressed() : NULL)
|
||||||
if (!f_UseCustomKeys && Hotkey(ImGuiKey_ModCtrl).IsPressed()) {
|
|
||||||
speed = f_AltSpeed.value();
|
speed = f_AltSpeed.value();
|
||||||
}
|
|
||||||
if (f_UseCustomKeys && f_AltSpeedKey.value().IsPressed()) {
|
|
||||||
speed = f_AltSpeed.value();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
app::Vector3 dir = {};
|
app::Vector3 dir = {};
|
||||||
|
|
||||||
if (f_UseCustomKeys) {
|
if (f_UseCustomKeys ? f_ForwardKey.value().IsPressed() : Hotkey(ImGuiKey_W).IsPressed())
|
||||||
if (f_ForwardKey.value().IsPressed())
|
|
||||||
dir = dir + relativeEntity->forward();
|
dir = dir + relativeEntity->forward();
|
||||||
|
|
||||||
if (f_BackKey.value().IsPressed())
|
if (f_UseCustomKeys ? f_BackKey.value().IsPressed() : Hotkey(ImGuiKey_S).IsPressed())
|
||||||
dir = dir + relativeEntity->back();
|
dir = dir + relativeEntity->back();
|
||||||
|
|
||||||
if (f_RightKey.value().IsPressed())
|
if (f_UseCustomKeys ? f_RightKey.value().IsPressed() : Hotkey(ImGuiKey_D).IsPressed())
|
||||||
dir = dir + relativeEntity->right();
|
dir = dir + relativeEntity->right();
|
||||||
|
|
||||||
if (f_LeftKey.value().IsPressed())
|
if (f_UseCustomKeys ? f_LeftKey.value().IsPressed() : Hotkey(ImGuiKey_A).IsPressed())
|
||||||
dir = dir + relativeEntity->left();
|
dir = dir + relativeEntity->left();
|
||||||
|
|
||||||
if (f_AscendKey.value().IsPressed())
|
if (f_UseCustomKeys ? f_AscendKey.value().IsPressed() : Hotkey(ImGuiKey_Space).IsPressed())
|
||||||
dir = dir + avatarEntity->up();
|
dir = dir + avatarEntity->up();
|
||||||
|
|
||||||
if (f_DescendKey.value().IsPressed())
|
if (f_UseCustomKeys ? f_DescendKey.value().IsPressed() : Hotkey(ImGuiKey_ModShift).IsPressed())
|
||||||
dir = dir + avatarEntity->down();
|
dir = dir + avatarEntity->down();
|
||||||
}
|
|
||||||
|
|
||||||
if (!f_UseCustomKeys) {
|
|
||||||
if (Hotkey(ImGuiKey_W).IsPressed())
|
|
||||||
dir = dir + relativeEntity->forward();
|
|
||||||
|
|
||||||
if (Hotkey(ImGuiKey_S).IsPressed())
|
|
||||||
dir = dir + relativeEntity->back();
|
|
||||||
|
|
||||||
if (Hotkey(ImGuiKey_D).IsPressed())
|
|
||||||
dir = dir + relativeEntity->right();
|
|
||||||
|
|
||||||
if (Hotkey(ImGuiKey_A).IsPressed())
|
|
||||||
dir = dir + relativeEntity->left();
|
|
||||||
|
|
||||||
if (Hotkey(ImGuiKey_Space).IsPressed())
|
|
||||||
dir = dir + avatarEntity->up();
|
|
||||||
|
|
||||||
if (Hotkey(ImGuiKey_ModShift).IsPressed())
|
|
||||||
dir = dir + avatarEntity->down();
|
|
||||||
}
|
|
||||||
|
|
||||||
app::Vector3 prevPos = avatarEntity->relativePosition();
|
app::Vector3 prevPos = avatarEntity->relativePosition();
|
||||||
if (IsVectorZero(prevPos))
|
if (IsVectorZero(prevPos))
|
||||||
|
Loading…
Reference in New Issue
Block a user