NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_yes_no_window.hpp
1#pragma once
2#include <game/bases/d_base.hpp>
3#include <game/bases/d_lytbase.hpp>
4#include <game/sLib/s_State.hpp>
5
6/// @brief Displays a confirmation prompt.
7/// @details This appears, for example, when the game asks the player if their progress should be saved.
8/// @ingroup bases
9class dYesNoWindow_c : public dBase_c {
10public:
11 /// @brief The prompt type.
13 SAVE_DATA_CREATED,
14 SAVE,
15 SAVED,
16 EXIT_FREE_MODE,
17 WATCH_UNLOCKED_HINT_MOVIE,
18 SKIP_COURSE,
19 WATCH_HINT_MOVIE,
20 GOT_ALL_STAR_COINS,
21 GOT_ALL_STAR_COINS_MENTION_W9,
22 BOWSERJR_SINGLEPLAYER,
23 RETURN_TITLE,
24 BOWSERJR_MULTIPLAYER,
25 RETURN_TO_MAP,
26 BACK_TO_COURSE_SELECTION,
27 GOT_ALL_STAR_COINS_ALL_WORLDS,
28 QUICK_SAVE,
29 QUICK_SAVED,
30 ALL_TOAD_HOUSES_RETURNED,
31 ITEM_INFO,
32 COURSE_CLEAR_WITH_SUPER_GUIDE,
33 SKIP_COURSE_CONFIRM,
34 COMPLETED_EVERYTHING,
35 PROGRESS_AUTOSAVE_AFTER_W9_UNLOCK,
36 BLOCK_TRANSFORMATION,
37 BLOCK_TRANSFORMATION_REVERSE,
38 EXIT_COIN_BATTLE,
39 RETURN_TO_MAP2,
40 PEACH_CASTLE_HINT1,
41 PEACH_CASTLE_HINT2,
42 NUM_WINDOW_TYPES
43 };
44
45 /// @brief The possible cursor positions.
47 POS_YES,
48 POS_NO,
49 POS_OK
50 };
51
52 /// @brief The sound effect types used by the window.
53 enum SOUND_e {
54 SOUND_CLOSE,
55 SOUND_WAIT,
56 SOUND_CURSOR_MOVE,
57 SOUND_OPEN_ANIME
58 };
59
60 /// @brief The animations used for the window.
61 enum ANIMS_e {
62 ANIM_IN_WINDOW,
63 ANIM_IN_QUICK_SAVE,
64 ANIM_LOOP_WINDOW,
65 ANIM_LOOP_QUICK_SAVE,
66 ANIM_IN_YES,
67 ANIM_IN_NO,
68 ANIM_IN_OK,
69 ANIM_ON_YES,
70 ANIM_ON_NO,
71 ANIM_ON_OK,
72 ANIM_IDLE_YES,
73 ANIM_IDLE_NO,
74 ANIM_IDLE_OK,
75 ANIM_HIT_YES,
76 ANIM_HIT_NO,
77 ANIM_HIT_OK,
78 ANIM_HIT_QUICK_SAVE,
79 ANIM_OFF_YES,
80 ANIM_OFF_NO,
81 ANIM_OFF_OK,
82 ANIM_IN_BG,
83 ANIM_OUT_BG,
84 ANIM_OUT_WINDOW
85 };
86
88 virtual ~dYesNoWindow_c();
89 virtual int create();
90 virtual int execute();
91 virtual int draw();
92 virtual int doDelete();
93
94private:
95 /// @brief Fills out the window content according to the settings.
96 /// @details This includes:
97 /// - Filling out the text boxes
98 /// - Setting the visibility of the buttons
99 /// - Showing the quick save balloon if necessary
100 void populateLayout();
101
102 STATE_FUNC_DECLARE(dYesNoWindow_c, InitWait); ///< @brief Initial state. Switches to OpenAnimeStartWait immediately.
103 STATE_FUNC_DECLARE(dYesNoWindow_c, OpenAnimeEndWait); ///< @brief Waiting for the window to finish the opening animation.
104 STATE_FUNC_DECLARE(dYesNoWindow_c, ButtonOnStageAnimeEndWait); ///< @brief Plays the button appearing animation and waits for it to finish.
105 STATE_FUNC_DECLARE(dYesNoWindow_c, ButtonChangeAnimeEndWait); ///< @brief Playing the button change animations.
106 STATE_FUNC_DECLARE(dYesNoWindow_c, SelectWait); ///< @brief Waiting for either a button change or button hit to occur.
107 STATE_FUNC_DECLARE(dYesNoWindow_c, HitAnimeEndWait); ///< @brief Waiting for the button to finish the hit animation.
108 STATE_FUNC_DECLARE(dYesNoWindow_c, ClouseAnimeEndWait); ///< @brief Waiting for the window to finish the closing animation.
109 STATE_FUNC_DECLARE(dYesNoWindow_c, HitAnimeAfterWait); ///< @brief Waiting in an infinite loop after the button was pressed.
110
111 LytBase_c mLayout; ///< @brief The layout for the window.
112
113 /// @brief The state manager for the window.
115
116 nw4r::lyt::Pane *mpRootPane; ///< @brief The root pane of the window.
117
118 nw4r::lyt::Picture *P_yesBase_00,
119 *P_noBase_00,
120 *P_centerBase_00;
121
122 /// @brief Gets the n-th picture pane.
123 nw4r::lyt::Picture *getPicturePane(int n) { return (&P_yesBase_00)[n]; }
124
125 LytTextBox_c *T_questionS_00,
126 *T_question_00,
127 *T_otehonTextS_01,
128 *T_otehonText_01,
129 *T_needCoinX_00,
130 *T_needCoin_00,
131 *T_yes_00,
132 *T_yes_01,
133 *T_no_00,
134 *T_no_01;
135
136 nw4r::lyt::Pane *N_otehonText_00,
137 *N_saveIcon_00;
138
139 int mCursorPos; ///< @brief The current cursor position.
140 int mPrevCursorPos; ///< @brief The previous cursor position.
141
142 /// @brief The type of the window.
143 /// @details This determines the text and the layout of the window.
145
146public:
147 /// @brief The number of star coins required to unlock a hint movie.
148 /// @details This is only to be used with the WATCH_UNLOCKED_HINT_MOVIE type.
150
151private:
152 bool mHasLoadedLayout; ///< @brief Whether the layout has been loaded.
153 bool mIsActive; ///< @brief Whether the window is currently open.
154
155public:
156 bool mHitButton; ///< @brief Whether a button has been pressed.
157 bool mIsAnimating; ///< @brief Whether an animation is currently playing.
158 bool mKeepOpen; ///< @brief Whether the window should stay open after a button has been pressed.
159 bool mCancel; ///< @brief Whether the window has been cancelled (and closed).
160 bool mHideBG; ///< @brief Whether to hide the translucent background that fills the screen.
161};
dBase_c()
Constructs a new base.
Definition d_base.cpp:12
Displays a confirmation prompt.
nw4r::lyt::Pane * mpRootPane
The root pane of the window.
bool mIsActive
Whether the window is currently open.
STATE_FUNC_DECLARE(dYesNoWindow_c, ClouseAnimeEndWait)
Waiting for the window to finish the closing animation.
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.
ANIMS_e
The animations used for the window.
CURSOR_POS_e
The possible cursor positions.
STATE_FUNC_DECLARE(dYesNoWindow_c, InitWait)
Initial state. Switches to OpenAnimeStartWait immediately.
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.
STATE_FUNC_DECLARE(dYesNoWindow_c, SelectWait)
Waiting for either a button change or button hit to occur.
STATE_FUNC_DECLARE(dYesNoWindow_c, OpenAnimeEndWait)
Waiting for the window to finish the opening animation.
STATE_FUNC_DECLARE(dYesNoWindow_c, HitAnimeEndWait)
Waiting for the button to finish the hit animation.
int mPrevCursorPos
The previous cursor position.
STATE_FUNC_DECLARE(dYesNoWindow_c, HitAnimeAfterWait)
Waiting in an infinite loop after the button was pressed.
virtual int doDelete()
do method for the delete operation.
virtual int draw()
do method for the draw operation.
STATE_FUNC_DECLARE(dYesNoWindow_c, ButtonOnStageAnimeEndWait)
Plays the button appearing animation and waits for it to finish.
SOUND_e
The sound effect types used by the window.
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.
WINDOW_TYPE_e
The prompt type.
void populateLayout()
Fills out the window content according to the settings.
int mCursorPos
The current cursor position.
STATE_FUNC_DECLARE(dYesNoWindow_c, ButtonChangeAnimeEndWait)
Playing the button change animations.
A wrapper for sStateMgr_c that uses sFStateFct_c and sStateIDChk_c.