NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_SmallScore.hpp
1#pragma once
2#include <game/bases/d_2d.hpp>
3#include <game/bases/d_lytbase.hpp>
4#include <game/mLib/m_vec.hpp>
5#include <nw4r/lyt.h>
6
7/**
8 * @brief Displays a small popup score indicator.
9 * @ingroup bases
10 * @details The class handles the creation, animation, and rendering of a single small score popup,
11 * which appears when performing actions such as stomping enemies, collecting coins, or earning 1-UPs.
12 */
14public:
15
16 /// @brief The possible states of the score popup.
17 enum STATE_e {
18 STATE_MAKE_START,
19 STATE_UP_MOVE,
20 STATE_DISP_WAIT,
21 STATE_GOAL_DISP,
22 STATE_COUNT,
23 STATE_NONE = STATE_COUNT
24 };
25
26 /// @brief The different types of the small score popups.
28 POPUP_TYPE_100, ///< The number 100.
29 POPUP_TYPE_200, ///< The number 200.
30 POPUP_TYPE_400, ///< The number 400.
31 POPUP_TYPE_800, ///< The number 800.
32 POPUP_TYPE_1000, ///< The number 1000.
33 POPUP_TYPE_2000, ///< The number 2000.
34 POPUP_TYPE_4000, ///< The number 4000.
35 POPUP_TYPE_8000, ///< The number 8000.
36 POPUP_TYPE_1, ///< The number 1, used for red coins and toad balloons.
37 POPUP_TYPE_2, ///< The number 2, used for red coins and toad balloons.
38 POPUP_TYPE_3, ///< The number 3, used for red coins and toad balloons.
39 POPUP_TYPE_4, ///< The number 4, used for red coins and toad balloons.
40 POPUP_TYPE_5, ///< The number 5, used for red coins and toad balloons.
41 POPUP_TYPE_6, ///< The number 6, used for red coins and toad balloons.
42 POPUP_TYPE_7, ///< The number 7, used for red coins and toad balloons.
43 POPUP_TYPE_8, ///< The number 8, used for red coins and toad balloons.
44 POPUP_TYPE_1UP, ///< The text "1-UP".
45 POPUP_TYPE_2UP, ///< The text "2-UP".
46 POPUP_TYPE_3UP, ///< The text "3-UP".
47 POPUP_TYPE_4UP, ///< The text "4-UP".
48 POPUP_TYPE_1UP_COLOR_CHANGE, ///< The text "1-UP", but changes color (see chgColor). Used when a 1-UP is awarded to multiple players.
49 POPUP_TYPE_COIN_2, ///< [Coin icon]x2. Used in Coin Battle.
50 POPUP_TYPE_COIN_3, ///< [Coin icon]x3. Used in Coin Battle.
51 POPUP_TYPE_COIN_5, ///< [Coin icon]x5. Used in Coin Battle.
52 POPUP_TYPE_COIN_10, ///< [Coin icon]x10. Used in Coin Battle.
53 POPUP_TYPE_COIN_15, ///< [Coin icon]x15. Used in Coin Battle.
54 POPUP_TYPE_COIN_20, ///< [Coin icon]x20. Used in Coin Battle.
55 POPUP_TYPE_INVALID = -1 ///< Invalid popup type.
56 };
57
58 /// @brief The text boxes used for the layout.
59 enum T_PANE_e {
60 T_100_00,
61 T_1000_00,
62 T_red2_00,
63 T_1UP_00,
64 T_coin_x_00,
65 T_coinPoint_00,
66 T_COUNT
67 };
68
69 /// @brief The null panes used for the layout.
70 enum N_PANE_e {
71 N_coin_00,
72 N_COUNT
73 };
74
75 typedef void (dSmallScore_c::*ProcFunc)();
76
77 dSmallScore_c(); ///< Constructs a new score popup creator.
78 virtual ~dSmallScore_c(); ///< Destroys the score popup creator.
79
80 bool createLayout(d2d::ResAccMultLoader_c *res);
81 void execute();
82 void draw();
83 bool doDelete();
84
85 void setPlayer1upColor(int);
86 void setPlayer1000Color(int);
87 void setPlayer100Color(int);
88 void chgColor();
89
90 void setNormalOrBlueColor();
91
92 void ScissorMaskSet();
93 void BigSmallAnime();
94
95 void MakeStart();
96 void UpMove();
97 void DispWait();
98 void GoalScoreDisp();
99
100 void PositionSet();
101 void CreateSmallScore(const mVec3_c &, int, int);
102 void PosSet(const mVec3_c &);
103
104 void setClipScale(mVec2_c v) { mClipScale = v; }
105
106 LytBase_c mLayout; ///< The layout for the score popup.
107 mVec2_c mPos;
108 mVec2_c mPosDelta;
109 mVec2_c mPosDeceleration;
110 mVec2_c mPosOffset;
111 mVec2_c mScale;
112 mVec2_c mClipScale;
113 mVec2_c mAnimScale;
114 nw4r::lyt::Pane *mpRootPane; ///< The root pane of the layout.
115 LytTextBox_c *mpTextBoxes[T_COUNT]; ///< The text boxes used for the layout.
116 nw4r::lyt::Pane *mpNullPanes[N_COUNT]; ///< The null panes used for the layout.
117 float mMaxHeight; ///< The maximum height the score popup can be displayed at.
118 STATE_e mState; ///< The state the score popup is in.
119 int mPopupType; ///< The popup type. Value is a POPUP_TYPE_e.
120 int mDispWaitCounter; ///< The amount of frames the @p DispWait state has been active.
121 int mDispWaitTime; ///< The number of frames to wait in the @p DispWait state.
122 int mPlayerType;
123 int mChgColorCounter; ///< Counter that is incremented every call to chgColor(), which ensures that the 1-UP color is only set once every 10 calls.
124 u32 mPlayerColor;
125 int mAnimCounter;
126 u32 mCurTextbox; ///< The textbox currently displayed. Value is a T_PANE_e.
127 bool mIsGoalScore;
128 bool mInitialized; ///< Whether the layout has been initialized.
129 bool mEnableColorChange;
130 bool mEnableBigSmallAnim;
131 bool mAnimIsShrinking;
132 bool mHasBlueColor; ///< Whether counter type score popups should be colored blue instead of red.
133
134 static dSmallScore_c *m_instance; ///< The instance of the score popup creator. @unused
135};
A text box class with BMG message support.
Displays a small popup score indicator.
bool mHasBlueColor
Whether counter type score popups should be colored blue instead of red.
int mChgColorCounter
Counter that is incremented every call to chgColor(), which ensures that the 1-UP color is only set o...
static dSmallScore_c * m_instance
The instance of the score popup creator.
LytBase_c mLayout
The layout for the score popup.
virtual ~dSmallScore_c()
Destroys the score popup creator.
STATE_e mState
The state the score popup is in.
STATE_e
The possible states of the score popup.
dSmallScore_c()
Constructs a new score popup creator.
N_PANE_e
The null panes used for the layout.
nw4r::lyt::Pane * mpRootPane
The root pane of the layout.
u32 mCurTextbox
The textbox currently displayed. Value is a T_PANE_e.
POPUP_TYPE_e
The different types of the small score popups.
@ POPUP_TYPE_4UP
The text "4-UP".
@ POPUP_TYPE_1000
The number 1000.
@ POPUP_TYPE_5
The number 5, used for red coins and toad balloons.
@ POPUP_TYPE_8000
The number 8000.
@ POPUP_TYPE_200
The number 200.
@ POPUP_TYPE_COIN_15
[Coin icon]x15. Used in Coin Battle.
@ POPUP_TYPE_1UP_COLOR_CHANGE
The text "1-UP", but changes color (see chgColor). Used when a 1-UP is awarded to multiple players.
@ POPUP_TYPE_COIN_10
[Coin icon]x10. Used in Coin Battle.
@ POPUP_TYPE_1UP
The text "1-UP".
@ POPUP_TYPE_COIN_3
[Coin icon]x3. Used in Coin Battle.
@ POPUP_TYPE_6
The number 6, used for red coins and toad balloons.
@ POPUP_TYPE_COIN_5
[Coin icon]x5. Used in Coin Battle.
@ POPUP_TYPE_3UP
The text "3-UP".
@ POPUP_TYPE_1
The number 1, used for red coins and toad balloons.
@ POPUP_TYPE_2
The number 2, used for red coins and toad balloons.
@ POPUP_TYPE_4
The number 4, used for red coins and toad balloons.
@ POPUP_TYPE_2000
The number 2000.
@ POPUP_TYPE_COIN_20
[Coin icon]x20. Used in Coin Battle.
@ POPUP_TYPE_INVALID
Invalid popup type.
@ POPUP_TYPE_400
The number 400.
@ POPUP_TYPE_8
The number 8, used for red coins and toad balloons.
@ POPUP_TYPE_7
The number 7, used for red coins and toad balloons.
@ POPUP_TYPE_2UP
The text "2-UP".
@ POPUP_TYPE_3
The number 3, used for red coins and toad balloons.
@ POPUP_TYPE_COIN_2
[Coin icon]x2. Used in Coin Battle.
@ POPUP_TYPE_4000
The number 4000.
@ POPUP_TYPE_800
The number 800.
@ POPUP_TYPE_100
The number 100.
LytTextBox_c * mpTextBoxes[T_COUNT]
The text boxes used for the layout.
int mDispWaitCounter
The amount of frames the DispWait state has been active.
float mMaxHeight
The maximum height the score popup can be displayed at.
int mDispWaitTime
The number of frames to wait in the DispWait state.
int mPopupType
The popup type. Value is a POPUP_TYPE_e.
T_PANE_e
The text boxes used for the layout.
bool mInitialized
Whether the layout has been initialized.
nw4r::lyt::Pane * mpNullPanes[N_COUNT]
The null panes used for the layout.
A two-dimensional floating point vector.
Definition m_vec.hpp:16
A three-dimensional floating point vector.
Definition m_vec.hpp:107