NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_CourseSelectGuide.hpp
1#pragma once
2#include <types.h>
3#include <game/bases/d_base.hpp>
4#include <game/bases/d_lytbase.hpp>
6#include <game/sLib/s_StateMethodUsr_FI.hpp>
7#include <game/bases/d_wm_lib.hpp>
8#include <game/bases/d_s_world_map_static.hpp>
9#include <game/bases/d_game_key.hpp>
10#include <game/bases/d_info.hpp>
11#include <game/sLib/s_GlobalData.hpp>
12
13/// @brief The world map HUD.
15
16 /// @brief The text boxes used in the layout.
17 /// @unofficial
18 enum T_PANE_e {
19 T_worldNum_00,
20 T_cSelect_00,
21 T_cSelect_pic,
22 T_lifeNumber_00,
23 T_lifeNumber_01,
24 T_lifeNumber_02,
25 T_lifeNumber_03,
26 T_guideViewLS_00,
27 T_guideViewL_01,
28 T_COUNT
29 };
30
31 /// @brief The null panes used in the layout.
32 /// @unofficial
33 enum N_PANE_e {
34 N_IconPos1P_00,
35 N_IconPos2P_00,
36 N_IconPos3P_00,
37 N_IconPos4P_00,
38 N_mapArrow_00,
39 N_proportionL_00,
40 N_proportionR_00,
41 N_proportionC_00,
42 N_guideViewC_00,
43 N_guideViewR_01,
44 N_left_00,
45 N_COUNT
46 };
47
48 /// @brief The picture panes used in the layout.
49 /// @unofficial
50 enum P_PANE_e {
51 P_cC_1_00,
52 P_cC_2_00,
53 P_cC_3_00,
54 P_cC_1s_00,
55 P_cC_2s_00,
56 P_cC_3s_00,
57 P_flagSkull_00,
58 P_marioFace_00,
59 P_luigiFace_00,
60 P_BkinoFace_00,
61 P_YkinoFace_00,
62 P_bgShadow_00,
63 P_COUNT
64 };
65
66 /// @brief The animation names used in the layout.
67 /// @unofficial
69 inInfo,
70 loopInfo,
71 outInfo,
72 inMapArrow,
73 loopArrow,
74 outMapArrow,
75 inShadow,
76 outShadow,
77 ANIM_NAME_COUNT
78 };
79
80 /// @brief The animations used for the layout.
81 /// @unofficial
82 enum ANIM_e {
83 ANIM_IN_UNDER, ANIM_IN_ZANKI, ANIM_IN_COURSE_INFO,
84 ANIM_LOOP_UNDER, ANIM_LOOP_ZANKI, ANIM_LOOP_COURSE_INFO,
85 ANIM_OUT_UNDER, ANIM_OUT_ZANKI, ANIM_OUT_COURSE_INFO,
86 ANIM_IN_ARROW_R, ANIM_IN_ARROW_L, ANIM_IN_ARROW_U, ANIM_IN_ARROW_D,
87 ANIM_LOOP_ARROW_R, ANIM_LOOP_ARROW_L, ANIM_LOOP_ARROW_U, ANIM_LOOP_ARROW_D,
88 ANIM_OUT_ARROW_R, ANIM_OUT_ARROW_L, ANIM_OUT_ARROW_U, ANIM_OUT_ARROW_D,
89 ANIM_IN_SHADOW,
90 ANIM_OUT_SHADOW,
91 ANIM_COUNT
92 };
93
94 /// @brief The fixed panes used in the layout.
95 /// @unofficial
97 T_guideViewC_00,
98 T_guideViewR_00,
99 T_world_00,
100 T_FIXED_COUNT
101 };
102
103public:
104 /// @unofficial
106 short mDispWaitTimer; ///< @copydoc dCourseSelectGuide_c::c_DISP_WAIT_TIMER
107 short mUnk; ///< @unused
108 };
109
110 dCourseSelectGuide_c(); ///< Constructs a new course select guide instance.
111 virtual ~dCourseSelectGuide_c(); ///< Destroys the instance.
112
113private:
114 bool createLayout(); ///< Creates the layout and initializes the class state.
115 void ScissorMaskSet(); ///< Clips the layout to the maximum allowed size.
116 void RestNumberDisp(); ///< Fills in the text boxes showing the remaining lives count.
117 void RestAlphaDisp(); ///< Sets the opacity of the remaining lives count.
118 void execute(); ///< The main loop of the view.
119 void draw(); ///< Draws the view.
120 void doDelete(); ///< Prepares the view for deletion.
121
122 void CollectionCoinSet(); ///< Updates the star coin icons.
123 void WaKuPosSet(); ///< Updates the player icons in the remaining lives info to the active player.
124
125 /**
126 * @brief Updates the textbox that displays the current course.
127 * @param type The point type.
128 */
129 void CourseNumberSet(dWmLib::TypePoint_e type);
130
131 bool isArrowDispRequest(int dir); ///< Returns whether the arrow for direction @p dir should be shown.
132
133 /**
134 * @brief Updates the course-related parts of the course info guide.
135 * @param courseNo The course number.
136 * @param type The point type.
137 *
138 * The updated elements include the course name, the star coins collected and the checkpoint status.
139 */
140 void WorldCourseNumberWrite(int courseNo, dWmLib::TypePoint_e type);
141
142 /// @brief Checks for attached controller extensions and updates the button hints with the correct icon.
143 /// @details The updated elements include the "View Map" and "Items" button legends.
145
146 u32 mUnk; ///< @unused
147
148 LytBase_c mLayout; ///< The layout for the window.
149
150 /// @brief The state manager for the course info (world / course name).
152 /// @brief The state manager for the button legends and remaining lives display.
154 /// @brief The state manager for the up arrow for the map view.
156 /// @brief The state manager for the down arrow for the map view.
158 /// @brief The state manager for the left arrow for the map view.
160 /// @brief The state manager for the right arrow for the map view.
162 /// @brief The state manager for darkening the course view. [Unused?]
164 /// @brief The state manager for the button legends during the map view.
166
167 STATE_FUNC_DECLARE(dCourseSelectGuide_c, WorldCourseOnStageWait);
168 STATE_FUNC_DECLARE(dCourseSelectGuide_c, WorldCourseOnStageAnimeEndCheck);
170 STATE_FUNC_DECLARE(dCourseSelectGuide_c, WorldCourseExitAnimeEndCheck);
171
172 STATE_FUNC_DECLARE(dCourseSelectGuide_c, GuideOnStageWait);
173 STATE_FUNC_DECLARE(dCourseSelectGuide_c, GuideOnStageAnimeEndCheck);
175 STATE_FUNC_DECLARE(dCourseSelectGuide_c, GuideExitAnimeEndCheck);
176
178 STATE_FUNC_DECLARE(dCourseSelectGuide_c, UpOnStageAnimeEndCheck);
180 STATE_FUNC_DECLARE(dCourseSelectGuide_c, UpExitAnimeEndCheck);
181
183 STATE_FUNC_DECLARE(dCourseSelectGuide_c, DownOnStageAnimeEndCheck);
185 STATE_FUNC_DECLARE(dCourseSelectGuide_c, DownExitAnimeEndCheck);
186
188 STATE_FUNC_DECLARE(dCourseSelectGuide_c, LeftOnStageAnimeEndCheck);
190 STATE_FUNC_DECLARE(dCourseSelectGuide_c, LeftExitAnimeEndCheck);
191
192 STATE_FUNC_DECLARE(dCourseSelectGuide_c, RightOnStageWait);
193 STATE_FUNC_DECLARE(dCourseSelectGuide_c, RightOnStageAnimeEndCheck);
195 STATE_FUNC_DECLARE(dCourseSelectGuide_c, RightExitAnimeEndCheck);
196
197 STATE_FUNC_DECLARE(dCourseSelectGuide_c, ShadowOnStageWait);
198 STATE_FUNC_DECLARE(dCourseSelectGuide_c, ShadowOnStageAnimeEndCheck);
200 STATE_FUNC_DECLARE(dCourseSelectGuide_c, ShadowExitAnimeEndCheck);
201
202 STATE_FUNC_DECLARE(dCourseSelectGuide_c, ScrollGuideOnStageWait);
203 STATE_FUNC_DECLARE(dCourseSelectGuide_c, ScrollGuideOnStageAnimeEndCheck);
205 STATE_FUNC_DECLARE(dCourseSelectGuide_c, ScrollGuideExitAnimeEndCheck);
206
207 nw4r::lyt::Pane *mpRootPane; ///< The root pane of the view.
208
209 nw4r::lyt::Pane *mpNullPanes[N_COUNT]; ///< The null panes of the view.
210 LytTextBox_c *mpTextBoxes[T_COUNT]; ///< The textboxes of the view.
211 nw4r::lyt::Picture *mpPicturePanes[P_COUNT]; ///< The picture panes of the view.
212
213 Remocon::EXTENSION_TYPE_e mExtension; ///< The currently attached Wii remote extension.
214 int mWorldNo; ///< The current world number.
215 int mCourseNo; ///< The current course number. Set to a negative value if it's a course with an icon.
216 int mCourseType; ///< The current course type. @todo Document this enum.
217
218 /**
219 * @brief The remaining lives for each player.
220 *
221 * Set to -1 if the player is not present. This is stored here so that the game doesn't have to
222 * recalculate the textbox each frame.
223 */
224 int mRest[PLAYER_COUNT];
225
226 int mWorldCourseOnStageTimer; ///< Cooldown for showing the course info.
227 int mGuideOnStageTimer; ///< Cooldown for showing the remaining guide HUD.
228
229 /**
230 * @brief The current transparency for the player remaining lives HUD.
231 *
232 * This should be changed via mRestAlphaTarget, which will cause mRestAlpha to smoothly
233 * transition to mRestAlphaTarget. @decompnote{This transition effect goes unused, because even
234 * though stepping on Peach's castle performs this transition, it happens before the
235 * remaining lives counter appears again on-screen.}
236 */
238 int mRestAlphaTarget; ///< The target transparency for mRestAlpha.
239
240 u8 mMoveDirection; ///< A bitmask describing which arrows should be shown in the free move view.
241
242 bool mInitialized; ///< Whether the layout has been fully initialized.
243
244 bool mShowCourseInfo; ///< Set this to @p true to show the course info.
245 bool mHideCourseInfo; ///< Set this to @p true to hide the course info.
246 bool mIsCourseInfoOutAnime; ///< Automatically set to @p false after the course info has been hidden.
247 bool mNoAnimCourseInfoIn; ///< Whether the course info should simply appear instead of sliding in.
248
249 bool mBeginGuide; ///< Set this to @p true to show the remaining guide.
250 bool mEndGuide; ///< Set this to @p true to hide the remaining guide.
251 bool mGuideRelated; ///< @todo Figure out what this does.
252 bool mNoHUDAppearAnim; ///< Whether the HUD should be shown without an animation.
253
254 bool mEnableAllArrows; ///< Whether to show all map view arrows. Gets reset after 1 frame.
255 bool mDisableArrows; ///< Whether to stop updating the map view arrows.
256 bool mMapView; ///< Whether the HUD should process the map view elements.
257
258 bool mEnabled; ///< Controls whether the HUD is updated every frame.
259 bool mHideHUD; ///< Set this to true to hide the entire HUD.
260
261 bool mShowShadow; ///< Set this to @p true to darken the world map view.
262 bool mHideShadow; ///< Set this to @p true to remove the darkening of the world map view.
263
264 bool mInMapView; ///< Whether the HUD is in the map view mode.
265
266 bool mShowScrollGuide; ///< Set this to @p true to show the button legends for the map view mode.
267 bool mEndScrollGuide; ///< Set this to @p true to hide the button legends for the map view mode.
268 bool mScrollGuideRelated; ///< @todo Figure out what this does.
269
270 bool mCourseInfoAnim; ///< Whether the course information is in an animation.
271 bool mUpAnim; ///< Whether the up arrow is in an animation.
272 bool mDownAnim; ///< Whether the down arrow is in an animation.
273 bool mLeftAnim; ///< Whether the left arrow is in an animation.
274 bool mRightAnim; ///< Whether the right arrow is in an animation.
275
276 bool mShowRestNumber; ///< Whether to update the remaining lives count.
277
278public:
279 static dCourseSelectGuide_c *m_instance; ///< The instance of the view.
280
281 /// @brief The speed at which the opacity of the remaining lives counter is changed.
282 static const int c_DISP_WAIT_TIMER;
283};
A 2D layout.
Definition d_lytbase.hpp:9
A text box class with BMG message support.
bool mLeftAnim
Whether the left arrow is in an animation.
sFStateMgr_c< dCourseSelectGuide_c, sStateMethodUsr_FI_c > mStateMgrUp
The state manager for the up arrow for the map view.
sFStateMgr_c< dCourseSelectGuide_c, sStateMethodUsr_FI_c > mStateMgrGuide
The state manager for the button legends and remaining lives display.
bool mHideCourseInfo
Set this to true to hide the course info.
bool mShowScrollGuide
Set this to true to show the button legends for the map view mode.
bool mShowRestNumber
Whether to update the remaining lives count.
bool mHideShadow
Set this to true to remove the darkening of the world map view.
bool mInMapView
Whether the HUD is in the map view mode.
T_FIXED_PANE_e
The fixed panes used in the layout.
void CollectionCoinSet()
Updates the star coin icons.
bool mEndScrollGuide
Set this to true to hide the button legends for the map view mode.
int mRestAlphaTarget
The target transparency for mRestAlpha.
void ScissorMaskSet()
Clips the layout to the maximum allowed size.
bool mNoAnimCourseInfoIn
Whether the course info should simply appear instead of sliding in.
sFStateMgr_c< dCourseSelectGuide_c, sStateMethodUsr_FI_c > mStateMgrDown
The state manager for the down arrow for the map view.
bool mHideHUD
Set this to true to hide the entire HUD.
bool mShowCourseInfo
Set this to true to show the course info.
bool mUpAnim
Whether the up arrow is in an animation.
int mCourseNo
The current course number. Set to a negative value if it's a course with an icon.
Remocon::EXTENSION_TYPE_e mExtension
The currently attached Wii remote extension.
bool mEnableAllArrows
Whether to show all map view arrows. Gets reset after 1 frame.
bool mEndGuide
Set this to true to hide the remaining guide.
int mWorldNo
The current world number.
LytBase_c mLayout
The layout for the window.
sFStateMgr_c< dCourseSelectGuide_c, sStateMethodUsr_FI_c > mStateMgrLeft
The state manager for the left arrow for the map view.
int mWorldCourseOnStageTimer
Cooldown for showing the course info.
bool isArrowDispRequest(int dir)
Returns whether the arrow for direction dir should be shown.
int mRest[PLAYER_COUNT]
The remaining lives for each player.
sFStateMgr_c< dCourseSelectGuide_c, sStateMethodUsr_FI_c > mStateMgrWorldCourse
The state manager for the course info (world / course name).
bool mDownAnim
Whether the down arrow is in an animation.
sFStateMgr_c< dCourseSelectGuide_c, sStateMethodUsr_FI_c > mStateMgrShadow
The state manager for darkening the course view. [Unused?].
bool mShowShadow
Set this to true to darken the world map view.
bool mDisableArrows
Whether to stop updating the map view arrows.
void RestAlphaDisp()
Sets the opacity of the remaining lives count.
void doDelete()
Prepares the view for deletion.
nw4r::lyt::Pane * mpNullPanes[N_COUNT]
The null panes of the view.
void ControllerConnectCheck()
Checks for attached controller extensions and updates the button hints with the correct icon.
static const int c_DISP_WAIT_TIMER
The speed at which the opacity of the remaining lives counter is changed.
nw4r::lyt::Picture * mpPicturePanes[P_COUNT]
The picture panes of the view.
static dCourseSelectGuide_c * m_instance
The instance of the view.
int mCourseType
The current course type.
ANIM_NAME_e
The animation names used in the layout.
bool mEnabled
Controls whether the HUD is updated every frame.
bool mIsCourseInfoOutAnime
Automatically set to false after the course info has been hidden.
ANIM_e
The animations used for the layout.
bool mMapView
Whether the HUD should process the map view elements.
void WorldCourseNumberWrite(int courseNo, dWmLib::TypePoint_e type)
Updates the course-related parts of the course info guide.
LytTextBox_c * mpTextBoxes[T_COUNT]
The textboxes of the view.
bool createLayout()
Creates the layout and initializes the class state.
void WaKuPosSet()
Updates the player icons in the remaining lives info to the active player.
int mRestAlpha
The current transparency for the player remaining lives HUD.
void draw()
Draws the view.
bool mInitialized
Whether the layout has been fully initialized.
void RestNumberDisp()
Fills in the text boxes showing the remaining lives count.
sFStateMgr_c< dCourseSelectGuide_c, sStateMethodUsr_FI_c > mStateMgrRight
The state manager for the right arrow for the map view.
dCourseSelectGuide_c()
Constructs a new course select guide instance.
N_PANE_e
The null panes used in the layout.
P_PANE_e
The picture panes used in the layout.
T_PANE_e
The text boxes used in the layout.
bool mRightAnim
Whether the right arrow is in an animation.
virtual ~dCourseSelectGuide_c()
Destroys the instance.
sFStateMgr_c< dCourseSelectGuide_c, sStateMethodUsr_FI_c > mStateMgrScrollGuide
The state manager for the button legends during the map view.
bool mCourseInfoAnim
Whether the course information is in an animation.
bool mBeginGuide
Set this to true to show the remaining guide.
void CourseNumberSet(dWmLib::TypePoint_e type)
Updates the textbox that displays the current course.
bool mNoHUDAppearAnim
Whether the HUD should be shown without an animation.
int mGuideOnStageTimer
Cooldown for showing the remaining guide HUD.
nw4r::lyt::Pane * mpRootPane
The root pane of the view.
u8 mMoveDirection
A bitmask describing which arrows should be shown in the free move view.
void execute()
The main loop of the view.
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
short mDispWaitTimer
The speed at which the opacity of the remaining lives counter is changed.