summaryrefslogtreecommitdiff
path: root/src/koopatlas/core.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2013-02-25 22:03:47 +0100
committerTreeki <treeki@gmail.com>2013-02-25 22:03:47 +0100
commit027164e4b4baa4ac02ad8647b9977798c540297a (patch)
tree04b54ca80bcb98ac928ea02eafe0dd69fdded148 /src/koopatlas/core.cpp
parent6cfe2dd3ddce416e8884dd61218751bc5c77e54c (diff)
downloadkamek-027164e4b4baa4ac02ad8647b9977798c540297a.tar.gz
kamek-027164e4b4baa4ac02ad8647b9977798c540297a.zip
implement completion congratulations messages
Diffstat (limited to 'src/koopatlas/core.cpp')
-rw-r--r--src/koopatlas/core.cpp81
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);