From 746078ddb79ab83e847b93f4193fc15c5bdcb7bb Mon Sep 17 00:00:00 2001 From: briaguya Date: Fri, 3 Jun 2022 00:46:59 -0400 Subject: [PATCH] move more stuff over to randomizer.cpp --- libultraship/libultraship/SohImGuiImpl.cpp | 21 ------------- soh/soh/Enhancements/randomizer.cpp | 35 +++++++++++++++++----- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 8d09f504e..a2e36f28f 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -50,8 +50,6 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPAR using namespace Ship; bool oldCursorState = true; -u8 generated; - #define EXPERIMENTAL() \ ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 50, 50, 255)); \ ImGui::Text("Experimental"); \ @@ -434,11 +432,6 @@ namespace SohImGui { needs_save = false; } - if (generated) { - generated = 0; - // randoThread.join(); - } - ImGuiProcessEvent(event); } @@ -1262,20 +1255,6 @@ namespace SohImGui { overlay->Draw(); } - void GenerateRandomizerImgui() { - CVar_SetS32("gRandoGenerating", 1); - Game::SaveSettings(); - - // RandoMain::GenerateRando(); - - CVar_SetS32("gRandoGenerating", 0); - Game::SaveSettings(); - - Game::LoadSettings(); - - generated = 1; - } - void DrawFramebufferAndGameInput(void) { const ImVec2 main_pos = ImGui::GetWindowPos(); ImVec2 size = ImGui::GetContentRegionAvail(); diff --git a/soh/soh/Enhancements/randomizer.cpp b/soh/soh/Enhancements/randomizer.cpp index 460e44cb5..fbcce15c7 100644 --- a/soh/soh/Enhancements/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer.cpp @@ -16,6 +16,8 @@ using json = nlohmann::json; std::unordered_map gSeedTextures; +u8 generated; + Randomizer::Randomizer() { Sprite bowSprite = { gFairyBowIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }; gSeedTextures[0] = bowSprite; @@ -2064,20 +2066,39 @@ void DrawRandoEditor(bool& open) { return; } - bool doubleDefense = gSaveContext.doubleDefense != 0; - if (ImGui::Checkbox("Double Defense", &doubleDefense)) { - gSaveContext.doubleDefense = doubleDefense; - gSaveContext.inventory.defenseHearts = - gSaveContext.doubleDefense ? 20 : 0; // Set to get the border drawn in the UI + bool randoEnabled = (bool)CVar_GetS32("gRandomizer", 0); + if (ImGui::Checkbox("Enable Randomizer", &randoEnabled)) { + CVar_SetS32("gRandomizer", randoEnabled); + Game::SaveSettings(); } - if (ImGui::Button("Noon")) { - gSaveContext.dayTime = 0x8000; + if (ImGui::Button("Generate")) { + // GenerateRandomizerImgui(); } + // if (generated) { + // generated = 0; + // randoThread.join(); + // } + ImGui::End(); } +void GenerateRandomizerImgui() { + CVar_SetS32("gRandoGenerating", 1); + Game::SaveSettings(); + + // WHY CAN'T I FIND THIS?????????????????? + // RandoMain::GenerateRando(); + + CVar_SetS32("gRandoGenerating", 0); + Game::SaveSettings(); + + Game::LoadSettings(); + + generated = 1; +} + // void EnhancementCheckbox(const char* text, const char* cvarName) // { // bool val = (bool)CVar_GetS32(cvarName, 0);