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>
4#include <game/bases/d_audio.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>
14
15STATE_DEFINE(dYesNoWindow_c, InitWait);
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 *animeNames[] = {
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 groupIdxs[] = {0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 8, 9, 0};
47 static const char *groupNames[] = {
48 "A00_inWindow",
49 "D00_save00",
50 "A00_inWindow",
51 "D00_save00",
52 "B00_yesButton_00",
53 "B01_noButton_00",
54 "B02_centerButton",
55 "B00_yesButton_00",
56 "B01_noButton_00",
57 "B02_centerButton",
58 "B00_yesButton_00",
59 "B01_noButton_00",
60 "B02_centerButton",
61 "B00_yesButton_00",
62 "B01_noButton_00",
63 "B02_centerButton",
64 "D00_save00",
65 "B00_yesButton_00",
66 "B01_noButton_00",
67 "B02_centerButton",
68 "C00_BG_00",
69 "C00_BG_00",
70 "A00_inWindow"
71 };
72
73 static const int textBoxVals[] = {MSG_OK, MSG_OK, MSG_WATCH_HINT_MOVIE, MSG_WATCH_HINT_MOVIE};
74 static const char *textBoxNames[] = {
75 "T_center_00",
76 "T_center_01",
77 "T_otehonTextS_00",
78 "T_otehonText_00"
79 };
80 static const char *pictureNames[] = {
81 "P_yesBase_00",
82 "P_noBase_00",
83 "P_centerBase_00"
84 };
85 static const char *textboxNames[] = {
86 "T_questionS_00",
87 "T_question_00",
88 "T_otehonTextS_01",
89 "T_otehonText_01",
90 "T_needCoinX_00",
91 "T_needCoin_00",
92 "T_yes_00",
93 "T_yes_01",
94 "T_no_00",
95 "T_no_01"
96 };
97 static const char *paneNames[] = {
98 "N_otehonText_00",
99 "N_saveIcon_00"
100 };
101
102 if (mHasLoadedLayout) {
103 return SUCCEEDED;
104 }
105
106 if (!mLayout.ReadResource("yesnoWindow/yesnoWindow.arc", false)) {
107 return NOT_READY;
108 }
109
110 mLayout.build("yesnoWindow_11.brlyt", nullptr);
111 mLayout.AnimeResRegister(animeNames, ARRAY_SIZE(animeNames));
112 mLayout.GroupRegister(groupNames, groupIdxs, ARRAY_SIZE(groupNames));
113 mLayout.TPaneNameRegister(textBoxNames, textBoxVals, BMG_CATEGORY_YES_NO_WINDOW, ARRAY_SIZE(textBoxNames));
114
115 mLayout.mDrawOrder = 143;
116 mpRootPane = mLayout.getRootPane();
117
118 mLayout.PPaneRegister(pictureNames, &P_yesBase_00, ARRAY_SIZE(pictureNames));
119 mLayout.TPaneRegister(textboxNames, &T_questionS_00, ARRAY_SIZE(textboxNames));
120 mLayout.NPaneRegister(paneNames, &N_otehonText_00, ARRAY_SIZE(paneNames));
121
122 mIsActive = false;
123 mHasLoadedLayout = true;
124 mKeepOpen = false;
126 mCancel = false;
127 mHideBG = false;
128
129 mpRootPane->mFlags &= ~1;
130
131 mLayout.AllAnimeEndSetup();
132 mLayout.ReverseAnimeStartSetup(ANIM_IN_BG, false);
133 mLayout.AnimePlay();
134 mLayout.calc();
135 return SUCCEEDED;
136}
137
141 mLayout.AnimePlay();
142 mLayout.calc();
143 } else if (mHideBG) {
144 mLayout.calc();
145 }
146 return SUCCEEDED;
147}
148
151 mLayout.entry();
152 } else if (mHideBG) {
153 mLayout.entry();
154 }
155 return SUCCEEDED;
156}
157
159 return mLayout.doDelete();
160}
161
163static const int MainMsgIDs[] = {
164 MSG_SAVE_DATA_CREATED, // SAVE_DATA_CREATED
165 MSG_ASK_SAVE, // SAVE
166 MSG_PROGRESS_SAVED, // SAVED
167 MSG_EXIT_FREE_MODE, // EXIT_FREE_MODE
168 MSG_WATCH_HINT_MOVIE, // WATCH_UNLOCKED_HINT_MOVIE
169 MSG_SKIP_COURSE, // SKIP_COURSE
170 MSG_WATCH_HINT_MOVIE, // WATCH_HINT_MOVIE
171 MSG_GOT_ALL_STAR_COINS_NO_W9, // GOT_ALL_STAR_COINS
172 MSG_GOT_ALL_STAR_COINS_W9, // GOT_ALL_STAR_COINS_MENTION_W9
173 MSG_TOADS_CAPTURED, // BOWSERJR_SINGLEPLAYER
174 MSG_RETURN_TO_TITLE, // RETURN_TITLE
175 MSG_TOADS_CAPTURED_MULTIPLAYER, // BOWSERJR_MULTIPLAYER
176 MSG_BACK_TO_MAP, // RETURN_TO_MAP
177 MSG_BACK_TO_COURSE_SELECTION, // BACK_TO_COURSE_SELECTION
178 MSG_GOT_ALL_STAR_COINS_WORLD_X, // GOT_ALL_STAR_COINS_ALL_WORLDS
179 MSG_RETURN_TO_TITLE_QUICK_SAVE, // QUICK_SAVE
180 MSG_SAVED_RETURNING_TO_TITLE, // QUICK_SAVED
181 MSG_TOAD_HOUSES_BACK, // ALL_TOAD_HOUSES_RETURNED
182 MSG_ITEM_HINT, // ITEM_INFO
183 MSG_TRY_WITHOUT_SUPER_GUIDE, // COURSE_CLEAR_WITH_SUPER_GUIDE
184 MSG_SKIP_COURSE, // SKIP_COURSE_CONFIRM
185 MSG_COMPLETED_EVERYTHING, // COMPLETED_EVERYTHING
186 MSG_PROGRESS_SAVED_FIRST_TIME, // PROGRESS_AUTOSAVE_AFTER_W9_UNLOCK
187 MSG_SWITCH_FIRST_TIME, // BLOCK_TRANSFORMATION
188 MSG_SWITCH, // BLOCK_TRANSFORMATION_REVERSE
189 MSG_EXIT_COIN_BATTLE, // EXIT_COIN_BATTLE
190 MSG_BACK_TO_MAP2, // RETURN_TO_MAP2
191 MSG_PEACH_HINT, // PEACH_CASTLE_HINT1
192 MSG_PEACH_HINT2 // PEACH_CASTLE_HINT2
193};
194
195#define OPTIONS_YES_NO { true, true, false }
196#define OPTIONS_OK { false, false, true }
197
199static const bool PicVisible[][3] = {
200 OPTIONS_OK, // SAVE_DATA_CREATED
201 OPTIONS_YES_NO, // SAVE
202 OPTIONS_OK, // SAVED
203 OPTIONS_YES_NO, // EXIT_FREE_MODE
204 OPTIONS_YES_NO, // WATCH_UNLOCKED_HINT_MOVIE
205 OPTIONS_OK, // SKIP_COURSE
206 OPTIONS_YES_NO, // WATCH_HINT_MOVIE
207 OPTIONS_OK, // GOT_ALL_STAR_COINS
208 OPTIONS_OK, // GOT_ALL_STAR_COINS_MENTION_W9
209 OPTIONS_OK, // BOWSERJR_SINGLEPLAYER
210 OPTIONS_YES_NO, // RETURN_TITLE
211 OPTIONS_OK, // BOWSERJR_MULTIPLAYER
212 OPTIONS_YES_NO, // RETURN_TO_MAP
213 OPTIONS_YES_NO, // BACK_TO_COURSE_SELECTION
214 OPTIONS_OK, // GOT_ALL_STAR_COINS_ALL_WORLDS
215 OPTIONS_YES_NO, // QUICK_SAVE
216 OPTIONS_OK, // QUICK_SAVED
217 OPTIONS_OK, // ALL_TOAD_HOUSES_RETURNED
218 OPTIONS_OK, // ITEM_INFO
219 OPTIONS_YES_NO, // COURSE_CLEAR_WITH_SUPER_GUIDE
220 OPTIONS_YES_NO, // SKIP_COURSE_CONFIRM
221 OPTIONS_OK, // COMPLETED_EVERYTHING
222 OPTIONS_OK, // PROGRESS_AUTOSAVE_AFTER_W9_UNLOCK
223 OPTIONS_OK, // BLOCK_TRANSFORMATION
224 OPTIONS_OK, // BLOCK_TRANSFORMATION_REVERSE
225 OPTIONS_YES_NO, // EXIT_COIN_BATTLE
226 OPTIONS_YES_NO, // RETURN_TO_MAP2
227 OPTIONS_OK, // PEACH_CASTLE_HINT1
228 OPTIONS_OK // PEACH_CASTLE_HINT2
229};
230
232static const int StartingCursorPositions[] = {
233 dYesNoWindow_c::POS_OK, // SAVE_DATA_CREATED
234 dYesNoWindow_c::POS_YES, // SAVE
235 dYesNoWindow_c::POS_OK, // SAVED
236 dYesNoWindow_c::POS_NO, // EXIT_FREE_MODE
237 dYesNoWindow_c::POS_NO, // WATCH_UNLOCKED_HINT_MOVIE
238 dYesNoWindow_c::POS_OK, // SKIP_COURSE
239 dYesNoWindow_c::POS_NO, // WATCH_HINT_MOVIE
240 dYesNoWindow_c::POS_OK, // GOT_ALL_STAR_COINS
241 dYesNoWindow_c::POS_OK, // GOT_ALL_STAR_COINS_MENTION_W9
242 dYesNoWindow_c::POS_OK, // BOWSERJR_SINGLEPLAYER
243 dYesNoWindow_c::POS_NO, // RETURN_TITLE
244 dYesNoWindow_c::POS_OK, // BOWSERJR_MULTIPLAYER
245 dYesNoWindow_c::POS_NO, // RETURN_TO_MAP
246 dYesNoWindow_c::POS_NO, // BACK_TO_COURSE_SELECTION
247 dYesNoWindow_c::POS_OK, // GOT_ALL_STAR_COINS_ALL_WORLDS
248 dYesNoWindow_c::POS_YES, // QUICK_SAVE
249 dYesNoWindow_c::POS_OK, // QUICK_SAVED
250 dYesNoWindow_c::POS_OK, // ALL_TOAD_HOUSES_RETURNED
251 dYesNoWindow_c::POS_OK, // ITEM_INFO
252 dYesNoWindow_c::POS_YES, // COURSE_CLEAR_WITH_SUPER_GUIDE
253 dYesNoWindow_c::POS_NO, // SKIP_COURSE_CONFIRM
254 dYesNoWindow_c::POS_OK, // COMPLETED_EVERYTHING
255 dYesNoWindow_c::POS_OK, // PROGRESS_AUTOSAVE_AFTER_W9_UNLOCK
256 dYesNoWindow_c::POS_OK, // BLOCK_TRANSFORMATION
257 dYesNoWindow_c::POS_OK, // BLOCK_TRANSFORMATION_REVERSE
258 dYesNoWindow_c::POS_NO, // EXIT_COIN_BATTLE
259 dYesNoWindow_c::POS_NO, // RETURN_TO_MAP2
260 dYesNoWindow_c::POS_OK, // PEACH_CASTLE_HINT1
261 dYesNoWindow_c::POS_OK // PEACH_CASTLE_HINT2
262};
263
264const int SoundEffects[] = { SE_SYS_BACK, SE_SYS_DECIDE, SE_SYS_CURSOR, SE_SYS_DIALOGUE_IN };
265
267 static int fillLeftReqStarCoins = 2;
268 MsgRes_c *msgRes = dMessage_c::getMesRes();
269
270 int mainMsgID = MainMsgIDs[mType];
271 if (mType == WATCH_HINT_MOVIE) {
272 LytTextBox_c::SetTextInt(&mStarCoinsRequired, &fillLeftReqStarCoins, T_needCoin_00, true);
273
274 T_otehonTextS_01->setMessage(msgRes, BMG_CATEGORY_HINT_MOVIES, MSG_STAR_COINS_REQUIRED, 0);
275 T_otehonText_01->setMessage(msgRes, BMG_CATEGORY_HINT_MOVIES, MSG_STAR_COINS_REQUIRED, 0);
276 T_needCoinX_00->setMessage(msgRes, BMG_CATEGORY_HINT_MOVIES, MSG_STAR_COINS_REQUIRED_X, 0);
277
278 T_questionS_00->setVisible(false);
279 N_otehonText_00->setVisible(true);
280 } else {
281 if (mType == GOT_ALL_STAR_COINS_ALL_WORLDS) {
282 dInfo_c::m_instance->field_3b4 = dScWMap_c::m_WorldNo + 1;
283 }
284 if (mType == SKIP_COURSE_CONFIRM &&
285 dInfo_c::m_startGameInfo.mWorld1 == WORLD_8 &&
286 dInfo_c::m_startGameInfo.mLevel1 == STAGE_CASTLE)
287 {
288 mainMsgID = MSG_SKIP_FINAL_COURSE;
289 }
290
291 T_questionS_00->setVisible(true);
292 N_otehonText_00->setVisible(false);
293 T_questionS_00->setMessage(msgRes, BMG_CATEGORY_YES_NO_WINDOW, mainMsgID, 0);
294 T_question_00->setMessage(msgRes, BMG_CATEGORY_YES_NO_WINDOW, mainMsgID, 0);
295 }
296
297 // Set visibility of Yes/No/OK buttons
298 for (int i = 0; i < 3;) {
299 bool isVisible = PicVisible[mType][i];
300 getPicturePane(i++)->setVisible(isVisible);
301 }
302
304
305 // Set text in Yes/No/OK buttons
306 int bmgIDForYesButton, bmgIDForNoButton;
307 if (mType == SAVE) {
308 bmgIDForYesButton = MSG_SAVE;
309 bmgIDForNoButton = MSG_DONT_SAVE;
310 } else if (mType == QUICK_SAVE) {
311 bmgIDForYesButton = MSG_QUICK_SAVE;
312 bmgIDForNoButton = MSG_DONT_SAVE;
313 } else if (mType == COURSE_CLEAR_WITH_SUPER_GUIDE) {
314 bmgIDForYesButton = MSG_OK_TRY;
315 bmgIDForNoButton = MSG_NO_SKIP;
316 } else if (mType == SKIP_COURSE_CONFIRM) {
317 bmgIDForYesButton = MSG_YES_IM_SURE;
318 bmgIDForNoButton = MSG_NO_WAIT;
319
320 // Show a different message if the player wants to skip the final course
321 if (dInfo_c::m_startGameInfo.mWorld1 == WORLD_8 && dInfo_c::m_startGameInfo.mLevel1 == STAGE_CASTLE) {
322 bmgIDForYesButton = MSG_WATCH_ENDING;
323 }
324 } else {
325 bmgIDForNoButton = MSG_CANCEL;
326 if (mType == WATCH_UNLOCKED_HINT_MOVIE || mType == WATCH_HINT_MOVIE) {
327 bmgIDForYesButton = MSG_SAVED_OK;
328 } else {
329 bmgIDForYesButton = MSG_OK;
330 }
331 }
332
333 T_yes_00->setMessage(msgRes, BMG_CATEGORY_YES_NO_WINDOW, bmgIDForYesButton, false);
334 T_yes_01->setMessage(msgRes, BMG_CATEGORY_YES_NO_WINDOW, bmgIDForYesButton, false);
335 T_no_00->setMessage(msgRes, BMG_CATEGORY_YES_NO_WINDOW, bmgIDForNoButton, false);
336 T_no_01->setMessage(msgRes, BMG_CATEGORY_YES_NO_WINDOW, bmgIDForNoButton, false);
337
338 if (mType == QUICK_SAVED) {
339 N_saveIcon_00->setVisible(true);
340 } else {
341 N_saveIcon_00->setVisible(false);
342 }
343}
344
345// ----------------
346// StateID_InitWait
347// ----------------
348
349void dYesNoWindow_c::initializeState_InitWait() {
350 if (mHideBG) {
351 return;
352 }
353 mpRootPane->mFlags &= ~1;
354}
355
356void dYesNoWindow_c::executeState_InitWait() {
357 mIsActive = true;
358 mIsAnimating = false;
359 mKeepOpen = false;
360
361 mStateMgr.changeState(StateID_OpenAnimeEndWait);
362}
363
364void dYesNoWindow_c::finalizeState_InitWait() {}
365
366// ------------------------
367// StateID_OpenAnimeEndWait
368// ------------------------
369
370void dYesNoWindow_c::initializeState_OpenAnimeEndWait() {
371 mCancel = false;
372 mpRootPane->setVisible(true);
373 mIsAnimating = true;
374
375 mLayout.AllAnimeEndSetup();
376 mLayout.ReverseAnimeStartSetup(ANIM_IN_YES, false);
377 mLayout.ReverseAnimeStartSetup(ANIM_IN_NO, false);
378 mLayout.ReverseAnimeStartSetup(ANIM_IN_OK, false);
379
380 switch (mType) {
381 case SAVE:
382 case SAVED:
383 case EXIT_FREE_MODE:
384 case WATCH_UNLOCKED_HINT_MOVIE:
385 case WATCH_HINT_MOVIE:
386 case RETURN_TITLE:
387 case QUICK_SAVE:
388 case QUICK_SAVED:
389 case ITEM_INFO:
390 case EXIT_COIN_BATTLE:
391 case PEACH_CASTLE_HINT1:
392 case PEACH_CASTLE_HINT2:
393 if (!mHideBG) {
394 mLayout.AnimeStartSetup(ANIM_IN_BG, false);
395 }
396 break;
397 }
398 if (mType == QUICK_SAVED) {
399 mLayout.AnimeStartSetup(ANIM_IN_QUICK_SAVE, false);
400 }
401 mLayout.AnimeStartSetup(ANIM_IN_WINDOW, false);
402 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_OPEN_ANIME], 1);
403
405}
406
407void dYesNoWindow_c::executeState_OpenAnimeEndWait() {
408 if (!mLayout.isAllAnime()) {
409 mHitButton = false;
410 mStateMgr.changeState(StateID_ButtonOnStageAnimeEndWait);
411 }
412}
413
414void dYesNoWindow_c::finalizeState_OpenAnimeEndWait() {
415 mIsAnimating = false;
416 mHideBG = false;
417}
418
419// ---------------------------------
420// StateID_ButtonOnStageAnimeEndWait
421// ---------------------------------
422
423void dYesNoWindow_c::initializeState_ButtonOnStageAnimeEndWait() {
424 mIsAnimating = true;
425 mLayout.AnimeStartSetup(ANIM_IN_YES, false);
426 mLayout.AnimeStartSetup(ANIM_IN_NO, false);
427 mLayout.AnimeStartSetup(ANIM_IN_OK, false);
428}
429void dYesNoWindow_c::executeState_ButtonOnStageAnimeEndWait() {
430 if (!mLayout.isAllAnime()) {
431 mStateMgr.changeState(StateID_ButtonChangeAnimeEndWait);
432 }
433}
434void dYesNoWindow_c::finalizeState_ButtonOnStageAnimeEndWait() {
435 mPrevCursorPos = -1;
436 mIsAnimating = false;
437}
438
439// --------------------------------
440// StateID_ButtonChangeAnimeEndWait
441// --------------------------------
442
443void dYesNoWindow_c::initializeState_ButtonChangeAnimeEndWait() {
444 mIsAnimating = true;
445
446 mLayout.AllAnimeEndSetup();
447 if (mPrevCursorPos >= 0) {
448 // ID 17 is the exit animation for button 0 (Yes)
449 mLayout.AnimeStartSetup(ANIM_OFF_YES + mPrevCursorPos, false);
450 }
452
453 // ID 7 is the in animation for button 0 (Yes)
454 mLayout.AnimeStartSetup(ANIM_ON_YES + mCursorPos, false);
455}
456
457void dYesNoWindow_c::executeState_ButtonChangeAnimeEndWait() {
458 if (!mLayout.isAnime(-1)) {
459 mStateMgr.changeState(StateID_SelectWait);
460 }
461}
462
463void dYesNoWindow_c::finalizeState_ButtonChangeAnimeEndWait() {
464 mIsAnimating = false;
465}
466
467// ------------------
468// StateID_SelectWait
469// ------------------
470
471void dYesNoWindow_c::initializeState_SelectWait() {
472 if (mType == QUICK_SAVED) {
473 mLayout.LoopAnimeStartSetup(ANIM_LOOP_QUICK_SAVE);
474 }
475 mLayout.LoopAnimeStartSetup(ANIM_LOOP_WINDOW);
477}
478
479void dYesNoWindow_c::executeState_SelectWait() {
480 if (mCancel) {
481 if (mType == QUICK_SAVED) {
482 mLayout.AllAnimeEndSetup();
483 mLayout.AnimeStartSetup(ANIM_HIT_QUICK_SAVE, false);
484 }
485 mStateMgr.changeState(StateID_ClouseAnimeEndWait);
486 return;
487 }
488
489 if (mHitButton) {
490 if (mType == RETURN_TO_MAP || mType == RETURN_TO_MAP2 || mType == BACK_TO_COURSE_SELECTION) {
491 if (mCursorPos == POS_YES) {
492 // Stop game music
493 dAudio::pauseOffGameWithReset();
494 }
495 }
496 mStateMgr.changeState(StateID_HitAnimeEndWait);
497 return;
498 }
499
500 if (mPrevCursorPos != mCursorPos) {
501 // Cursor moved
502
503 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_CURSOR_MOVE], 1);
504 mStateMgr.changeState(StateID_ButtonChangeAnimeEndWait);
505 }
506}
507
508void dYesNoWindow_c::finalizeState_SelectWait() {
509 dSelectCursor_c::m_instance->Cancel(0);
510}
511
512// -----------------------
513// StateID_HitAnimeEndWait
514// -----------------------
515
516void dYesNoWindow_c::initializeState_HitAnimeEndWait() {
517 mLayout.AllAnimeEndSetup();
518 mIsAnimating = true;
519 mHitButton = false;
520
521 if (mType == QUICK_SAVED) {
522 mLayout.AnimeStartSetup(ANIM_HIT_QUICK_SAVE, false);
523 }
524 mLayout.AnimeStartSetup(ANIM_HIT_YES + mCursorPos, false);
525 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_WAIT], 1);
526}
527
528void dYesNoWindow_c::executeState_HitAnimeEndWait() {
529 if (!mLayout.isAnime(-1)) {
530 if (mKeepOpen) {
531 mStateMgr.changeState(StateID_HitAnimeAfterWait);
532 } else {
533 mStateMgr.changeState(StateID_ClouseAnimeEndWait);
534 }
535 }
536}
537
538void dYesNoWindow_c::finalizeState_HitAnimeEndWait() {
539 mIsAnimating = false;
540}
541
542// --------------------------
543// StateID_ClouseAnimeEndWait
544// --------------------------
545
546void dYesNoWindow_c::initializeState_ClouseAnimeEndWait() {
547 mIsAnimating = true;
548 mLayout.AllAnimeEndSetup();
549 switch (mType) {
550 case SAVE:
551 case SAVED:
552 case EXIT_FREE_MODE:
553 case WATCH_UNLOCKED_HINT_MOVIE:
554 case WATCH_HINT_MOVIE:
555 case RETURN_TITLE:
556 case QUICK_SAVE:
557 case QUICK_SAVED:
558 case ITEM_INFO:
559 case EXIT_COIN_BATTLE:
560 case PEACH_CASTLE_HINT1:
561 case PEACH_CASTLE_HINT2:
562 if (!mHideBG) {
563 mLayout.AnimeStartSetup(ANIM_OUT_BG, false);
564 }
565 break;
566 }
567 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_CLOSE], 1);
568 mLayout.AnimeStartSetup(ANIM_OUT_WINDOW, false);
569}
570
571void dYesNoWindow_c::executeState_ClouseAnimeEndWait() {
572 if (!mLayout.isAnime(-1)) {
573 mIsActive = false;
574 mStateMgr.changeState(StateID_InitWait);
575 }
576}
577
578void dYesNoWindow_c::finalizeState_ClouseAnimeEndWait() {
579 mIsAnimating = false;
580}
581
582// -------------------------
583// StateID_HitAnimeAfterWait
584// -------------------------
585
586void dYesNoWindow_c::initializeState_HitAnimeAfterWait() {
587 mHitButton = false;
588}
589
590void dYesNoWindow_c::executeState_HitAnimeAfterWait() {}
591
592void dYesNoWindow_c::finalizeState_HitAnimeAfterWait() {}
static void SetTextInt(int *value, int *fillLeft, LytTextBox_c *textBox, bool fullWidth)
Displays a confirmation prompt.
nw4r::lyt::Pane * mpRootPane
The root pane of the window.
bool mIsActive
Whether the window is currently open.
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.
nw4r::lyt::Picture * getPicturePane(int n)
Gets the n-th picture pane.
virtual int execute()
do method for the execute operation.
bool mIsAnimating
Whether an animation is currently playing.
WINDOW_TYPE_e mType
The type of the window.
int mPrevCursorPos
The previous cursor position.
virtual int doDelete()
do method for the delete operation.
virtual int draw()
do method for the draw operation.
int mStarCoinsRequired
The number of star coins required to unlock a hint movie.
bool mCancel
Whether the window has been cancelled (and closed).
bool mHideBG
Whether to hide the translucent background that fills the screen.
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:146
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:147
virtual void executeState()
Executes the current state.
virtual void changeState(const sStateIDIf_c &newState)
Transitions to a new state ID.
static const int MainMsgIDs[]
The prompt message for each type.
static const int StartingCursorPositions[]
Starting cursor positions for the Yes/No window.
static const bool PicVisible[][3]
Which buttons are visible in the Yes/No window.
#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
void updateSelectCursor(nw4r::lyt::Picture *pic, int index, bool useSpecialDraw)