NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_SmallScoreManager.cpp
1#include <game/bases/d_SmallScoreManager.hpp>
2#include <game/bases/d_game_com.hpp>
4
5ACTOR_PROFILE(SMALL_SCORE_MANAGER, dSmallScoreManager_c, 0);
6
8
9template <>
11 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
12 dSmallScoreManager_c::c_SMALL_SCORE_SIZE_4_3_X, dSmallScoreManager_c::c_SMALL_SCORE_SIZE_4_3_Y,
13 dSmallScoreManager_c::c_SMALL_SCORE_SIZE_16_9_X, dSmallScoreManager_c::c_SMALL_SCORE_SIZE_16_9_Y,
14 dSmallScoreManager_c::c_SMALL_GOAL_SCORE_SIZE_4_3_X, dSmallScoreManager_c::c_SMALL_GOAL_SCORE_SIZE_4_3_Y,
15 dSmallScoreManager_c::c_SMALL_GOAL_SCORE_SIZE_16_9_X, dSmallScoreManager_c::c_SMALL_GOAL_SCORE_SIZE_16_9_Y,
16 dSmallScoreManager_c::c_SCISSOR_SIZE_X, dSmallScoreManager_c::c_SCISSOR_SIZE_Y
17};
18
19const float dSmallScoreManager_c::c_SMALL_SCORE_SIZE_4_3_X = 0.8f;
20const float dSmallScoreManager_c::c_SMALL_SCORE_SIZE_4_3_Y = 0.8f;
21const float dSmallScoreManager_c::c_SMALL_SCORE_SIZE_16_9_X = 1.0f;
22const float dSmallScoreManager_c::c_SMALL_SCORE_SIZE_16_9_Y = 1.0f;
23const float dSmallScoreManager_c::c_SMALL_GOAL_SCORE_SIZE_16_9_X = 1.1f;
24const float dSmallScoreManager_c::c_SMALL_GOAL_SCORE_SIZE_16_9_Y = 1.1f;
25const float dSmallScoreManager_c::c_SMALL_GOAL_SCORE_SIZE_4_3_X = 0.8f;
26const float dSmallScoreManager_c::c_SMALL_GOAL_SCORE_SIZE_4_3_Y = 0.8f;
27const float dSmallScoreManager_c::c_SCISSOR_SIZE_X = 640.0f;
28const float dSmallScoreManager_c::c_SCISSOR_SIZE_Y = 352.0f;
29
33
37
39 if (!mResLoader.request("Layout/pointGet/pointGet.arc")) {
40 return NOT_READY;
41 }
42
43 for (int i = 0; i < SMALL_SCORE_COUNT; i++) {
44 if (!mSmallScores[i].createLayout(&mResLoader)) {
45 return NOT_READY;
46 }
47 }
48
49 for (int i = 0; i < PLAYER_COUNT; i++) {
50 if (!mGoalScores[i].createLayout(&mResLoader)) {
51 return NOT_READY;
52 }
53 }
54
55 mVec2_c scissorSize = mVec2_c(c_SCISSOR_SIZE_X, c_SCISSOR_SIZE_Y);
56
57 for (int i = 0; i < SMALL_SCORE_COUNT; i++) {
58 mSmallScores[i].setClipScale(scissorSize);
59 }
60
61 for (int i = 0; i < PLAYER_COUNT; i++) {
62 mGoalScores[i].setClipScale(scissorSize);
63 }
64
67 return SUCCEEDED;
68}
69
72 return SUCCEEDED;
73 }
74
75 for (int i = 0; i < SMALL_SCORE_COUNT; i++) {
76 mSmallScores[i].execute();
77 }
78
79 for (int i = 0; i < PLAYER_COUNT; i++) {
80 mGoalScores[i].execute();
81 }
82
84 return SUCCEEDED;
85}
86
88 for (int i = 0; i < SMALL_SCORE_COUNT; i++) {
89 mSmallScores[i].draw();
90 }
91
92 for (int i = 0; i < PLAYER_COUNT; i++) {
93 mGoalScores[i].draw();
94 }
95
96 return SUCCEEDED;
97}
98
100 if (!mResLoader.remove()) {
101 return NOT_READY;
102 }
103
104 for (int i = 0; i < SMALL_SCORE_COUNT; i++) {
105 if (!mSmallScores[i].doDelete()) {
106 return NOT_READY;
107 }
108 }
109
110 for (int i = 0; i < PLAYER_COUNT; i++) {
111 if (!mGoalScores[i].doDelete()) {
112 return NOT_READY;
113 }
114 }
115
116 return SUCCEEDED;
117}
118
119void dSmallScoreManager_c::CreateBlueNumber(const mVec3_c &pos, int popupType, int playerType) {
120 mSmallScores[mSmallScoresIdx].mHasBlueColor = true;
121 CreateSmallScore(pos, popupType, playerType);
122}
123
124void dSmallScoreManager_c::CreateRedNumber(const mVec3_c &pos, int playerType) {
125 mSmallScores[mSmallScoresIdx].mEnableBigSmallAnim = true;
127}
128
129
130void dSmallScoreManager_c::CreateSmallScore(const mVec3_c &pos, int popupType, int playerType) {
131 mSmallScores[mSmallScoresIdx].CreateSmallScore(pos, popupType, playerType);
132
133 if (dGameCom::GetAspectRatio() == 0) {
134 mSmallScores[mSmallScoresIdx].mScale.x = c_SMALL_SCORE_SIZE_4_3_X;
135 mSmallScores[mSmallScoresIdx].mScale.y = c_SMALL_SCORE_SIZE_4_3_Y;
136 } else {
137 mSmallScores[mSmallScoresIdx].mScale.x = c_SMALL_SCORE_SIZE_16_9_X;
138 mSmallScores[mSmallScoresIdx].mScale.y = c_SMALL_SCORE_SIZE_16_9_Y;
139 }
140
142 mSmallScoresIdx = 0;
143 }
144}
145
146void dSmallScoreManager_c::CreateGoalScore(const mVec3_c &pos, int popupType, int playerType) {
147 while (mGoalScoresIdx < PLAYER_COUNT) {
148 int i = mGoalScoresIdx;
149
150 if (!mGoalScores[i].mIsGoalScore) {
151 mGoalScores[i].CreateSmallScore(pos, popupType, playerType);
152 mGoalScores[i].mIsGoalScore = true;
153
154 if (dGameCom::GetAspectRatio() == 0) {
155 mGoalScores[i].mScale.x = c_SMALL_GOAL_SCORE_SIZE_4_3_X;
156 mGoalScores[i].mScale.y = c_SMALL_GOAL_SCORE_SIZE_4_3_Y;
157 } else {
158 mGoalScores[i].mScale.x = c_SMALL_GOAL_SCORE_SIZE_16_9_X;
159 mGoalScores[i].mScale.y = c_SMALL_GOAL_SCORE_SIZE_16_9_Y;
160 }
161 break;
162 }
164 }
165}
166
167void dSmallScoreManager_c::GoalScoreExecute(const mVec3_c &pos, int playerType) {
168 int scoreIndex = 0;
169 for (int i = 0; i < PLAYER_COUNT; i++) {
170 if (mGoalScores[i].mIsGoalScore && playerType == mGoalScores[i].mPlayerType) {
171 scoreIndex = i;
172 break;
173 }
174 }
175
176 if (mGoalScores[scoreIndex].mIsGoalScore) {
177 mGoalScores[scoreIndex].PosSet(pos);
178 }
179}
A manager for the small score popups.
virtual int execute()
do method for the execute operation.
int mSmallScoresIdx
The next free index in mSmallScores.
dSmallScore_c mGoalScores[PLAYER_COUNT]
The goal score popups.
int mGoalScoresIdx
The next free index in mGoalScores.
void GoalScoreExecute(const mVec3_c &pos, int playerType)
Updates the position of a goal score popup.
virtual int draw()
do method for the draw operation.
void CreateBlueNumber(const mVec3_c &pos, int popupType, int playerType)
Creates a blue small score popup.
dSmallScore_c mSmallScores[SMALL_SCORE_COUNT]
The regular small score popups.
static dSmallScoreManager_c * m_instance
The instance of the small score manager.
virtual int create()
do method for the create operation.
d2d::ResAccMultLoader_c mResLoader
The resource loader for the layout.
virtual int doDelete()
do method for the delete operation.
virtual ~dSmallScoreManager_c()
Destroys the base.
void CreateGoalScore(const mVec3_c &pos, int popupType, int playerType)
Creates a goal score popup.
dSmallScoreManager_c()
Constructs a new base.
void CreateSmallScore(const mVec3_c &pos, int popupType, int playerType)
Creates a small score popup.
void CreateRedNumber(const mVec3_c &pos, int playerType)
Creates a red number popup.
@ POPUP_TYPE_8
The number 8, used for red coins and toad balloons.
@ NOT_READY
The step could not completed at this time.
Definition f_base.hpp:42
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:43
A two-dimensional floating point vector.
Definition m_vec.hpp:9
A three-dimensional floating point vector.
Definition m_vec.hpp:100
static T::GlobalData_t mData
#define SMALL_SCORE_COUNT
The maximum number of small score popups visible simultaneously.
#define ACTOR_PROFILE(profName, className, properties)
Creates an actor profile, using the profile number as the execute and draw order value.
Definition f_profile.hpp:29
bool isGameStop(ulong flag)
Determines if gameplay is currently stopped for the specified reason(s).
@ GAME_STOP_ANY
The game is stopped for any unspecified reason.