1#include <game/bases/d_SmallScore.hpp>
3#include <game/bases/d_info.hpp>
4#include <game/bases/d_game_com.hpp>
6#include <game/mLib/m_video.hpp>
7#include <game/mLib/m_vec.hpp>
8#include <game/bases/d_bg_parameter.hpp>
9#include <lib/egg/math/eggMath.h>
22 static const char *T_PANE_NAME_TBL[T_COUNT] = {
31 static const char *N_PANE_NAME_TBL[N_COUNT] = {
40 mLayout.build(
"pointGet_02.brlyt",
nullptr);
44 mpTextBoxes[T_coin_x_00]->setMessage(dMessage_c::getMesRes(), BMG_CATEGORY_SMALL_SCORE, MSG_LOWERCASE_X, 0);
57 mLayout.mDrawOrder = m2d::DRAW_ORDER_SMALL_SCORE;
58 mState = dSmallScore_c::STATE_NONE;
60 mEnableColorChange =
false;
61 mEnableBigSmallAnim =
false;
67void dSmallScore_c::execute() {
69 static const ProcFunc Proc_tbl[STATE_COUNT] = {
70 &dSmallScore_c::MakeStart,
71 &dSmallScore_c::UpMove,
72 &dSmallScore_c::DispWait,
73 &dSmallScore_c::GoalScoreDisp,
76 if (
mState == dSmallScore_c::STATE_NONE) {
80 (this->*Proc_tbl[
mState])();
85void dSmallScore_c::draw() {
86 if (
mState == dSmallScore_c::STATE_NONE) {
90 if (
mState <= dSmallScore_c::STATE_MAKE_START) {
97bool dSmallScore_c::doDelete() {
101void dSmallScore_c::setPlayer1upColor(
int player_id) {
102 dGameCom::Player1upColor(
mpTextBoxes[T_1UP_00], player_id);
105void dSmallScore_c::setPlayer1000Color(
int player_id) {
106 static const nw4r::ut::Color UP_COLOR_DATA_TBL[] = {
107 nw4r::ut::Color(255, 120, 0, 255),
108 nw4r::ut::Color(50, 250, 50, 255),
109 nw4r::ut::Color(0, 185, 220, 255),
110 nw4r::ut::Color(255, 255, 0, 255),
111 nw4r::ut::Color(255, 255, 255, 255),
114 static const nw4r::ut::Color DOWN_COLOR_DATA_TBL[] = {
115 nw4r::ut::Color(255, 200, 40, 255),
116 nw4r::ut::Color(255, 255, 0, 255),
117 nw4r::ut::Color(210, 255, 250, 255),
118 nw4r::ut::Color(255, 255, 180, 255),
119 nw4r::ut::Color(255, 255, 255, 255),
122 mpTextBoxes[T_1000_00]->SetVtxColor(nw4r::lyt::VERTEXCOLOR_LT, UP_COLOR_DATA_TBL[player_id]);
123 mpTextBoxes[T_1000_00]->SetVtxColor(nw4r::lyt::VERTEXCOLOR_LB, DOWN_COLOR_DATA_TBL[player_id]);
126void dSmallScore_c::setPlayer100Color(
int playerType) {
127 static const nw4r::ut::Color COLOR_DATA_TBL[] = {
128 nw4r::ut::Color(255, 150, 85, 255),
129 nw4r::ut::Color(70, 250, 70, 255),
130 nw4r::ut::Color(70, 200, 230, 255),
131 nw4r::ut::Color(250, 255, 80, 255),
132 nw4r::ut::Color(250, 255, 255, 255),
135 nw4r::lyt::Material *mat =
mpTextBoxes[T_100_00]->GetMaterial();
136 GXColorS10 col = nw4r::g3d::detail::GetRGBAS10(COLOR_DATA_TBL[playerType]);
137 mat->SetTevColor(1, col);
140void dSmallScore_c::chgColor() {
141 if (!mEnableColorChange) {
149 int type = mPlayerColor;
157 if (dInfo_c::m_instance->mCharIDs[type] == 3) {
162 setPlayer1upColor(type);
166void dSmallScore_c::setNormalOrBlueColor() {
167 static const nw4r::ut::Color UP_COLOR_DATA_TBL[] = {
168 nw4r::ut::Color(255, 10, 10, 255),
169 nw4r::ut::Color(60, 120, 255, 255),
171 static const nw4r::ut::Color DOWN_COLOR_DATA_TBL[] = {
172 nw4r::ut::Color(255, 150, 150, 255),
173 nw4r::ut::Color(200, 240, 255, 255),
182 mpTextBoxes[T_red2_00]->SetVtxColor(nw4r::lyt::VERTEXCOLOR_LT, UP_COLOR_DATA_TBL[colorIdx]);
183 mpTextBoxes[T_red2_00]->SetVtxColor(nw4r::lyt::VERTEXCOLOR_LB, DOWN_COLOR_DATA_TBL[colorIdx]);
186void dSmallScore_c::ScissorMaskSet() {
187 d2d::ScissorMask scissorMask;
188 scissorMask.mPos.x = 0.0f;
189 scissorMask.mPos.y = 0.0f;
190 scissorMask.mSize.x = 0.0f;
191 scissorMask.mSize.y = 0.0f;
192 scissorMask.mEnabled =
false;
194 if (dGameCom::GetAspectRatio() == 0) {
195 scissorMask.mPos.y = (mVideo::m_video->mRenderModeObj.efbHeight - mClipScale.y) * 0.5f;
196 scissorMask.mSize = mClipScale;
197 scissorMask.mEnabled = 1;
200 mLayout.mScissorMask = scissorMask;
203void dSmallScore_c::BigSmallAnime() {
204 mVec2_c sum = mScale;
205 mVec2_c delta(0.08f, 0.08f);
209 if (++mAnimCounter >= 10) {
212 if (mAnimIsShrinking) {
213 mAnimIsShrinking =
false;
215 mAnimIsShrinking =
true;
219 if (mAnimIsShrinking) {
226void dSmallScore_c::MakeStart() {
227 static const u32 SUB_ID_TBL[] = {
228 MSG_100, MSG_200, MSG_400, MSG_800, MSG_1000, MSG_2000, MSG_4000,
229 MSG_8000, MSG_ONE, MSG_TWO, MSG_THREE, MSG_FOUR, MSG_FIVE, MSG_SIX,
230 MSG_SEVEN, MSG_EIGHT, MSG_1UP, MSG_2UP, MSG_3UP, MSG_4UP, MSG_1UP,
231 MSG_COIN_2, MSG_COIN_3, MSG_COIN_5, MSG_COIN_10, MSG_COIN_15,
236 mPlayerColor = mPlayerType;
245 setPlayer100Color(mPlayerType);
247 }
else if (temp <= 7) {
248 setPlayer1000Color(mPlayerType);
250 }
else if (temp <= 15) {
251 setNormalOrBlueColor();
254 setPlayer1upColor(mPlayerType);
261 MsgRes_c *bmg = dMessage_c::getMesRes();
266 mMaxHeight = dBgParameter_c::ms_Instance_p->mPos.y - 20.0f;
270 mState = dSmallScore_c::STATE_GOAL_DISP;
273 mPosDeceleration.y = 0.025f;
277 mAnimIsShrinking =
false;
280 mState = dSmallScore_c::STATE_UP_MOVE;
284 mEnableColorChange =
true;
286 mEnableColorChange =
false;
293void dSmallScore_c::UpMove() {
294 if (mEnableBigSmallAnim) {
301 if (mPosDelta.y == EGG::Mathf::zero()) {
302 mState = dSmallScore_c::STATE_DISP_WAIT;
309void dSmallScore_c::DispWait() {
310 if (mEnableBigSmallAnim) {
317 if (mPlayerType == 4) {
334 mEnableBigSmallAnim =
false;
336 mState = dSmallScore_c::STATE_NONE;
339void dSmallScore_c::GoalScoreDisp() {}
341void dSmallScore_c::PositionSet() {
346 if (mPosDelta.y <= 0.0f) {
349 mPosOffset.y += mPosDelta.y;
350 mPosDelta.y -= mPosDeceleration.y;
354 globalPos.x = mPos.x;
355 globalPos.y = mPos.y + mPosOffset.y;
361 dGameCom::getGlbPosToLyt(globalPos);
369void dSmallScore_c::CreateSmallScore(
const mVec3_c &pos,
int popupType,
int playerType) {
376 mPlayerType = playerType;
383 mIsGoalScore =
false;
384 mState = dSmallScore_c::STATE_MAKE_START;
387void dSmallScore_c::PosSet(
const mVec3_c &pos) {
static unsigned int mGameFlag
See GAME_FLAG_e.
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.
dSmallScore_c()
Constructs a new score popup creator.
nw4r::lyt::Pane * mpRootPane
The root pane of the layout.
u32 mCurTextbox
The textbox currently displayed. Value is a T_PANE_e.
@ POPUP_TYPE_8000
The number 8000.
@ 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_2
[Coin icon]x2. Used in Coin Battle.
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.
bool mInitialized
Whether the layout has been initialized.
nw4r::lyt::Pane * mpNullPanes[N_COUNT]
The null panes used for the layout.
A three-dimensional floating point vector.