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>
26dYesNoWindow_c::dYesNoWindow_c() :
27 mStateMgr(*this, StateID_InitWait),
28 mHasLoadedLayout(false) {}
30dYesNoWindow_c::~dYesNoWindow_c() {}
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"
46 static const int ANIME_INDEX_TBL[ANIM_COUNT] = {
72 static const char *GROUP_NAME_DT[ANIM_COUNT] = {
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[] = {
105 static const char *PPANE_NAME_DT[] = {
110 static const char *T_PANE_NAME_TBL[] = {
122 static const char *NPANE_NAME_DT[] = {
131 if (!
mLayout.ReadResource(
"yesnoWindow/yesnoWindow.arc",
false)) {
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));
140 mLayout.mDrawOrder = m2d::DRAW_ORDER_YES_NO_WINDOW;
157 mLayout.ReverseAnimeStartSetup(ANIM_IN_BG,
false);
188static const int MainMsgIDs[dYesNoWindow_c::WINDOW_TYPE_COUNT] = {
189 MSG_SAVE_DATA_CREATED,
193 MSG_WATCH_HINT_MOVIE,
195 MSG_WATCH_HINT_MOVIE,
196 MSG_GOT_ALL_STAR_COINS_NO_W9,
197 MSG_GOT_ALL_STAR_COINS_W9,
200 MSG_TOADS_CAPTURED_MULTIPLAYER,
202 MSG_BACK_TO_COURSE_SELECTION,
203 MSG_GOT_ALL_STAR_COINS_WORLD_X,
204 MSG_RETURN_TO_TITLE_QUICK_SAVE,
205 MSG_SAVED_RETURNING_TO_TITLE,
206 MSG_TOAD_HOUSES_BACK,
208 MSG_TRY_WITHOUT_SUPER_GUIDE,
210 MSG_COMPLETED_EVERYTHING,
211 MSG_PROGRESS_SAVED_FIRST_TIME,
212 MSG_SWITCH_ON_FIRST_TIME,
213 MSG_SWITCH_OFF_FIRST_TIME,
214 MSG_EXIT_COIN_BATTLE,
220#define OPTIONS_YES_NO { true, true, false }
221#define OPTIONS_OK { false, false, true }
224static const bool PicVisible[dYesNoWindow_c::WINDOW_TYPE_COUNT][dYesNoWindow_c::POS_COUNT] = {
258 dYesNoWindow_c::POS_OK,
259 dYesNoWindow_c::POS_YES,
260 dYesNoWindow_c::POS_OK,
261 dYesNoWindow_c::POS_NO,
262 dYesNoWindow_c::POS_NO,
263 dYesNoWindow_c::POS_OK,
264 dYesNoWindow_c::POS_NO,
265 dYesNoWindow_c::POS_OK,
266 dYesNoWindow_c::POS_OK,
267 dYesNoWindow_c::POS_OK,
268 dYesNoWindow_c::POS_NO,
269 dYesNoWindow_c::POS_OK,
270 dYesNoWindow_c::POS_NO,
271 dYesNoWindow_c::POS_NO,
272 dYesNoWindow_c::POS_OK,
273 dYesNoWindow_c::POS_YES,
274 dYesNoWindow_c::POS_OK,
275 dYesNoWindow_c::POS_OK,
276 dYesNoWindow_c::POS_OK,
277 dYesNoWindow_c::POS_YES,
278 dYesNoWindow_c::POS_NO,
279 dYesNoWindow_c::POS_OK,
280 dYesNoWindow_c::POS_OK,
281 dYesNoWindow_c::POS_OK,
282 dYesNoWindow_c::POS_OK,
283 dYesNoWindow_c::POS_NO,
284 dYesNoWindow_c::POS_NO,
285 dYesNoWindow_c::POS_OK,
286 dYesNoWindow_c::POS_OK
289const int SoundEffects[] = { SE_SYS_BACK, SE_SYS_DECIDE, SE_SYS_CURSOR, SE_SYS_DIALOGUE_IN };
292 static int fillLeftReqStarCoins = 2;
293 MsgRes_c *msgRes = dMessage_c::getMesRes();
296 if (
mType == WATCH_HINT_MOVIE) {
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);
305 if (
mType == GOT_ALL_STAR_COINS_ALL_WORLDS) {
306 dInfo_c::m_instance->mDisplayCourseWorld = dScWMap_c::m_WorldNo + 1;
308 if (
mType == SKIP_COURSE_CONFIRM &&
309 dInfo_c::m_startGameInfo.mWorld1 == WORLD_8 &&
310 dInfo_c::m_startGameInfo.mLevel1 == STAGE_CASTLE)
312 mainMsgID = MSG_SKIP_FINAL_COURSE;
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);
322 for (
int i = 0; i < 3;) {
330 int bmgIDForYesButton, bmgIDForNoButton;
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;
345 if (dInfo_c::m_startGameInfo.mWorld1 == WORLD_8 && dInfo_c::m_startGameInfo.mLevel1 == STAGE_CASTLE) {
346 bmgIDForYesButton = MSG_WATCH_ENDING;
349 bmgIDForNoButton = MSG_CANCEL;
350 if (
mType == WATCH_UNLOCKED_HINT_MOVIE ||
mType == WATCH_HINT_MOVIE) {
351 bmgIDForYesButton = MSG_SAVED_OK;
353 bmgIDForYesButton = MSG_OK;
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);
362 if (
mType == QUICK_SAVED) {
373void dYesNoWindow_c::initializeState_InitWait() {
380void dYesNoWindow_c::executeState_InitWait() {
388void dYesNoWindow_c::finalizeState_InitWait() {}
394void dYesNoWindow_c::initializeState_OpenAnimeEndWait() {
400 mLayout.ReverseAnimeStartSetup(ANIM_IN_YES,
false);
401 mLayout.ReverseAnimeStartSetup(ANIM_IN_NO,
false);
402 mLayout.ReverseAnimeStartSetup(ANIM_IN_OK,
false);
408 case WATCH_UNLOCKED_HINT_MOVIE:
409 case WATCH_HINT_MOVIE:
414 case EXIT_COIN_BATTLE:
415 case PEACH_CASTLE_HINT1:
416 case PEACH_CASTLE_HINT2:
418 mLayout.AnimeStartSetup(ANIM_IN_BG,
false);
424 if (
mType == QUICK_SAVED) {
425 mLayout.AnimeStartSetup(ANIM_IN_QUICK_SAVE,
false);
427 mLayout.AnimeStartSetup(ANIM_IN_WINDOW,
false);
428 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_OPEN_ANIME], 1);
433void dYesNoWindow_c::executeState_OpenAnimeEndWait() {
440void dYesNoWindow_c::finalizeState_OpenAnimeEndWait() {
449void dYesNoWindow_c::initializeState_ButtonOnStageAnimeEndWait() {
451 mLayout.AnimeStartSetup(ANIM_IN_YES,
false);
452 mLayout.AnimeStartSetup(ANIM_IN_NO,
false);
453 mLayout.AnimeStartSetup(ANIM_IN_OK,
false);
455void dYesNoWindow_c::executeState_ButtonOnStageAnimeEndWait() {
460void dYesNoWindow_c::finalizeState_ButtonOnStageAnimeEndWait() {
469void dYesNoWindow_c::initializeState_ButtonChangeAnimeEndWait() {
483void dYesNoWindow_c::executeState_ButtonChangeAnimeEndWait() {
489void dYesNoWindow_c::finalizeState_ButtonChangeAnimeEndWait() {
497void dYesNoWindow_c::initializeState_SelectWait() {
498 if (
mType == QUICK_SAVED) {
499 mLayout.LoopAnimeStartSetup(ANIM_LOOP_QUICK_SAVE);
501 mLayout.LoopAnimeStartSetup(ANIM_LOOP_WINDOW);
505void dYesNoWindow_c::executeState_SelectWait() {
507 if (
mType == QUICK_SAVED) {
509 mLayout.AnimeStartSetup(ANIM_HIT_QUICK_SAVE,
false);
516 if (
mType == RETURN_TO_MAP ||
mType == RETURN_TO_MAP2 ||
mType == BACK_TO_COURSE_SELECTION) {
529 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_CURSOR_MOVE], 1);
534void dYesNoWindow_c::finalizeState_SelectWait() {
535 dSelectCursor_c::m_instance->Cancel(0);
542void dYesNoWindow_c::initializeState_HitAnimeEndWait() {
547 if (
mType == QUICK_SAVED) {
548 mLayout.AnimeStartSetup(ANIM_HIT_QUICK_SAVE,
false);
551 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_WAIT], 1);
554void dYesNoWindow_c::executeState_HitAnimeEndWait() {
564void dYesNoWindow_c::finalizeState_HitAnimeEndWait() {
572void dYesNoWindow_c::initializeState_ClouseAnimeEndWait() {
579 case WATCH_UNLOCKED_HINT_MOVIE:
580 case WATCH_HINT_MOVIE:
585 case EXIT_COIN_BATTLE:
586 case PEACH_CASTLE_HINT1:
587 case PEACH_CASTLE_HINT2:
589 mLayout.AnimeStartSetup(ANIM_OUT_BG,
false);
595 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_CLOSE], 1);
596 mLayout.AnimeStartSetup(ANIM_OUT_WINDOW,
false);
599void dYesNoWindow_c::executeState_ClouseAnimeEndWait() {
606void dYesNoWindow_c::finalizeState_ClouseAnimeEndWait() {
614void dYesNoWindow_c::initializeState_HitAnimeAfterWait() {
618void dYesNoWindow_c::executeState_HitAnimeAfterWait() {}
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.
@ SUCCEEDED
The step was completed successfully.
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.
#define STATE_DEFINE(class, name)
Defines a state.