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>
26dYesNoWindow_c::dYesNoWindow_c() :
27 mStateMgr(*this, StateID_InitWait),
28 mHasLoadedLayout(false) {}
30dYesNoWindow_c::~dYesNoWindow_c() {}
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"
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[] = {
73 static const int textBoxVals[] = {MSG_OK, MSG_OK, MSG_WATCH_HINT_MOVIE, MSG_WATCH_HINT_MOVIE};
74 static const char *textBoxNames[] = {
80 static const char *pictureNames[] = {
85 static const char *textboxNames[] = {
97 static const char *paneNames[] = {
106 if (!
mLayout.ReadResource(
"yesnoWindow/yesnoWindow.arc",
false)) {
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));
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));
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) {
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);
349void dYesNoWindow_c::initializeState_InitWait() {
356void dYesNoWindow_c::executeState_InitWait() {
364void dYesNoWindow_c::finalizeState_InitWait() {}
370void dYesNoWindow_c::initializeState_OpenAnimeEndWait() {
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);
407void dYesNoWindow_c::executeState_OpenAnimeEndWait() {
414void dYesNoWindow_c::finalizeState_OpenAnimeEndWait() {
423void dYesNoWindow_c::initializeState_ButtonOnStageAnimeEndWait() {
425 mLayout.AnimeStartSetup(ANIM_IN_YES,
false);
426 mLayout.AnimeStartSetup(ANIM_IN_NO,
false);
427 mLayout.AnimeStartSetup(ANIM_IN_OK,
false);
429void dYesNoWindow_c::executeState_ButtonOnStageAnimeEndWait() {
434void dYesNoWindow_c::finalizeState_ButtonOnStageAnimeEndWait() {
443void dYesNoWindow_c::initializeState_ButtonChangeAnimeEndWait() {
457void dYesNoWindow_c::executeState_ButtonChangeAnimeEndWait() {
463void dYesNoWindow_c::finalizeState_ButtonChangeAnimeEndWait() {
471void dYesNoWindow_c::initializeState_SelectWait() {
472 if (
mType == QUICK_SAVED) {
473 mLayout.LoopAnimeStartSetup(ANIM_LOOP_QUICK_SAVE);
475 mLayout.LoopAnimeStartSetup(ANIM_LOOP_WINDOW);
479void dYesNoWindow_c::executeState_SelectWait() {
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) {
493 dAudio::pauseOffGameWithReset();
503 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_CURSOR_MOVE], 1);
508void dYesNoWindow_c::finalizeState_SelectWait() {
509 dSelectCursor_c::m_instance->Cancel(0);
516void dYesNoWindow_c::initializeState_HitAnimeEndWait() {
521 if (
mType == QUICK_SAVED) {
522 mLayout.AnimeStartSetup(ANIM_HIT_QUICK_SAVE,
false);
525 SndAudioMgr::sInstance->startSystemSe(SoundEffects[SOUND_WAIT], 1);
528void dYesNoWindow_c::executeState_HitAnimeEndWait() {
538void dYesNoWindow_c::finalizeState_HitAnimeEndWait() {
546void dYesNoWindow_c::initializeState_ClouseAnimeEndWait() {
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);
571void dYesNoWindow_c::executeState_ClouseAnimeEndWait() {
578void dYesNoWindow_c::finalizeState_ClouseAnimeEndWait() {
586void dYesNoWindow_c::initializeState_HitAnimeAfterWait() {
590void dYesNoWindow_c::executeState_HitAnimeAfterWait() {}
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.
@ SUCCEEDED
The step was completed successfully.
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.
void updateSelectCursor(nw4r::lyt::Picture *pic, int index, bool useSpecialDraw)