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[] = {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 *GROUP_NAME_DT[] = {
73 static const int MESSAGE_DATA_TBL[] = {MSG_OK, MSG_OK, MSG_WATCH_HINT_MOVIE, MSG_WATCH_HINT_MOVIE};
74 static const char *T_PANE_FIXED_NAME_TBL[] = {
80 static const char *PPANE_NAME_DT[] = {
85 static const char *T_PANE_NAME_TBL[] = {
97 static const char *NPANE_NAME_DT[] = {
106 if (!
mLayout.ReadResource(
"yesnoWindow/yesnoWindow.arc",
false)) {
110 mLayout.build(
"yesnoWindow_11.brlyt",
nullptr);
111 mLayout.AnimeResRegister(AnmNameTbl, ARRAY_SIZE(AnmNameTbl));
112 mLayout.GroupRegister(GROUP_NAME_DT, ANIME_INDEX_TBL, ARRAY_SIZE(GROUP_NAME_DT));
113 mLayout.TPaneNameRegister(T_PANE_FIXED_NAME_TBL, MESSAGE_DATA_TBL, BMG_CATEGORY_YES_NO_WINDOW, ARRAY_SIZE(T_PANE_FIXED_NAME_TBL));
118 mLayout.PPaneRegister(PPANE_NAME_DT, &P_yesBase_00, ARRAY_SIZE(PPANE_NAME_DT));
119 mLayout.TPaneRegister(T_PANE_NAME_TBL, &T_questionS_00, ARRAY_SIZE(T_PANE_NAME_TBL));
120 mLayout.NPaneRegister(NPANE_NAME_DT, &N_otehonText_00, ARRAY_SIZE(NPANE_NAME_DT));
132 mLayout.ReverseAnimeStartSetup(ANIM_IN_BG,
false);
164 MSG_SAVE_DATA_CREATED,
168 MSG_WATCH_HINT_MOVIE,
170 MSG_WATCH_HINT_MOVIE,
171 MSG_GOT_ALL_STAR_COINS_NO_W9,
172 MSG_GOT_ALL_STAR_COINS_W9,
175 MSG_TOADS_CAPTURED_MULTIPLAYER,
177 MSG_BACK_TO_COURSE_SELECTION,
178 MSG_GOT_ALL_STAR_COINS_WORLD_X,
179 MSG_RETURN_TO_TITLE_QUICK_SAVE,
180 MSG_SAVED_RETURNING_TO_TITLE,
181 MSG_TOAD_HOUSES_BACK,
183 MSG_TRY_WITHOUT_SUPER_GUIDE,
185 MSG_COMPLETED_EVERYTHING,
186 MSG_PROGRESS_SAVED_FIRST_TIME,
187 MSG_SWITCH_FIRST_TIME,
189 MSG_EXIT_COIN_BATTLE,
195#define OPTIONS_YES_NO { true, true, false }
196#define OPTIONS_OK { false, false, true }
233 dYesNoWindow_c::POS_OK,
234 dYesNoWindow_c::POS_YES,
235 dYesNoWindow_c::POS_OK,
236 dYesNoWindow_c::POS_NO,
237 dYesNoWindow_c::POS_NO,
238 dYesNoWindow_c::POS_OK,
239 dYesNoWindow_c::POS_NO,
240 dYesNoWindow_c::POS_OK,
241 dYesNoWindow_c::POS_OK,
242 dYesNoWindow_c::POS_OK,
243 dYesNoWindow_c::POS_NO,
244 dYesNoWindow_c::POS_OK,
245 dYesNoWindow_c::POS_NO,
246 dYesNoWindow_c::POS_NO,
247 dYesNoWindow_c::POS_OK,
248 dYesNoWindow_c::POS_YES,
249 dYesNoWindow_c::POS_OK,
250 dYesNoWindow_c::POS_OK,
251 dYesNoWindow_c::POS_OK,
252 dYesNoWindow_c::POS_YES,
253 dYesNoWindow_c::POS_NO,
254 dYesNoWindow_c::POS_OK,
255 dYesNoWindow_c::POS_OK,
256 dYesNoWindow_c::POS_OK,
257 dYesNoWindow_c::POS_OK,
258 dYesNoWindow_c::POS_NO,
259 dYesNoWindow_c::POS_NO,
260 dYesNoWindow_c::POS_OK,
261 dYesNoWindow_c::POS_OK
264const int SoundEffects[] = { SE_SYS_BACK, SE_SYS_DECIDE, SE_SYS_CURSOR, SE_SYS_DIALOGUE_IN };
267 static int fillLeftReqStarCoins = 2;
268 MsgRes_c *msgRes = dMessage_c::getMesRes();
271 if (
mType == WATCH_HINT_MOVIE) {
272 dGameCom::LayoutDispNumber(
mStarCoinsRequired, fillLeftReqStarCoins, T_needCoin_00,
true);
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);
278 T_questionS_00->setVisible(
false);
279 N_otehonText_00->setVisible(
true);
281 if (
mType == GOT_ALL_STAR_COINS_ALL_WORLDS) {
282 dInfo_c::m_instance->field_3b4 = dScWMap_c::m_WorldNo + 1;
284 if (
mType == SKIP_COURSE_CONFIRM &&
285 dInfo_c::m_startGameInfo.mWorld1 == WORLD_8 &&
286 dInfo_c::m_startGameInfo.mLevel1 == STAGE_CASTLE)
288 mainMsgID = MSG_SKIP_FINAL_COURSE;
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);
298 for (
int i = 0; i < 3;) {
306 int bmgIDForYesButton, bmgIDForNoButton;
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;
321 if (dInfo_c::m_startGameInfo.mWorld1 == WORLD_8 && dInfo_c::m_startGameInfo.mLevel1 == STAGE_CASTLE) {
322 bmgIDForYesButton = MSG_WATCH_ENDING;
325 bmgIDForNoButton = MSG_CANCEL;
326 if (
mType == WATCH_UNLOCKED_HINT_MOVIE ||
mType == WATCH_HINT_MOVIE) {
327 bmgIDForYesButton = MSG_SAVED_OK;
329 bmgIDForYesButton = MSG_OK;
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);
338 if (
mType == QUICK_SAVED) {
339 N_saveIcon_00->setVisible(
true);
341 N_saveIcon_00->setVisible(
false);
376 mLayout.ReverseAnimeStartSetup(ANIM_IN_YES,
false);
377 mLayout.ReverseAnimeStartSetup(ANIM_IN_NO,
false);
378 mLayout.ReverseAnimeStartSetup(ANIM_IN_OK,
false);
384 case WATCH_UNLOCKED_HINT_MOVIE:
385 case WATCH_HINT_MOVIE:
390 case EXIT_COIN_BATTLE:
391 case PEACH_CASTLE_HINT1:
392 case PEACH_CASTLE_HINT2:
394 mLayout.AnimeStartSetup(ANIM_IN_BG,
false);
398 if (
mType == QUICK_SAVED) {
399 mLayout.AnimeStartSetup(ANIM_IN_QUICK_SAVE,
false);
401 mLayout.AnimeStartSetup(ANIM_IN_WINDOW,
false);
402 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_OPEN_ANIME], 1);
425 mLayout.AnimeStartSetup(ANIM_IN_YES,
false);
426 mLayout.AnimeStartSetup(ANIM_IN_NO,
false);
427 mLayout.AnimeStartSetup(ANIM_IN_OK,
false);
472 if (
mType == QUICK_SAVED) {
473 mLayout.LoopAnimeStartSetup(ANIM_LOOP_QUICK_SAVE);
475 mLayout.LoopAnimeStartSetup(ANIM_LOOP_WINDOW);
481 if (
mType == QUICK_SAVED) {
483 mLayout.AnimeStartSetup(ANIM_HIT_QUICK_SAVE,
false);
490 if (
mType == RETURN_TO_MAP ||
mType == RETURN_TO_MAP2 ||
mType == BACK_TO_COURSE_SELECTION) {
503 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_CURSOR_MOVE], 1);
509 dSelectCursor_c::m_instance->Cancel(0);
521 if (
mType == QUICK_SAVED) {
522 mLayout.AnimeStartSetup(ANIM_HIT_QUICK_SAVE,
false);
525 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_WAIT], 1);
553 case WATCH_UNLOCKED_HINT_MOVIE:
554 case WATCH_HINT_MOVIE:
559 case EXIT_COIN_BATTLE:
560 case PEACH_CASTLE_HINT1:
561 case PEACH_CASTLE_HINT2:
563 mLayout.AnimeStartSetup(ANIM_OUT_BG,
false);
567 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_CLOSE], 1);
568 mLayout.AnimeStartSetup(ANIM_OUT_WINDOW,
false);
Displays a confirmation prompt.
void executeState_HitAnimeEndWait()
Execution function for the HitAnimeEndWait state.
static sFStateID_c< dYesNoWindow_c > StateID_OpenAnimeEndWait
The state ID for the OpenAnimeEndWait state.
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
The state ID for the HitAnimeAfterWait state.
void executeState_HitAnimeAfterWait()
Execution function for the HitAnimeAfterWait state.
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.
void executeState_OpenAnimeEndWait()
Execution function for the OpenAnimeEndWait state.
LytBase_c mLayout
Waiting in an infinite loop after the button was pressed.
void finalizeState_ButtonOnStageAnimeEndWait()
Finalization function for the ButtonOnStageAnimeEndWait state.
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.
void finalizeState_ButtonChangeAnimeEndWait()
Finalization function for the ButtonChangeAnimeEndWait state.
void executeState_InitWait()
Execution function for the InitWait state.
void initializeState_ButtonChangeAnimeEndWait()
Plays the button appearing animation and waits for it to finish.
void initializeState_HitAnimeAfterWait()
Waiting for the window to finish the closing animation.
static sFStateID_c< dYesNoWindow_c > StateID_InitWait
The state ID for the InitWait state.
bool mIsAnimating
Whether an animation is currently playing.
void executeState_ButtonOnStageAnimeEndWait()
Execution function for the ButtonOnStageAnimeEndWait state.
void finalizeState_HitAnimeEndWait()
Finalization function for the HitAnimeEndWait state.
WINDOW_TYPE_e mType
The type of the window.
static sFStateID_c< dYesNoWindow_c > StateID_HitAnimeEndWait
The state ID for the HitAnimeEndWait state.
void executeState_ButtonChangeAnimeEndWait()
Execution function for the ButtonChangeAnimeEndWait state.
void finalizeState_SelectWait()
Finalization function for the SelectWait state.
int mPrevCursorPos
The previous cursor position.
void finalizeState_ClouseAnimeEndWait()
Finalization function for the ClouseAnimeEndWait state.
static sFStateID_c< dYesNoWindow_c > StateID_SelectWait
The state ID for the SelectWait state.
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
The state ID for the ButtonOnStageAnimeEndWait state.
void initializeState_ButtonOnStageAnimeEndWait()
Waiting for the window to finish the opening animation.
static sFStateID_c< dYesNoWindow_c > StateID_ButtonChangeAnimeEndWait
The state ID for the ButtonChangeAnimeEndWait state.
void initializeState_InitWait()
Initialization function for the InitWait state.
void initializeState_ClouseAnimeEndWait()
Waiting for the button to finish the hit animation.
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
The state ID for the ClouseAnimeEndWait state.
bool mHideBG
Whether to hide the translucent background that fills the screen.
virtual int create()
do method for the create operation.
void initializeState_OpenAnimeEndWait()
Initial state. Switches to OpenAnimeStartWait immediately.
void finalizeState_HitAnimeAfterWait()
Finalization function for the HitAnimeAfterWait state.
void executeState_ClouseAnimeEndWait()
Execution function for the ClouseAnimeEndWait state.
void finalizeState_InitWait()
Finalization function for the InitWait state.
void populateLayout()
Fills out the window content according to the settings.
int mCursorPos
The current cursor position.
void finalizeState_OpenAnimeEndWait()
Finalization function for the OpenAnimeEndWait state.
void initializeState_HitAnimeEndWait()
Waiting for either a button change or button hit to occur.
void executeState_SelectWait()
Execution function for the SelectWait state.
void initializeState_SelectWait()
Playing the button change animations.
@ NOT_READY
The step could not completed at this time.
@ SUCCEEDED
The step was completed successfully.
void pauseOffGameWithReset()
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.
void updateSelectCursor(nw4r::lyt::Picture *pic, int index, bool useSpecialDraw)
#define STATE_DEFINE(class, name)
Defines a state.