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>
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
12 /// @brief The prompt type.
14 SAVE_DATA_CREATED,
15 SAVE,
16 SAVED,
17 EXIT_FREE_MODE,
18 WATCH_UNLOCKED_HINT_MOVIE,
19 SKIP_COURSE,
20 WATCH_HINT_MOVIE,
21 GOT_ALL_STAR_COINS,
22 GOT_ALL_STAR_COINS_MENTION_W9,
23 BOWSERJR_SINGLEPLAYER,
24 RETURN_TITLE,
25 BOWSERJR_MULTIPLAYER,
26 RETURN_TO_MAP,
27 BACK_TO_COURSE_SELECTION,
28 GOT_ALL_STAR_COINS_ALL_WORLDS,
29 QUICK_SAVE,
30 QUICK_SAVED,
31 ALL_TOAD_HOUSES_RETURNED,
32 ITEM_INFO,
33 COURSE_CLEAR_WITH_SUPER_GUIDE,
34 SKIP_COURSE_CONFIRM,
35 COMPLETED_EVERYTHING,
36 PROGRESS_AUTOSAVE_AFTER_W9_UNLOCK,
37 BLOCK_TRANSFORMATION,
38 BLOCK_TRANSFORMATION_REVERSE,
39 EXIT_COIN_BATTLE,
40 RETURN_TO_MAP2,
41 PEACH_CASTLE_HINT1,
42 PEACH_CASTLE_HINT2,
43 WINDOW_TYPE_COUNT
44 };
45
46 /// @brief The possible cursor positions.
48 POS_YES,
49 POS_NO,
50 POS_OK,
51 POS_COUNT
52 };
53
54 /// @brief The sound effect types used for the window.
55 enum SOUND_e {
56 SOUND_CLOSE,
57 SOUND_WAIT,
58 SOUND_CURSOR_MOVE,
59 SOUND_OPEN_ANIME,
60 SOUND_COUNT
61 };
62
63 /// @brief The animation names used for the window.
65 inWindow,
66 loopWindow,
67 inYesNoButton,
68 onYesNoButton,
69 idleYesNoButton,
70 hitYesNoButton,
71 offYesNoButton,
72 inBG,
73 outBG,
74 outWindow,
75 ANIM_NAME_COUNT
76 };
77
78 /// @brief The animations used for the window.
79 enum ANIMS_e {
80 ANIM_IN_WINDOW,
81 ANIM_IN_QUICK_SAVE,
82 ANIM_LOOP_WINDOW,
83 ANIM_LOOP_QUICK_SAVE,
84 ANIM_IN_YES,
85 ANIM_IN_NO,
86 ANIM_IN_OK,
87 ANIM_ON_YES,
88 ANIM_ON_NO,
89 ANIM_ON_OK,
90 ANIM_IDLE_YES,
91 ANIM_IDLE_NO,
92 ANIM_IDLE_OK,
93 ANIM_HIT_YES,
94 ANIM_HIT_NO,
95 ANIM_HIT_OK,
96 ANIM_HIT_QUICK_SAVE,
97 ANIM_OFF_YES,
98 ANIM_OFF_NO,
99 ANIM_OFF_OK,
100 ANIM_IN_BG,
101 ANIM_OUT_BG,
102 ANIM_OUT_WINDOW,
103 ANIM_COUNT
104 };
105
106 /// @brief The picture panes used for the window.
107 enum P_PANE_e {
108 P_yesBase_00,
109 P_noBase_00,
110 P_centerBase_00,
111 P_COUNT
112 };
113
114 /// @brief The fixed text boxes used for the window.
116 T_center_00,
117 T_center_01,
118 T_otehonTextS_00,
119 T_otehonText_00,
120 T_FIXED_COUNT
121 };
122
123 /// @brief The text boxes used for the window.
124 enum T_PANE_e {
125 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 T_COUNT
136 };
137
138 /// @brief The null panes used for the window.
139 enum N_PANE_e {
140 N_otehonText_00,
141 N_saveIcon_00,
142 N_COUNT
143 };
144
146 virtual ~dYesNoWindow_c();
147 virtual int create();
148 virtual int execute();
149 virtual int draw();
150 virtual int doDelete();
151
152private:
153 /// @brief Fills out the window content according to the settings.
154 /// @details This includes:
155 /// - Filling out the text boxes
156 /// - Setting the visibility of the buttons
157 /// - Showing the quick save balloon if necessary
158 void populateLayout();
159
160 STATE_FUNC_DECLARE(dYesNoWindow_c, InitWait); ///< Initial state. Switches to OpenAnimeStartWait immediately.
161 STATE_FUNC_DECLARE(dYesNoWindow_c, OpenAnimeEndWait); ///< Waiting for the window to finish the opening animation.
162 STATE_FUNC_DECLARE(dYesNoWindow_c, ButtonOnStageAnimeEndWait); ///< Plays the button appearing animation and waits for it to finish.
163 STATE_FUNC_DECLARE(dYesNoWindow_c, ButtonChangeAnimeEndWait); ///< Playing the button change animations.
164 STATE_FUNC_DECLARE(dYesNoWindow_c, SelectWait); ///< Waiting for either a button change or button hit to occur.
165 STATE_FUNC_DECLARE(dYesNoWindow_c, HitAnimeEndWait); ///< Waiting for the button to finish the hit animation.
166 STATE_FUNC_DECLARE(dYesNoWindow_c, ClouseAnimeEndWait); ///< Waiting for the window to finish the closing animation.
167 STATE_FUNC_DECLARE(dYesNoWindow_c, HitAnimeAfterWait); ///< Waiting in an infinite loop after the button was pressed.
168
169 LytBase_c mLayout; ///< The layout for the window.
170
171 /// @brief The state manager for the window.
173
174 nw4r::lyt::Pane *mpRootPane; ///< The root pane of the window.
175 nw4r::lyt::Picture *mpPictures[P_COUNT]; ///< The picture panes.
176 LytTextBox_c *mpTextBoxes[T_COUNT]; ///< The text boxes.
177 nw4r::lyt::Pane *mpNullPanes[N_COUNT]; ///< The null panes.
178
179 int mCursorPos; ///< The current cursor position.
180 int mPrevCursorPos; ///< The previous cursor position.
181
182public:
183 /// @brief The type of the window.
184 /// @details This determines the text and the layout of the window.
186
187 /// @brief The number of star coins required to unlock a hint movie.
188 /// @details This is only to be used with the WATCH_UNLOCKED_HINT_MOVIE type.
190
191 bool mHasLoadedLayout; ///< Whether the layout has been loaded.
192 bool mIsActive; ///< Whether the window is currently open.
193 bool mHitButton; ///< Whether a button has been pressed.
194 bool mIsAnimating; ///< Whether an animation is currently playing.
195 bool mKeepOpen; ///< Whether the window should stay open after a button has been pressed.
196 bool mCancel; ///< Whether the window has been cancelled (and closed).
197 bool mHideBG; ///< Whether to hide the translucent background that fills the screen.
198};
A text box class with BMG message support.
dBase_c()
Constructs a new base.
Definition d_base.cpp:13
Displays a confirmation prompt.
ANIM_NAME_e
The animation names used for the window.
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.
ANIMS_e
The animations used for the window.
CURSOR_POS_e
The possible cursor positions.
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.
LytTextBox_c * mpTextBoxes[T_COUNT]
The text boxes.
int mPrevCursorPos
The previous cursor position.
virtual int doDelete()
do method for the delete operation.
virtual int draw()
do method for the draw operation.
T_FIXED_PANE_e
The fixed text boxes used for the window.
T_PANE_e
The text boxes used for the window.
N_PANE_e
The null panes used for the window.
SOUND_e
The sound effect types used for the window.
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).
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.
P_PANE_e
The picture panes used for the window.
WINDOW_TYPE_e
The prompt type.
void populateLayout()
Fills out the window content according to the settings.
int mCursorPos
The current cursor position.
A wrapper for sStateMgr_c that uses sFStateFct_c and sStateIDChk_c.
#define STATE_FUNC_DECLARE(class, name)
Declares a state.
Definition s_State.hpp:12