Skip to content

Commit

Permalink
nwe
Browse files Browse the repository at this point in the history
  • Loading branch information
TobyAdd committed Dec 12, 2024
1 parent cc12125 commit 9c430fb
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 11 deletions.
29 changes: 26 additions & 3 deletions src/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void Gui::animateAlpha()
std::chrono::duration<float> diff = currentTime - animationStartTime;
float elapsed = diff.count();

float time = m_anim_durr / 1000.0f;
float time = Config::get().get<int>("gui_anim_durr", 100) / 1000.0f;
if (elapsed >= time)
{
style.Alpha = isFadingIn ? 1.0f : 0.0f;
Expand Down Expand Up @@ -174,6 +174,29 @@ void Gui::Render() {
ImGui::SetTooltip("Invert theme (beta)");

ImGuiH::Checkbox("Keybinds Mode", &hacks.keybinds_mode, m_scale);

if (ImGuiH::Button("More Settings", {ImGui::GetContentRegionAvail().x, 0})) {
ImGui::OpenPopup("GDH More Settings");
}

if (ImGui::BeginPopupModal("GDH More Settings", NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
int anim_durr = config.get<int>("gui_anim_durr", 100);
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::DragInt("##gui_anim_durr", &anim_durr, 1, 0, 10000, "Transition Time: %ims")) {
config.set<int>("gui_anim_durr", anim_durr);
}

if (ImGuiH::Button("Sort Windows", {ImGui::GetContentRegionAvail().x, NULL}))
stretchedWindows.clear();



if (ImGuiH::Button("Close", {400 * m_scale, 0})) {
ImGui::CloseCurrentPopup();
}

ImGui::EndPopup();
}
}
else if (windowName == "Framerate") {
bool tps_enabled = config.get<bool>("tps_enabled", false);
Expand Down Expand Up @@ -1023,9 +1046,9 @@ void Gui::Render() {
if (ImGui::BeginPopupModal(fmt::format("{} Settings", hck.name).c_str(), NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
hck.handlerCustomWindow();

if (ImGuiH::Button("Close", {400 * m_scale, NULL})) {
if (ImGuiH::Button("Close", {400 * m_scale, NULL}))
ImGui::CloseCurrentPopup();
}

ImGui::EndPopup();
}
}
Expand Down
1 change: 0 additions & 1 deletion src/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class Gui {
int m_index_scale = 7;

bool m_needRescale = true;
int m_anim_durr = 100;

void Render();
void Init();
Expand Down
18 changes: 13 additions & 5 deletions src/hacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ void Hacks::Init() {
{"Allow Low Volume", "Removes the limit on minimum volume percentage", "allow_low_volume"}, // +
{"Coins In Practice", "The ability to collect coins in practice", "coins_in_practice"},
{"Confirm Exit", "Warning before level exit", "confim_exit", "0167"}, // +
{"Fast Chest Open", "Removes the delay for opening chests", "fast_chest_open"},
// {"Force Dont Enter", "Disables effects when objects enter the viewable play area", "force_dont_enter"},
// {"Force Dont Fade", "Disables effects when objects leave the viewable play area", "force_dont_fade"},
{"Random Seed", "Changes the seed game so that the random trigger is not triggered randomly", "random_seed"},
{"Fast Chest Open", "Removes the delay for opening chests", "fast_chest_open"},
// {"Random Seed", "Changes the seed game so that the random trigger is not triggered randomly", "random_seed"},
{"Respawn Time", "Changes respawn time on death", "respawn_time"}, // +
{"Ignore ESC", "Prevents exiting the level", "ignore_esc"}, // +
{"Instant Complete", "Instant level completion", "instant_complete"}, // +
Expand Down Expand Up @@ -75,6 +73,7 @@ void Hacks::Init() {
{"No New Best Popup", "Disable the new best popup", "no_new_best_popup"}, // +
{"No Portal Lighting", "Disables lightning when entering mini/large portal", "no_portal_lighting"},
{"No Pulse", "Disables pulsation of falls, orbs, etc", "no_pulse"}, // +
{"Pause On Complete", "Lets you pouse during the level complete animation", "pause_during_complete"}, // +
{"Pulse Size", "Changes pulsation of falls, orbs, etc", "pulse_size"}, // +
{"No Robot Fire", "Hides robot boost fire", "no_robot_fire"}, // +
{"No Spider Dash", "Disables spider dash trail when teleporting", "no_spider_dash"}, // +
Expand All @@ -98,7 +97,7 @@ void Hacks::Init() {
}
},
{"Framerate", 450, 300, 220, 130},
{"GDH Settings", 450, 440, 220, 150},
{"GDH Settings", 450, 440, 220, 180},
{"Replay Engine", 680, 10, 300, 200},
{"Labels", 680, 220, 300, 320},
{"Variables", 10, 510, 200, 160},
Expand Down Expand Up @@ -261,6 +260,15 @@ void Hacks::Init() {
ImGui::Text("Tip: Enable hitboxes in the editor by checking the \"Show\nHitboxes\" option in the Editor Pause menu");
});

// SetCustomWindowHandlerByConfig("random_seed", [this, &config]() {
// auto &gui = Gui::get();

// int random_seed_value = config.get<int>("random_seed_value", 1337);
// ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
// if (ImGui::DragInt("##random_seed_value", &random_seed_value, 1, 1, INT_MAX, "Seed: %i"))
// config.set<int>("random_seed_value", random_seed_value);
// });

SetCustomWindowHandlerByConfig("rgb_icons", [this, &config]() {
auto &gui = Gui::get();
auto &colors = RGBIcons::get();
Expand Down
13 changes: 11 additions & 2 deletions src/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,10 @@ class $modify(PlayLayer) {
// auto unk3188 = m_unk3188;
// auto replayRandSeed = m_replayRandSeed;

// m_unk3188 = true;
// m_replayRandSeed = 228;
// if (config.get<bool>("random_seed", false)) {
// m_unk3188 = true;
// m_replayRandSeed = config.get<int>("random_seed_value", 1337);
// }

PlayLayer::resetLevel();

Expand Down Expand Up @@ -513,13 +515,20 @@ class $modify(PlayLayer) {
}

void pauseGame(bool paused) {
auto& config = Config::get();
auto& recorderAudio = RecorderAudio::get();
if (recorderAudio.enabled) {
ImGuiH::Popup::get().add_popup("You can't pause because the audio is still recording");
return;
}

bool levelEndAnimationStarted = m_levelEndAnimationStarted;
if (config.get<bool>("pause_during_complete", false))
m_levelEndAnimationStarted = false;

PlayLayer::pauseGame(paused);

m_levelEndAnimationStarted = levelEndAnimationStarted;
}

void startMusic() {
Expand Down

0 comments on commit 9c430fb

Please sign in to comment.