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;
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();

View file

@ -16,6 +16,8 @@ using json = nlohmann::json;
std::unordered_map<uint8_t, Sprite> 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);