start moving stuff out of sohimguiimpl

This commit is contained in:
briaguya 2022-06-02 23:24:57 -04:00
commit 3c06b3a6b4
4 changed files with 66 additions and 16 deletions

View file

@ -63,8 +63,6 @@ OSContPad* pads;
std::map<std::string, GameAsset*> DefaultAssets;
std::thread randoThread;
// SpoilerData gSpoilerData;
namespace SohImGui {
@ -438,7 +436,7 @@ namespace SohImGui {
if (generated) {
generated = 0;
randoThread.join();
// randoThread.join();
}
ImGuiProcessEvent(event);
@ -1046,19 +1044,6 @@ namespace SohImGui {
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Randomizer"))
{
EnhancementCheckbox("Enable Randomizer", "gRandomizer");
if (ImGui::Button("Generate Seed")) {
if (CVar_GetS32("gRandoGenerating", 0) == 0) {
randoThread = std::thread(&SohImGui::GenerateRandomizerImgui);
}
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Developer Tools"))
{
EnhancementCheckbox("OoT Debug Mode", "gDebugEnabled");

View file

@ -9,6 +9,8 @@
#include <textures/icon_item_static/icon_item_static.h>
#include <textures/icon_item_24_static/icon_item_24_static.h>
#include <GameSettings.h>
#include "../libultraship/SohImGuiImpl.h"
#include <thread>
using json = nlohmann::json;
@ -2048,3 +2050,53 @@ RandomizerCheck Randomizer::GetCheckFromActor(s16 sceneNum, s16 actorId, s16 act
return RC_UNKNOWN_CHECK;
}
std::thread randoThread;
void DrawRandoEditor(bool& open) {
if (!open) {
return;
}
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Rando Editor", &open, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
ImGui::End();
}
// void EnhancementCheckbox(const char* text, const char* cvarName)
// {
// bool val = (bool)CVar_GetS32(cvarName, 0);
// if (ImGui::Checkbox(text, &val)) {
// CVar_SetS32(cvarName, val);
// needs_save = true;
// }
// }
void InitRando() {
SohImGui::AddWindow("Developer Tools", "Rando Editor", DrawRandoEditor);
// if (ImGui::BeginMenu("Randomizer"))
// {
// // EnhancementCheckbox("Enable Randomizer", "gRandomizer");
// if (ImGui::Button("Generate Seed")) {
// if (CVar_GetS32("gRandoGenerating", 0) == 0) {
// randoThread = std::thread(&SohImGui::GenerateRandomizerImgui);
// }
// }
// ImGui::EndMenu();
// }
}
extern "C" {
void Rando_Init(void) {
InitRando();
}
}

View file

@ -27,4 +27,15 @@ class Randomizer {
GetItemID GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum);
};
#ifdef __cplusplus
extern "C" {
#endif
void Rando_Init(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -29,6 +29,7 @@
#include "AudioPlayer.h"
#include "Enhancements/debugconsole.h"
#include "Enhancements/debugger/debugger.h"
#include "Enhancements/randomizer.h"
#include "soh/frame_interpolation.h"
#include "Utils/BitConverter.h"
#include "variables.h"
@ -76,6 +77,7 @@ extern "C" void InitOTR() {
OTRMessage_Init();
DebugConsole_Init();
Debug_Init();
Rando_Init();
}
#ifdef _WIN32