diff options
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/core.cpp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index 1772724..9666e53 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -10,6 +10,8 @@ dScKoopatlas_c *dScKoopatlas_c::instance = 0; CREATE_STATE_E(dScKoopatlas_c, Limbo); CREATE_STATE(dScKoopatlas_c, ContinueWait); CREATE_STATE_E(dScKoopatlas_c, Normal); +CREATE_STATE(dScKoopatlas_c, CompletionMsg); +CREATE_STATE_E(dScKoopatlas_c, CompletionMsgHideWait); CREATE_STATE_E(dScKoopatlas_c, CSMenu); CREATE_STATE_E(dScKoopatlas_c, TitleConfirmOpenWait); CREATE_STATE_E(dScKoopatlas_c, TitleConfirmSelect); @@ -499,6 +501,12 @@ void dScKoopatlas_c::endState_ContinueWait() { void dScKoopatlas_c::executeState_Normal() { + if (pathManager.completionMessagePending) { + OSReport("Going to set CompletionMsg\n"); + state.setState(&StateID_CompletionMsg); + return; + } + if (pathManager.doingThings()) return; @@ -1050,6 +1058,79 @@ void dScKoopatlas_c::showSaveWindow() { } +void dScKoopatlas_c::beginState_CompletionMsg() { + OSReport("CompletionMsg beginning with type %d\n", pathManager.completionMessageType); + static const int ynTypes[8] = { + /*NULL*/ -1, + /*COINS*/ 14, + /*EXITS*/ 7, + /*WORLD*/ 8, + /*COINS EXC W9*/ 9, + /*GLOBAL COINS*/ 11, + /*GLOBAL EXITS*/ 27, + /*EVERYTHING*/ 21 + }; + yesNoWindow->type = ynTypes[pathManager.completionMessageType]; + yesNoWindow->visible = true; + mustFixYesNoText = 10; // hacky shit +} + +void dScKoopatlas_c::endState_CompletionMsg() { + pathManager.completionMessagePending = false; + pathManager.completionMessageType = 0; +} + +void dScKoopatlas_c::executeState_CompletionMsg() { + // hacky shit + if (mustFixYesNoText > 0) { + mustFixYesNoText--; + + int type = pathManager.completionMessageType; + + if (type >= CMP_MSG_COINS && type <= CMP_MSG_WORLD) { + // get the stuff we need: base BMG string + static const int bmgs[4] = {-1, 65, 58, 59}; + const wchar_t *baseText = GetBMG()->findStringForMessageID(0, bmgs[type]); + + // title + int w = pathManager.completionMessageWorldNum; + int l = ((w == 5) || (w == 7)) ? 101 : 100; + dLevelInfo_c::entry_s *titleEntry = dLevelInfo_c::s_info.searchByDisplayNum(w, l); + const char *title = dLevelInfo_c::s_info.getNameForLevel(titleEntry); + + // assemble the string + wchar_t text[512]; + + wcscpy(text, baseText); + int pos = wcslen(text); + + text[pos++] = ' '; + + while (*title) + text[pos++] = *(title++); + + text[pos++] = '!'; + text[pos++] = 0; + + yesNoWindow->T_question_00->SetString(text); + yesNoWindow->T_questionS_00->SetString(text); + } + } + + if (!yesNoWindow->animationActive) { + if (Wiimote_TestButtons(GetActiveWiimote(), WPAD_A | WPAD_TWO)) { + yesNoWindow->close = true; + state.setState(&StateID_CompletionMsgHideWait); + } + } +} + +void dScKoopatlas_c::executeState_CompletionMsgHideWait() { + if (!yesNoWindow->visible) + state.setState(&StateID_Normal); +} + + void NewerMapDrawFunc() { Reset3DState(); SetCurrentCameraID(0); |