diff --git a/Makefile b/Makefile index f942183..a471e58 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ files := src/main.cpp src/tiq.cpp src/utils.cpp src/gui.cpp $(wildcard src/imgui/*.cpp) external := -ld3d9 -ld3dcompiler -CXXFLAGS = -Wall -Wextra -pedantic -std=c++20 -ggdb -O0 +CXXFLAGS = -Wall -Wextra -pedantic -std=c++20 -ggdb -O2 tiq: clang++ -o bin/tiq-level-chooser.exe $(files) $(external) $(CXXFLAGS) \ No newline at end of file diff --git a/src/gui.cpp b/src/gui.cpp index 7f188fc..87da79c 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -182,23 +182,32 @@ std::unique_ptr gui::Render(std::unique_ptr tiq) noexcept { ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove); static unsigned int level = 1; + static unsigned int current_level; static bool level_chosen = false; - static unsigned int intended_level = 1; constexpr unsigned int level_min = 1; constexpr unsigned int level_max = 100; ImGui::Text("Created by Lucia C (saturnalia)"); + if (tiq->get_current_level() == 0) ImGui::BeginDisabled(); + ImGui::DragScalar("Level", ImGuiDataType_U16, &level, 1, &level_min, &level_max); - bool clicked = ImGui::Button("Hook"); + bool clicked = ImGui::Button("Go to level"); + bool unhook = ImGui::Button("Unhook"); + ImGui::SetItemTooltip("If your game freezes, locks up, or\notherwise seems to be acting\nweird, press this button."); + if (tiq->get_current_level() == 0) ImGui::EndDisabled(); - if (clicked) { - intended_level = level; + if (clicked && level <= 100 && level >= 1) { + current_level = tiq->get_current_level(); level_chosen = true; tiq->enable_hook(tiq->map_to_scene(level)); } - if (tiq->get_current_level() == tiq->map_to_scene(intended_level) && level_chosen) { + if (unhook) { + tiq->disable_hook(); + } + + if (tiq->get_current_level() != current_level && level_chosen) { tiq->disable_hook(); level_chosen = false; }