NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_yes_no_window.cpp
Go to the documentation of this file.
1#include <game/bases/d_yes_no_window.hpp>
3#include <game/framework/f_profile_name.hpp>
5#include <game/bases/d_game_com.hpp>
6#include <game/bases/d_cursor_select.hpp>
7#include <game/snd/snd_audio_mgr.hpp>
8#include <game/bases/d_info.hpp>
9#include <game/bases/d_s_world_map_static.hpp>
13/// @file
14
16STATE_DEFINE(dYesNoWindow_c, OpenAnimeEndWait);
17STATE_DEFINE(dYesNoWindow_c, ButtonOnStageAnimeEndWait);
18STATE_DEFINE(dYesNoWindow_c, ButtonChangeAnimeEndWait);
19STATE_DEFINE(dYesNoWindow_c, SelectWait);
20STATE_DEFINE(dYesNoWindow_c, HitAnimeEndWait);
21STATE_DEFINE(dYesNoWindow_c, ClouseAnimeEndWait);
22STATE_DEFINE(dYesNoWindow_c, HitAnimeAfterWait);
23
24BASE_PROFILE(YES_NO_WINDOW, dYesNoWindow_c);
25
26dYesNoWindow_c::dYesNoWindow_c() :
27 mStateMgr(*this, StateID_InitWait),
28 mHasLoadedLayout(false) {}
29
30dYesNoWindow_c::~dYesNoWindow_c() {}
31
33 static const char *AnmNameTbl[] = {
34 "yesnoWindow_11_inWindow.brlan",
35 "yesnoWindow_11_loopWindow.brlan",
36 "yesnoWindow_11_inYesNoButton.brlan",
37 "yesnoWindow_11_onYesNoButton.brlan",
38 "yesnoWindow_11_idleYesNoButton.brlan",
39 "yesnoWindow_11_hitYesNoButton.brlan",
40 "yesnoWindow_11_offYesNoButton.brlan",
41 "yesnoWindow_11_inBG.brlan",
42 "yesnoWindow_11_outBG.brlan",
43 "yesnoWindow_11_outWindow.brlan"
44 };
45
46 static const int ANIME_INDEX_TBL[ANIM_COUNT] = {
47 inWindow,
48 inWindow,
49 loopWindow,
50 loopWindow,
51 inYesNoButton,
52 inYesNoButton,
53 inYesNoButton,
54 onYesNoButton,
55 onYesNoButton,
56 onYesNoButton,
57 idleYesNoButton,
58 idleYesNoButton,
59 idleYesNoButton,
60 hitYesNoButton,
61 hitYesNoButton,
62 hitYesNoButton,
63 hitYesNoButton,
64 offYesNoButton,
65 offYesNoButton,
66 offYesNoButton,
67 inBG,
68 outBG,
69 outWindow
70 };
71
72 static const char *GROUP_NAME_DT[ANIM_COUNT] = {
73 "A00_inWindow",
74 "D00_save00",
75 "A00_inWindow",
76 "D00_save00",
77 "B00_yesButton_00",
78 "B01_noButton_00",
79 "B02_centerButton",
80 "B00_yesButton_00",
81 "B01_noButton_00",
82 "B02_centerButton",
83 "B00_yesButton_00",
84 "B01_noButton_00",
85 "B02_centerButton",
86 "B00_yesButton_00",
87 "B01_noButton_00",
88 "B02_centerButton",
89 "D00_save00",
90 "B00_yesButton_00",
91 "B01_noButton_00",
92 "B02_centerButton",
93 "C00_BG_00",
94 "C00_BG_00",
95 "A00_inWindow"
96 };
97
98 static const int MESSAGE_DATA_TBL[] = {MSG_OK, MSG_OK, MSG_WATCH_HINT_MOVIE, MSG_WATCH_HINT_MOVIE};
99 static const char *T_PANE_FIXED_NAME_TBL[] = {
100 "T_center_00",
101 "T_center_01",
102 "T_otehonTextS_00",
103 "T_otehonText_00"
104 };
105 static const char *PPANE_NAME_DT[] = {
106 "P_yesBase_00",
107 "P_noBase_00",
108 "P_centerBase_00"
109 };
110 static const char *T_PANE_NAME_TBL[] = {
111 "T_questionS_00",
112 "T_question_00",
113 "T_otehonTextS_01",
114 "T_otehonText_01",
115 "T_needCoinX_00",
116 "T_needCoin_00",
117 "T_yes_00",
118 "T_yes_01",
119 "T_no_00",
120 "T_no_01"
121 };
122 static const char *NPANE_NAME_DT[] = {
123 "N_otehonText_00",
124 "N_saveIcon_00"
125 };
126
127 if (mHasLoadedLayout) {
128 return SUCCEEDED;
129 }
130
131 if (!mLayout.ReadResource("yesnoWindow/yesnoWindow.arc", false)) {
132 return NOT_READY;
133 }
134
135 mLayout.build("yesnoWindow_11.brlyt", nullptr);
136 mLayout.AnimeResRegister(AnmNameTbl, ARRAY_SIZE(AnmNameTbl));
137 mLayout.GroupRegister(GROUP_NAME_DT, ANIME_INDEX_TBL, ARRAY_SIZE(GROUP_NAME_DT));
138 mLayout.TPaneNameRegister(T_PANE_FIXED_NAME_TBL, MESSAGE_DATA_TBL, BMG_CATEGORY_YES_NO_WINDOW, ARRAY_SIZE(T_PANE_FIXED_NAME_TBL));
139
140 mLayout.mDrawOrder = m2d::DRAW_ORDER_YES_NO_WINDOW;
141 mpRootPane = mLayout.getRootPane();
142
143 mLayout.PPaneRegister(PPANE_NAME_DT, mpPictures, ARRAY_SIZE(PPANE_NAME_DT));
144 mLayout.TPaneRegister(T_PANE_NAME_TBL, mpTextBoxes, ARRAY_SIZE(T_PANE_NAME_TBL));
145 mLayout.NPaneRegister(NPANE_NAME_DT, mpNullPanes, ARRAY_SIZE(NPANE_NAME_DT));
146
147 mIsActive = false;
148 mHasLoadedLayout = true;
149 mKeepOpen = false;
151 mCancel = false;
152 mHideBG = false;
153
154 mpRootPane->SetVisible(false);
155
156 mLayout.AllAnimeEndSetup();
157 mLayout.ReverseAnimeStartSetup(ANIM_IN_BG, false);
158 mLayout.AnimePlay();
159 mLayout.calc();
160 return SUCCEEDED;
161}
162
165 mStateMgr.executeState();
166 mLayout.AnimePlay();
167 mLayout.calc();
168 } else if (mHideBG) {
169 mLayout.calc();
170 }
171 return SUCCEEDED;
172}
173
176 mLayout.entry();
177 } else if (mHideBG) {
178 mLayout.entry();
179 }
180 return SUCCEEDED;
181}
182
184 return mLayout.doDelete();
185}
186
187/// @brief The prompt message for each type.
188static const int MainMsgIDs[dYesNoWindow_c::WINDOW_TYPE_COUNT] = {
189 MSG_SAVE_DATA_CREATED, // SAVE_DATA_CREATED
190 MSG_ASK_SAVE, // SAVE
191 MSG_PROGRESS_SAVED, // SAVED
192 MSG_EXIT_FREE_MODE, // EXIT_FREE_MODE
193 MSG_WATCH_HINT_MOVIE, // WATCH_UNLOCKED_HINT_MOVIE
194 MSG_SKIP_COURSE, // SKIP_COURSE
195 MSG_WATCH_HINT_MOVIE, // WATCH_HINT_MOVIE
196 MSG_GOT_ALL_STAR_COINS_NO_W9, // GOT_ALL_STAR_COINS
197 MSG_GOT_ALL_STAR_COINS_W9, // GOT_ALL_STAR_COINS_MENTION_W9
198 MSG_TOADS_CAPTURED, // BOWSERJR_SINGLEPLAYER
199 MSG_RETURN_TO_TITLE, // RETURN_TITLE
200 MSG_TOADS_CAPTURED_MULTIPLAYER, // BOWSERJR_MULTIPLAYER
201 MSG_BACK_TO_MAP, // RETURN_TO_MAP
202 MSG_BACK_TO_COURSE_SELECTION, // BACK_TO_COURSE_SELECTION
203 MSG_GOT_ALL_STAR_COINS_WORLD_X, // GOT_ALL_STAR_COINS_ALL_WORLDS
204 MSG_RETURN_TO_TITLE_QUICK_SAVE, // QUICK_SAVE
205 MSG_SAVED_RETURNING_TO_TITLE, // QUICK_SAVED
206 MSG_TOAD_HOUSES_BACK, // ALL_TOAD_HOUSES_RETURNED
207 MSG_ITEM_HINT, // ITEM_INFO
208 MSG_TRY_WITHOUT_SUPER_GUIDE, // COURSE_CLEAR_WITH_SUPER_GUIDE
209 MSG_SKIP_COURSE, // SKIP_COURSE_CONFIRM
210 MSG_COMPLETED_EVERYTHING, // COMPLETED_EVERYTHING
211 MSG_PROGRESS_SAVED_FIRST_TIME, // PROGRESS_AUTOSAVE_AFTER_W9_UNLOCK
212 MSG_SWITCH_ON_FIRST_TIME, // BLOCK_TRANSFORMATION
213 MSG_SWITCH_OFF_FIRST_TIME, // BLOCK_TRANSFORMATION_REVERSE
214 MSG_EXIT_COIN_BATTLE, // EXIT_COIN_BATTLE
215 MSG_BACK_TO_MAP2, // RETURN_TO_MAP2
216 MSG_PEACH_HINT, // PEACH_CASTLE_HINT1
217 MSG_PEACH_HINT2 // PEACH_CASTLE_HINT2
218};
219
220#define OPTIONS_YES_NO { true, true, false }
221#define OPTIONS_OK { false, false, true }
222
223/// @brief Which buttons are visible in the Yes/No window.
224static const bool PicVisible[dYesNoWindow_c::WINDOW_TYPE_COUNT][dYesNoWindow_c::POS_COUNT] = {
225 OPTIONS_OK, // SAVE_DATA_CREATED
226 OPTIONS_YES_NO, // SAVE
227 OPTIONS_OK, // SAVED
228 OPTIONS_YES_NO, // EXIT_FREE_MODE
229 OPTIONS_YES_NO, // WATCH_UNLOCKED_HINT_MOVIE
230 OPTIONS_OK, // SKIP_COURSE
231 OPTIONS_YES_NO, // WATCH_HINT_MOVIE
232 OPTIONS_OK, // GOT_ALL_STAR_COINS
233 OPTIONS_OK, // GOT_ALL_STAR_COINS_MENTION_W9
234 OPTIONS_OK, // BOWSERJR_SINGLEPLAYER
235 OPTIONS_YES_NO, // RETURN_TITLE
236 OPTIONS_OK, // BOWSERJR_MULTIPLAYER
237 OPTIONS_YES_NO, // RETURN_TO_MAP
238 OPTIONS_YES_NO, // BACK_TO_COURSE_SELECTION
239 OPTIONS_OK, // GOT_ALL_STAR_COINS_ALL_WORLDS
240 OPTIONS_YES_NO, // QUICK_SAVE
241 OPTIONS_OK, // QUICK_SAVED
242 OPTIONS_OK, // ALL_TOAD_HOUSES_RETURNED
243 OPTIONS_OK, // ITEM_INFO
244 OPTIONS_YES_NO, // COURSE_CLEAR_WITH_SUPER_GUIDE
245 OPTIONS_YES_NO, // SKIP_COURSE_CONFIRM
246 OPTIONS_OK, // COMPLETED_EVERYTHING
247 OPTIONS_OK, // PROGRESS_AUTOSAVE_AFTER_W9_UNLOCK
248 OPTIONS_OK, // BLOCK_TRANSFORMATION
249 OPTIONS_OK, // BLOCK_TRANSFORMATION_REVERSE
250 OPTIONS_YES_NO, // EXIT_COIN_BATTLE
251 OPTIONS_YES_NO, // RETURN_TO_MAP2
252 OPTIONS_OK, // PEACH_CASTLE_HINT1
253 OPTIONS_OK // PEACH_CASTLE_HINT2
254};
255
256/// @brief Starting cursor positions for the Yes/No window.
257static const int StartingCursorPositions[dYesNoWindow_c::WINDOW_TYPE_COUNT] = {
258 dYesNoWindow_c::POS_OK, // SAVE_DATA_CREATED
259 dYesNoWindow_c::POS_YES, // SAVE
260 dYesNoWindow_c::POS_OK, // SAVED
261 dYesNoWindow_c::POS_NO, // EXIT_FREE_MODE
262 dYesNoWindow_c::POS_NO, // WATCH_UNLOCKED_HINT_MOVIE
263 dYesNoWindow_c::POS_OK, // SKIP_COURSE
264 dYesNoWindow_c::POS_NO, // WATCH_HINT_MOVIE
265 dYesNoWindow_c::POS_OK, // GOT_ALL_STAR_COINS
266 dYesNoWindow_c::POS_OK, // GOT_ALL_STAR_COINS_MENTION_W9
267 dYesNoWindow_c::POS_OK, // BOWSERJR_SINGLEPLAYER
268 dYesNoWindow_c::POS_NO, // RETURN_TITLE
269 dYesNoWindow_c::POS_OK, // BOWSERJR_MULTIPLAYER
270 dYesNoWindow_c::POS_NO, // RETURN_TO_MAP
271 dYesNoWindow_c::POS_NO, // BACK_TO_COURSE_SELECTION
272 dYesNoWindow_c::POS_OK, // GOT_ALL_STAR_COINS_ALL_WORLDS
273 dYesNoWindow_c::POS_YES, // QUICK_SAVE
274 dYesNoWindow_c::POS_OK, // QUICK_SAVED
275 dYesNoWindow_c::POS_OK, // ALL_TOAD_HOUSES_RETURNED
276 dYesNoWindow_c::POS_OK, // ITEM_INFO
277 dYesNoWindow_c::POS_YES, // COURSE_CLEAR_WITH_SUPER_GUIDE
278 dYesNoWindow_c::POS_NO, // SKIP_COURSE_CONFIRM
279 dYesNoWindow_c::POS_OK, // COMPLETED_EVERYTHING
280 dYesNoWindow_c::POS_OK, // PROGRESS_AUTOSAVE_AFTER_W9_UNLOCK
281 dYesNoWindow_c::POS_OK, // BLOCK_TRANSFORMATION
282 dYesNoWindow_c::POS_OK, // BLOCK_TRANSFORMATION_REVERSE
283 dYesNoWindow_c::POS_NO, // EXIT_COIN_BATTLE
284 dYesNoWindow_c::POS_NO, // RETURN_TO_MAP2
285 dYesNoWindow_c::POS_OK, // PEACH_CASTLE_HINT1
286 dYesNoWindow_c::POS_OK // PEACH_CASTLE_HINT2
287};
288
289const int SoundEffects[] = { SE_SYS_BACK, SE_SYS_DECIDE, SE_SYS_CURSOR, SE_SYS_DIALOGUE_IN };
290
292 static int fillLeftReqStarCoins = 2;
293 MsgRes_c *msgRes = dMessage_c::getMesRes();
294
295 int mainMsgID = MainMsgIDs[mType];
296 if (mType == WATCH_HINT_MOVIE) {
297 dGameCom::LayoutDispNumber(mStarCoinsRequired, fillLeftReqStarCoins, mpTextBoxes[T_needCoin_00], true);
298
299 mpTextBoxes[T_otehonTextS_01]->setMessage(msgRes, BMG_CATEGORY_HINT_MOVIES, MSG_STAR_COINS_REQUIRED, 0);
300 mpTextBoxes[T_otehonText_01]->setMessage(msgRes, BMG_CATEGORY_HINT_MOVIES, MSG_STAR_COINS_REQUIRED, 0);
301 mpTextBoxes[T_needCoinX_00]->setMessage(msgRes, BMG_CATEGORY_HINT_MOVIES, MSG_STAR_COINS_REQUIRED_X, 0);
302 mpTextBoxes[T_questionS_00]->SetVisible(false);
303 mpNullPanes[N_otehonText_00]->SetVisible(true);
304 } else {
305 if (mType == GOT_ALL_STAR_COINS_ALL_WORLDS) {
306 dInfo_c::m_instance->mDisplayCourseWorld = dScWMap_c::m_WorldNo + 1;
307 }
308 if (mType == SKIP_COURSE_CONFIRM &&
309 dInfo_c::m_startGameInfo.mWorld1 == WORLD_8 &&
310 dInfo_c::m_startGameInfo.mLevel1 == STAGE_CASTLE)
311 {
312 mainMsgID = MSG_SKIP_FINAL_COURSE;
313 }
314
315 mpTextBoxes[T_questionS_00]->SetVisible(true);
316 mpNullPanes[N_otehonText_00]->SetVisible(false);
317 mpTextBoxes[T_questionS_00]->setMessage(msgRes, BMG_CATEGORY_YES_NO_WINDOW, mainMsgID, 0);
318 mpTextBoxes[T_question_00]->setMessage(msgRes, BMG_CATEGORY_YES_NO_WINDOW, mainMsgID, 0);
319 }
320
321 // Set visibility of Yes/No/OK buttons
322 for (int i = 0; i < 3;) {
323 bool isVisible = PicVisible[mType][i];
324 mpPictures[i++]->SetVisible(isVisible);
325 }
326
328
329 // Set text in Yes/No/OK buttons
330 int bmgIDForYesButton, bmgIDForNoButton;
331 if (mType == SAVE) {
332 bmgIDForYesButton = MSG_SAVE;
333 bmgIDForNoButton = MSG_DONT_SAVE;
334 } else if (mType == QUICK_SAVE) {
335 bmgIDForYesButton = MSG_QUICK_SAVE;
336 bmgIDForNoButton = MSG_DONT_SAVE;
337 } else if (mType == COURSE_CLEAR_WITH_SUPER_GUIDE) {
338 bmgIDForYesButton = MSG_OK_TRY;
339 bmgIDForNoButton = MSG_NO_SKIP;
340 } else if (mType == SKIP_COURSE_CONFIRM) {
341 bmgIDForYesButton = MSG_YES_IM_SURE;
342 bmgIDForNoButton = MSG_NO_WAIT;
343
344 // Show a different message if the player wants to skip the final course
345 if (dInfo_c::m_startGameInfo.mWorld1 == WORLD_8 && dInfo_c::m_startGameInfo.mLevel1 == STAGE_CASTLE) {
346 bmgIDForYesButton = MSG_WATCH_ENDING;
347 }
348 } else {
349 bmgIDForNoButton = MSG_CANCEL;
350 if (mType == WATCH_UNLOCKED_HINT_MOVIE || mType == WATCH_HINT_MOVIE) {
351 bmgIDForYesButton = MSG_SAVED_OK;
352 } else {
353 bmgIDForYesButton = MSG_OK;
354 }
355 }
356
357 mpTextBoxes[T_yes_00]->setMessage(msgRes, BMG_CATEGORY_YES_NO_WINDOW, bmgIDForYesButton, false);
358 mpTextBoxes[T_yes_01]->setMessage(msgRes, BMG_CATEGORY_YES_NO_WINDOW, bmgIDForYesButton, false);
359 mpTextBoxes[T_no_00]->setMessage(msgRes, BMG_CATEGORY_YES_NO_WINDOW, bmgIDForNoButton, false);
360 mpTextBoxes[T_no_01]->setMessage(msgRes, BMG_CATEGORY_YES_NO_WINDOW, bmgIDForNoButton, false);
361
362 if (mType == QUICK_SAVED) {
363 mpNullPanes[N_saveIcon_00]->SetVisible(true);
364 } else {
365 mpNullPanes[N_saveIcon_00]->SetVisible(false);
366 }
367}
368
369// ----------------
370// StateID_InitWait
371// ----------------
372
373void dYesNoWindow_c::initializeState_InitWait() {
374 if (mHideBG) {
375 return;
376 }
377 mpRootPane->SetVisible(false);
378}
379
380void dYesNoWindow_c::executeState_InitWait() {
381 mIsActive = true;
382 mIsAnimating = false;
383 mKeepOpen = false;
384
386}
387
388void dYesNoWindow_c::finalizeState_InitWait() {}
389
390// ------------------------
391// StateID_OpenAnimeEndWait
392// ------------------------
393
394void dYesNoWindow_c::initializeState_OpenAnimeEndWait() {
395 mCancel = false;
396 mpRootPane->SetVisible(true);
397 mIsAnimating = true;
398
399 mLayout.AllAnimeEndSetup();
400 mLayout.ReverseAnimeStartSetup(ANIM_IN_YES, false);
401 mLayout.ReverseAnimeStartSetup(ANIM_IN_NO, false);
402 mLayout.ReverseAnimeStartSetup(ANIM_IN_OK, false);
403
404 switch (mType) {
405 case SAVE:
406 case SAVED:
407 case EXIT_FREE_MODE:
408 case WATCH_UNLOCKED_HINT_MOVIE:
409 case WATCH_HINT_MOVIE:
410 case RETURN_TITLE:
411 case QUICK_SAVE:
412 case QUICK_SAVED:
413 case ITEM_INFO:
414 case EXIT_COIN_BATTLE:
415 case PEACH_CASTLE_HINT1:
416 case PEACH_CASTLE_HINT2:
417 if (!mHideBG) {
418 mLayout.AnimeStartSetup(ANIM_IN_BG, false);
419 }
420 break;
421 default:
422 break;
423 }
424 if (mType == QUICK_SAVED) {
425 mLayout.AnimeStartSetup(ANIM_IN_QUICK_SAVE, false);
426 }
427 mLayout.AnimeStartSetup(ANIM_IN_WINDOW, false);
428 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_OPEN_ANIME], 1);
429
431}
432
433void dYesNoWindow_c::executeState_OpenAnimeEndWait() {
434 if (!mLayout.isAllAnime()) {
435 mHitButton = false;
437 }
438}
439
440void dYesNoWindow_c::finalizeState_OpenAnimeEndWait() {
441 mIsAnimating = false;
442 mHideBG = false;
443}
444
445// ---------------------------------
446// StateID_ButtonOnStageAnimeEndWait
447// ---------------------------------
448
449void dYesNoWindow_c::initializeState_ButtonOnStageAnimeEndWait() {
450 mIsAnimating = true;
451 mLayout.AnimeStartSetup(ANIM_IN_YES, false);
452 mLayout.AnimeStartSetup(ANIM_IN_NO, false);
453 mLayout.AnimeStartSetup(ANIM_IN_OK, false);
454}
455void dYesNoWindow_c::executeState_ButtonOnStageAnimeEndWait() {
456 if (!mLayout.isAllAnime()) {
458 }
459}
460void dYesNoWindow_c::finalizeState_ButtonOnStageAnimeEndWait() {
461 mPrevCursorPos = -1;
462 mIsAnimating = false;
463}
464
465// --------------------------------
466// StateID_ButtonChangeAnimeEndWait
467// --------------------------------
468
469void dYesNoWindow_c::initializeState_ButtonChangeAnimeEndWait() {
470 mIsAnimating = true;
471
472 mLayout.AllAnimeEndSetup();
473 if (mPrevCursorPos >= 0) {
474 // ID 17 is the exit animation for button 0 (Yes)
475 mLayout.AnimeStartSetup(ANIM_OFF_YES + mPrevCursorPos, false);
476 }
478
479 // ID 7 is the in animation for button 0 (Yes)
480 mLayout.AnimeStartSetup(ANIM_ON_YES + mCursorPos, false);
481}
482
483void dYesNoWindow_c::executeState_ButtonChangeAnimeEndWait() {
484 if (!mLayout.isAnime(-1)) {
485 mStateMgr.changeState(StateID_SelectWait);
486 }
487}
488
489void dYesNoWindow_c::finalizeState_ButtonChangeAnimeEndWait() {
490 mIsAnimating = false;
491}
492
493// ------------------
494// StateID_SelectWait
495// ------------------
496
497void dYesNoWindow_c::initializeState_SelectWait() {
498 if (mType == QUICK_SAVED) {
499 mLayout.LoopAnimeStartSetup(ANIM_LOOP_QUICK_SAVE);
500 }
501 mLayout.LoopAnimeStartSetup(ANIM_LOOP_WINDOW);
502 dGameCom::SelectCursorSetup(mpPictures[mCursorPos], 0, false);
503}
504
505void dYesNoWindow_c::executeState_SelectWait() {
506 if (mCancel) {
507 if (mType == QUICK_SAVED) {
508 mLayout.AllAnimeEndSetup();
509 mLayout.AnimeStartSetup(ANIM_HIT_QUICK_SAVE, false);
510 }
512 return;
513 }
514
515 if (mHitButton) {
516 if (mType == RETURN_TO_MAP || mType == RETURN_TO_MAP2 || mType == BACK_TO_COURSE_SELECTION) {
517 if (mCursorPos == POS_YES) {
518 // Stop game music
520 }
521 }
523 return;
524 }
525
526 if (mPrevCursorPos != mCursorPos) {
527 // Cursor moved
528
529 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_CURSOR_MOVE], 1);
531 }
532}
533
534void dYesNoWindow_c::finalizeState_SelectWait() {
535 dSelectCursor_c::m_instance->Cancel(0);
536}
537
538// -----------------------
539// StateID_HitAnimeEndWait
540// -----------------------
541
542void dYesNoWindow_c::initializeState_HitAnimeEndWait() {
543 mLayout.AllAnimeEndSetup();
544 mIsAnimating = true;
545 mHitButton = false;
546
547 if (mType == QUICK_SAVED) {
548 mLayout.AnimeStartSetup(ANIM_HIT_QUICK_SAVE, false);
549 }
550 mLayout.AnimeStartSetup(ANIM_HIT_YES + mCursorPos, false);
551 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_WAIT], 1);
552}
553
554void dYesNoWindow_c::executeState_HitAnimeEndWait() {
555 if (!mLayout.isAnime(-1)) {
556 if (mKeepOpen) {
558 } else {
560 }
561 }
562}
563
564void dYesNoWindow_c::finalizeState_HitAnimeEndWait() {
565 mIsAnimating = false;
566}
567
568// --------------------------
569// StateID_ClouseAnimeEndWait
570// --------------------------
571
572void dYesNoWindow_c::initializeState_ClouseAnimeEndWait() {
573 mIsAnimating = true;
574 mLayout.AllAnimeEndSetup();
575 switch (mType) {
576 case SAVE:
577 case SAVED:
578 case EXIT_FREE_MODE:
579 case WATCH_UNLOCKED_HINT_MOVIE:
580 case WATCH_HINT_MOVIE:
581 case RETURN_TITLE:
582 case QUICK_SAVE:
583 case QUICK_SAVED:
584 case ITEM_INFO:
585 case EXIT_COIN_BATTLE:
586 case PEACH_CASTLE_HINT1:
587 case PEACH_CASTLE_HINT2:
588 if (!mHideBG) {
589 mLayout.AnimeStartSetup(ANIM_OUT_BG, false);
590 }
591 break;
592 default:
593 break;
594 }
595 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_CLOSE], 1);
596 mLayout.AnimeStartSetup(ANIM_OUT_WINDOW, false);
597}
598
599void dYesNoWindow_c::executeState_ClouseAnimeEndWait() {
600 if (!mLayout.isAnime(-1)) {
601 mIsActive = false;
602 mStateMgr.changeState(StateID_InitWait);
603 }
604}
605
606void dYesNoWindow_c::finalizeState_ClouseAnimeEndWait() {
607 mIsAnimating = false;
608}
609
610// -------------------------
611// StateID_HitAnimeAfterWait
612// -------------------------
613
614void dYesNoWindow_c::initializeState_HitAnimeAfterWait() {
615 mHitButton = false;
616}
617
618void dYesNoWindow_c::executeState_HitAnimeAfterWait() {}
619
620void dYesNoWindow_c::finalizeState_HitAnimeAfterWait() {}
Displays a confirmation prompt.
static sFStateID_c< dYesNoWindow_c > StateID_OpenAnimeEndWait
Waiting for the window to finish the opening animation.
nw4r::lyt::Pane * mpRootPane
The root pane of the window.
bool mIsActive
Whether the window is currently open.
static sFStateID_c< dYesNoWindow_c > StateID_HitAnimeAfterWait
Waiting in an infinite loop after the button was pressed.
bool mHasLoadedLayout
Whether the layout has been loaded.
bool mHitButton
Whether a button has been pressed.
bool mKeepOpen
Whether the window should stay open after a button has been pressed.
LytBase_c mLayout
The layout for the window.
sFStateMgr_c< dYesNoWindow_c, sStateMethodUsr_FI_c > mStateMgr
The state manager for the window.
virtual int execute()
do method for the execute operation.
static sFStateID_c< dYesNoWindow_c > StateID_InitWait
Initial state. Switches to OpenAnimeStartWait immediately.
bool mIsAnimating
Whether an animation is currently playing.
WINDOW_TYPE_e mType
The type of the window.
static sFStateID_c< dYesNoWindow_c > StateID_HitAnimeEndWait
Waiting for the button to finish the hit animation.
LytTextBox_c * mpTextBoxes[T_COUNT]
The text boxes.
int mPrevCursorPos
The previous cursor position.
static sFStateID_c< dYesNoWindow_c > StateID_SelectWait
Waiting for either a button change or button hit to occur.
virtual int doDelete()
do method for the delete operation.
virtual int draw()
do method for the draw operation.
static sFStateID_c< dYesNoWindow_c > StateID_ButtonOnStageAnimeEndWait
Plays the button appearing animation and waits for it to finish.
static sFStateID_c< dYesNoWindow_c > StateID_ButtonChangeAnimeEndWait
Playing the button change animations.
nw4r::lyt::Pane * mpNullPanes[N_COUNT]
The null panes.
int mStarCoinsRequired
The number of star coins required to unlock a hint movie.
bool mCancel
Whether the window has been cancelled (and closed).
static sFStateID_c< dYesNoWindow_c > StateID_ClouseAnimeEndWait
Waiting for the window to finish the closing animation.
bool mHideBG
Whether to hide the translucent background that fills the screen.
nw4r::lyt::Picture * mpPictures[P_COUNT]
The picture panes.
virtual int create()
do method for the create operation.
void populateLayout()
Fills out the window content according to the settings.
int mCursorPos
The current cursor position.
@ NOT_READY
The step could not completed at this time.
Definition f_base.hpp:43
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:44
void pauseOffGameWithReset()
static const bool PicVisible[dYesNoWindow_c::WINDOW_TYPE_COUNT][dYesNoWindow_c::POS_COUNT]
Which buttons are visible in the Yes/No window.
static const int StartingCursorPositions[dYesNoWindow_c::WINDOW_TYPE_COUNT]
Starting cursor positions for the Yes/No window.
static const int MainMsgIDs[dYesNoWindow_c::WINDOW_TYPE_COUNT]
The prompt message for each type.
#define BASE_PROFILE(profName, className)
Creates a basic profile, using the profile number as the execute and draw order value.
Definition f_profile.hpp:23
#define STATE_DEFINE(class, name)
Defines a state.
Definition s_State.hpp:36