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
103 /// @unofficial
105 short mDispWaitTimer; ///< @copydoc dCourseSelectGuide_c::c_DISP_WAIT_TIMER
106 short mUnk; ///< @unused
107 };
108
109public:
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
124 /// @brief Updates the player icons in the remaining lives info to the active player.
125 /// @unofficial
126 void PlayerIconSet();
127
128 /**
129 * @brief Updates the textbox that displays the current course.
130 * @param type The point type.
131 *
132 * @unofficial
133 */
134 void CourseSelectSet(dWmLib::PointType_e type);
135
136 bool IsDirectionAllowed(int dir); ///< Returns whether the arrow for direction @p dir should be shown. @unofficial
137
138 /**
139 * @brief Updates the course-related parts of the course info guide.
140 * @param courseNo The course number.
141 * @param type The point type.
142 *
143 * The updated elements include the course name, the star coins collected and the checkpoint status.
144 * @unofficial
145 */
146 void UpdateGuide(short courseNo, dWmLib::PointType_e type);
147
148 /// @brief Checks for attached controller extensions and updates the button hints with the correct icon.
149 /// @details The updated elements include the "View Map" and "Items" button legends.
151
152 u32 mUnk; ///< @unused
153
154 LytBase_c mLayout; ///< The layout for the window.
155
156 /// @brief The state manager for the course info (world / course name).
158 /// @brief The state manager for the button legends and remaining lives display.
160 /// @brief The state manager for the up arrow for the map view.
162 /// @brief The state manager for the down arrow for the map view.
164 /// @brief The state manager for the left arrow for the map view.
166 /// @brief The state manager for the right arrow for the map view.
168 /// @brief The state manager for darkening the course view. [Unused?]
170 /// @brief The state manager for the button legends during the map view.
172
173 STATE_FUNC_DECLARE(dCourseSelectGuide_c, WorldCourseOnStageWait);
174 STATE_FUNC_DECLARE(dCourseSelectGuide_c, WorldCourseOnStageAnimeEndCheck);
176 STATE_FUNC_DECLARE(dCourseSelectGuide_c, WorldCourseExitAnimeEndCheck);
177
179 STATE_FUNC_DECLARE(dCourseSelectGuide_c, GuideOnStageAnimeEndCheck);
181 STATE_FUNC_DECLARE(dCourseSelectGuide_c, GuideExitAnimeEndCheck);
182
184 STATE_FUNC_DECLARE(dCourseSelectGuide_c, UpOnStageAnimeEndCheck);
187
189 STATE_FUNC_DECLARE(dCourseSelectGuide_c, DownOnStageAnimeEndCheck);
192
194 STATE_FUNC_DECLARE(dCourseSelectGuide_c, LeftOnStageAnimeEndCheck);
197
199 STATE_FUNC_DECLARE(dCourseSelectGuide_c, RightOnStageAnimeEndCheck);
201 STATE_FUNC_DECLARE(dCourseSelectGuide_c, RightExitAnimeEndCheck);
202
204 STATE_FUNC_DECLARE(dCourseSelectGuide_c, ShadowOnStageAnimeEndCheck);
206 STATE_FUNC_DECLARE(dCourseSelectGuide_c, ShadowExitAnimeEndCheck);
207
208 STATE_FUNC_DECLARE(dCourseSelectGuide_c, ScrollGuideOnStageWait);
209 STATE_FUNC_DECLARE(dCourseSelectGuide_c, ScrollGuideOnStageAnimeEndCheck);
211 STATE_FUNC_DECLARE(dCourseSelectGuide_c, ScrollGuideExitAnimeEndCheck);
212
213 nw4r::lyt::Pane *mpRootPane; ///< The root pane of the view.
214
215 nw4r::lyt::Pane *mpNullPanes[N_COUNT]; ///< The null panes of the view.
216 LytTextBox_c *mpTextBoxes[T_COUNT]; ///< The textboxes of the view.
217 nw4r::lyt::Picture *mpPicturePanes[P_COUNT]; ///< The picture panes of the view.
218
219 Remocon::EXTENSION_TYPE_e mExtension; ///< The currently attached Wii remote extension.
220 int mWorldNo; ///< The current world number.
221 int mCourseNo; ///< The current course number. Set to a negative value if it's a course with an icon.
222 int mCourseType; ///< The current course type. @todo Document this enum.
223
224 /**
225 * @brief The remaining lives for each player.
226 *
227 * Set to -1 if the player is not present. This is stored here so that the game doesn't have to
228 * recalculate the textbox each frame.
229 */
230 int mRest[PLAYER_COUNT];
231
232 int mWorldCourseOnStageTimer; ///< Cooldown for showing the course info.
233 int mGuideOnStageTimer; ///< Cooldown for showing the remaining guide HUD.
234
235 /**
236 * @brief The current transparency for the player remaining lives HUD.
237 *
238 * This should be changed via mRestAlphaTarget, which will cause mRestAlpha to smoothly
239 * transition to mRestAlphaTarget. @decompnote{This transition effect goes unused, because even
240 * though stepping on Peach's castle performs this transition, it happens before the
241 * remaining lives counter appears again on-screen.}
242 */
244 int mRestAlphaTarget; ///< The target transparency for mRestAlpha.
245
246 u8 mMoveDirection; ///< A bitmask describing which arrows should be shown in the free move view.
247
248 bool mInitialized; ///< Whether the layout has been fully initialized.
249
250 bool mShowCourseInfo; ///< Set this to @p true to show the course info.
251 bool mHideCourseInfo; ///< Set this to @p true to hide the course info.
252 bool mIsCourseInfoOutAnime; ///< Automatically set to @p false after the course info has been hidden.
253 bool mNoAnimCourseInfoIn; ///< Whether the course info should simply appear instead of sliding in.
254
255 bool mBeginGuide; ///< Set this to @p true to show the remaining guide.
256 bool mEndGuide; ///< Set this to @p true to hide the remaining guide.
257 bool mGuideRelated; ///< @todo Figure out what this does.
258 bool mNoHUDAppearAnim; ///< Whether the HUD should be shown without an animation.
259
260 bool mEnableAllArrows; ///< Whether to show all map view arrows. Gets reset after 1 frame.
261 bool mDisableArrows; ///< Whether to stop updating the map view arrows.
262 bool mMapView; ///< Whether the HUD should process the map view elements.
263
264 bool mEnabled; ///< Controls whether the HUD is updated every frame.
265 bool mHideHUD; ///< Set this to true to hide the entire HUD.
266
267 bool mShowShadow; ///< Set this to @p true to darken the world map view.
268 bool mHideShadow; ///< Set this to @p true to remove the darkening of the world map view.
269
270 bool mInMapView; ///< Whether the HUD is in the map view mode.
271
272 bool mShowScrollGuide; ///< Set this to @p true to show the button legends for the map view mode.
273 bool mEndScrollGuide; ///< Set this to @p true to hide the button legends for the map view mode.
274 bool mScrollGuideRelated; ///< @todo Figure out what this does.
275
276 bool mCourseInfoAnim; ///< Whether the course information is in an animation.
277 bool mUpAnim; ///< Whether the up arrow is in an animation.
278 bool mDownAnim; ///< Whether the down arrow is in an animation.
279 bool mLeftAnim; ///< Whether the left arrow is in an animation.
280 bool mRightAnim; ///< Whether the right arrow is in an animation.
281
282 bool mShowRestNumber; ///< Whether to update the remaining lives count.
283
284public:
285 static dCourseSelectGuide_c *m_instance; ///< The instance of the view.
286
287 /// @brief The speed at which the opacity of the remaining lives counter is changed.
288 static const int c_DISP_WAIT_TIMER;
289};
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.
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 UpdateGuide(short courseNo, dWmLib::PointType_e type)
Updates the course-related parts of the course info guide.
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 IsDirectionAllowed(int dir)
Returns whether the arrow for direction dir should be shown.
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.
LytTextBox_c * mpTextBoxes[T_COUNT]
The textboxes of the view.
bool createLayout()
Creates the layout and initializes the class state.
void CourseSelectSet(dWmLib::PointType_e type)
Updates the textbox that displays the current course.
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.
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.
void PlayerIconSet()
Updates the player icons in the remaining lives info to the active player.
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.