move more stuff over to randomizer.cpp

This commit is contained in:
briaguya 2022-06-03 00:46:59 -04:00
commit 746078ddb7
2 changed files with 28 additions and 28 deletions

View file

@ -50,8 +50,6 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPAR
using namespace Ship; using namespace Ship;
bool oldCursorState = true; bool oldCursorState = true;
u8 generated;
#define EXPERIMENTAL() \ #define EXPERIMENTAL() \
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 50, 50, 255)); \ ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 50, 50, 255)); \
ImGui::Text("Experimental"); \ ImGui::Text("Experimental"); \
@ -434,11 +432,6 @@ namespace SohImGui {
needs_save = false; needs_save = false;
} }
if (generated) {
generated = 0;
// randoThread.join();
}
ImGuiProcessEvent(event); ImGuiProcessEvent(event);
} }
@ -1262,20 +1255,6 @@ namespace SohImGui {
overlay->Draw(); 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) { void DrawFramebufferAndGameInput(void) {
const ImVec2 main_pos = ImGui::GetWindowPos(); const ImVec2 main_pos = ImGui::GetWindowPos();
ImVec2 size = ImGui::GetContentRegionAvail(); ImVec2 size = ImGui::GetContentRegionAvail();

View file

@ -16,6 +16,8 @@ using json = nlohmann::json;
std::unordered_map<uint8_t, Sprite> gSeedTextures; std::unordered_map<uint8_t, Sprite> gSeedTextures;
u8 generated;
Randomizer::Randomizer() { Randomizer::Randomizer() {
Sprite bowSprite = { gFairyBowIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b }; Sprite bowSprite = { gFairyBowIconTex, 32, 32, G_IM_FMT_RGBA, G_IM_SIZ_32b };
gSeedTextures[0] = bowSprite; gSeedTextures[0] = bowSprite;
@ -2064,20 +2066,39 @@ void DrawRandoEditor(bool& open) {
return; return;
} }
bool doubleDefense = gSaveContext.doubleDefense != 0; bool randoEnabled = (bool)CVar_GetS32("gRandomizer", 0);
if (ImGui::Checkbox("Double Defense", &doubleDefense)) { if (ImGui::Checkbox("Enable Randomizer", &randoEnabled)) {
gSaveContext.doubleDefense = doubleDefense; CVar_SetS32("gRandomizer", randoEnabled);
gSaveContext.inventory.defenseHearts = Game::SaveSettings();
gSaveContext.doubleDefense ? 20 : 0; // Set to get the border drawn in the UI
} }
if (ImGui::Button("Noon")) { if (ImGui::Button("Generate")) {
gSaveContext.dayTime = 0x8000; // GenerateRandomizerImgui();
} }
// if (generated) {
// generated = 0;
// randoThread.join();
// }
ImGui::End(); 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) // void EnhancementCheckbox(const char* text, const char* cvarName)
// { // {
// bool val = (bool)CVar_GetS32(cvarName, 0); // bool val = (bool)CVar_GetS32(cvarName, 0);