mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-08 20:38:27 -05:00
Check Tracker - Loading Fixes
- Fixes a bug where loading a save file a second time would add all the checks again - Fixes a bug where the check tracker would not render at all until in a save file
This commit is contained in:
parent
29b7c45d70
commit
60ec5bb9be
@ -17,6 +17,7 @@ extern PlayState* gPlayState;
|
|||||||
}
|
}
|
||||||
extern "C" uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);
|
extern "C" uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);
|
||||||
|
|
||||||
|
void Teardown();
|
||||||
void InitializeChecks();
|
void InitializeChecks();
|
||||||
void UpdateChecks();
|
void UpdateChecks();
|
||||||
void DrawLocation(RandomizerCheckObject rcObj, RandomizerCheckShow* thisCheckStatus);
|
void DrawLocation(RandomizerCheckObject rcObj, RandomizerCheckShow* thisCheckStatus);
|
||||||
@ -85,17 +86,14 @@ std::vector<uint32_t> buttons = { BTN_A, BTN_B, BTN_CUP, BTN_CDOWN, BTN_CLEFT,
|
|||||||
BTN_Z, BTN_R, BTN_START, BTN_DUP, BTN_DDOWN, BTN_DLEFT, BTN_DRIGHT };
|
BTN_Z, BTN_R, BTN_START, BTN_DUP, BTN_DDOWN, BTN_DLEFT, BTN_DRIGHT };
|
||||||
|
|
||||||
void DrawCheckTracker(bool& open) {
|
void DrawCheckTracker(bool& open) {
|
||||||
if (doInitialize)
|
|
||||||
InitializeChecks();
|
|
||||||
|
|
||||||
if (!initialized)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!open) {
|
if (!open) {
|
||||||
CVar_SetS32("gCheckTrackerEnabled", 0);
|
CVar_SetS32("gCheckTrackerEnabled", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doInitialize)
|
||||||
|
InitializeChecks();
|
||||||
|
|
||||||
if (CVar_GetS32("gCheckTrackerWindowType", 1) == 0) {
|
if (CVar_GetS32("gCheckTrackerWindowType", 1) == 0) {
|
||||||
if (CVar_GetS32("gCheckTrackerShowOnlyPaused", 0) == 1)
|
if (CVar_GetS32("gCheckTrackerShowOnlyPaused", 0) == 1)
|
||||||
if (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)
|
if (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)
|
||||||
@ -112,6 +110,18 @@ void DrawCheckTracker(bool& open) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BeginFloatWindows("Check Tracker", ImGuiWindowFlags_NoScrollbar);
|
||||||
|
|
||||||
|
if (!initialized) {
|
||||||
|
ImGui::Text("Waiting for file load...");
|
||||||
|
EndFloatWindows();
|
||||||
|
return;
|
||||||
|
} else if (gPlayState == nullptr || gSaveContext.fileNum < 0 || gSaveContext.fileNum > 2) {
|
||||||
|
Teardown();
|
||||||
|
EndFloatWindows();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SceneID sceneId = SCENE_ID_MAX;
|
SceneID sceneId = SCENE_ID_MAX;
|
||||||
if (gPlayState != nullptr) {
|
if (gPlayState != nullptr) {
|
||||||
sceneId = (SceneID)gPlayState->sceneNum;
|
sceneId = (SceneID)gPlayState->sceneNum;
|
||||||
@ -132,7 +142,6 @@ void DrawCheckTracker(bool& open) {
|
|||||||
UpdateOrdering();
|
UpdateOrdering();
|
||||||
}
|
}
|
||||||
|
|
||||||
BeginFloatWindows("Check Tracker", ImGuiWindowFlags_NoScrollbar);
|
|
||||||
|
|
||||||
//Quick Options
|
//Quick Options
|
||||||
#ifdef __WIIU__
|
#ifdef __WIIU__
|
||||||
@ -331,7 +340,7 @@ void InitializeChecks() {
|
|||||||
|
|
||||||
void Teardown() {
|
void Teardown() {
|
||||||
initialized = false;
|
initialized = false;
|
||||||
//delete checkStatus; //TODO may cause crashes due to race conditions during a draw cycle, but if you don't have it, then there's a memory leak when switching files
|
checkStatusMap.clear();
|
||||||
areasFullyChecked = 0;
|
areasFullyChecked = 0;
|
||||||
checks.clear();
|
checks.clear();
|
||||||
lastSaveCount = -1;
|
lastSaveCount = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user