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>
13dSmallScore_c::dSmallScore_c() : mPos(0.0f, 0.0f), mScale(1.0f, 1.0f), mPosDelta(0.0f, 0.0f), mInitialized(false), mIsGoalScore(false) {
17dSmallScore_c::~dSmallScore_c() {
18 dSmallScore_c::m_instance =
nullptr;
22 static const char *T_PANE_NAME_TBL[] = {
23 "T_100_00",
"T_1000_00",
"T_red2_00",
"T_1UP_00",
"T_coin_x_00",
27 static const char *N_PANE_NAME_TBL[] = {
35 mLayout.mpResAccessor = res;
36 mLayout.build(
"pointGet_02.brlyt",
nullptr);
37 mpRootPane = mLayout.getRootPane();
39 mLayout.TPaneRegister(T_PANE_NAME_TBL, &T_100_00, ARRAY_SIZE(T_PANE_NAME_TBL));
40 T_coin_x_00->setMessage(dMessage_c::getMesRes(), BMG_CATEGORY_SMALL_SCORE, MSG_LOWERCASE_X, 0);
42 mLayout.NPaneRegister(N_PANE_NAME_TBL, &N_coin_00, ARRAY_SIZE(N_PANE_NAME_TBL));
44 T_100_00->SetVisible(
false);
45 T_1000_00->SetVisible(
false);
46 T_red2_00->SetVisible(
false);
47 T_1UP_00->SetVisible(
false);
48 T_coin_x_00->SetVisible(
false);
49 T_coinPoint_00->SetVisible(
false);
51 N_coin_00->SetVisible(
false);
52 mpRootPane->SetVisible(
false);
54 mLayout.mDrawOrder = 7;
55 mState = dSmallScore_c::STATE_NONE;
57 mEnableColorChange =
false;
58 mEnableBigSmallAnim =
false;
59 mHasBlueColor =
false;
64void dSmallScore_c::execute() {
66 static const ProcFunc Proc_tbl[] = {
67 &dSmallScore_c::MakeStart,
68 &dSmallScore_c::UpMove,
69 &dSmallScore_c::DispWait,
70 &dSmallScore_c::GoalScoreDisp,
73 if (
mState == dSmallScore_c::STATE_NONE) {
77 (this->*Proc_tbl[
mState])();
82void dSmallScore_c::draw() {
83 if (
mState == dSmallScore_c::STATE_NONE) {
87 if (
mState <= dSmallScore_c::STATE_MAKE_START) {
94bool dSmallScore_c::doDelete() {
95 return mLayout.doDelete();
98void dSmallScore_c::setPlayer1upColor(
int player_id) {
99 dGameCom::Player1upColor(T_1UP_00, player_id);
102void dSmallScore_c::setPlayer1000Color(
int player_id) {
103 static const nw4r::ut::Color UP_COLOR_DATA_TBL[] = {
104 nw4r::ut::Color(255, 120, 0, 255),
105 nw4r::ut::Color(50, 250, 50, 255),
106 nw4r::ut::Color(0, 185, 220, 255),
107 nw4r::ut::Color(255, 255, 0, 255),
108 nw4r::ut::Color(255, 255, 255, 255),
111 static const nw4r::ut::Color DOWN_COLOR_DATA_TBL[] = {
112 nw4r::ut::Color(255, 200, 40, 255),
113 nw4r::ut::Color(255, 255, 0, 255),
114 nw4r::ut::Color(210, 255, 250, 255),
115 nw4r::ut::Color(255, 255, 180, 255),
116 nw4r::ut::Color(255, 255, 255, 255),
119 T_1000_00->SetVtxColor(0, UP_COLOR_DATA_TBL[player_id]);
120 T_1000_00->SetVtxColor(2, DOWN_COLOR_DATA_TBL[player_id]);
123void dSmallScore_c::setPlayer100Color(
int playerType) {
124 static const nw4r::ut::Color COLOR_DATA_TBL[] = {
125 nw4r::ut::Color(255, 150, 85, 255),
126 nw4r::ut::Color(70, 250, 70, 255),
127 nw4r::ut::Color(70, 200, 230, 255),
128 nw4r::ut::Color(250, 255, 80, 255),
129 nw4r::ut::Color(250, 255, 255, 255),
132 nw4r::lyt::Material *mat = T_100_00->GetMaterial();
133 GXColorS10 col = nw4r::g3d::detail::GetRGBAS10(COLOR_DATA_TBL[playerType]);
134 mat->SetTevColor(1, col);
137void dSmallScore_c::chgColor() {
138 if (!mEnableColorChange) {
146 int type = mPlayerColor;
154 if (dInfo_c::m_instance->mCharIDs[type] == 3) {
159 setPlayer1upColor(type);
163void dSmallScore_c::setNormalOrBlueColor() {
164 static const nw4r::ut::Color UP_COLOR_DATA_TBL[] = {
165 nw4r::ut::Color(255, 10, 10, 255),
166 nw4r::ut::Color(60, 120, 255, 255),
168 static const nw4r::ut::Color DOWN_COLOR_DATA_TBL[] = {
169 nw4r::ut::Color(255, 150, 150, 255),
170 nw4r::ut::Color(200, 240, 255, 255),
175 mHasBlueColor =
false;
179 T_red2_00->SetVtxColor(0, UP_COLOR_DATA_TBL[colorIdx]);
180 T_red2_00->SetVtxColor(2, DOWN_COLOR_DATA_TBL[colorIdx]);
183void dSmallScore_c::ScissorMaskSet() {
184 d2d::ClipSettings clip;
186 if (dGameCom::GetAspectRatio() == 0) {
187 clip.mPos.y = (mVideo::m_video->mRenderModeObj.efbHeight - mClipScale.y) * 0.5f;
188 clip.mSize = mClipScale;
192 mLayout.mClipSettings = clip;
195void dSmallScore_c::BigSmallAnime() {
196 mVec2_c sum = mScale;
197 mVec2_c delta(0.08f, 0.08f);
201 if (++mAnimCounter >= 10) {
204 if (mAnimIsShrinking) {
205 mAnimIsShrinking =
false;
207 mAnimIsShrinking =
true;
211 if (mAnimIsShrinking) {
218void dSmallScore_c::MakeStart() {
219 static const u32 SUB_ID_TBL[] = {
220 MSG_100, MSG_200, MSG_400, MSG_800, MSG_1000, MSG_2000, MSG_4000,
221 MSG_8000, MSG_ONE, MSG_TWO, MSG_THREE, MSG_FOUR, MSG_FIVE, MSG_SIX,
222 MSG_SEVEN, MSG_EIGHT, MSG_1UP, MSG_2UP, MSG_3UP, MSG_4UP, MSG_1UP,
223 MSG_COIN_2, MSG_COIN_3, MSG_COIN_5, MSG_COIN_10, MSG_COIN_15,
227 int temp = mPopupType;
228 mPlayerColor = mPlayerType;
232 T_coin_x_00->SetVisible(
true);
233 T_coinPoint_00->SetVisible(
true);
234 N_coin_00->SetVisible(
true);
237 setPlayer100Color(mPlayerType);
239 }
else if (temp <= 7) {
240 setPlayer1000Color(mPlayerType);
242 }
else if (temp <= 15) {
243 setNormalOrBlueColor();
246 setPlayer1upColor(mPlayerType);
253 MsgRes_c *bmg = dMessage_c::getMesRes();
255 getTextBox(temp)->setMessage(bmg, BMG_CATEGORY_SMALL_SCORE, SUB_ID_TBL[mPopupType], 0);
258 mMaxHeight = dBgParameter_c::ms_Instance_p->mPos.y - 20.0f;
259 mpRootPane->SetVisible(
true);
262 mState = dSmallScore_c::STATE_GOAL_DISP;
265 mPosDeceleration.y = 0.025f;
269 mAnimIsShrinking =
false;
272 mState = dSmallScore_c::STATE_UP_MOVE;
275 if (mPopupType == 20) {
276 mEnableColorChange =
true;
278 mEnableColorChange =
false;
285void dSmallScore_c::UpMove() {
286 if (mEnableBigSmallAnim) {
293 if (mPosDelta.y == EGG::Math<float>::zero()) {
294 mState = dSmallScore_c::STATE_DISP_WAIT;
295 if (mPopupType >= 21) {
301void dSmallScore_c::DispWait() {
302 if (mEnableBigSmallAnim) {
309 if (mPlayerType == 4) {
318 mpRootPane->SetVisible(
false);
319 T_100_00->SetVisible(
false);
320 T_1000_00->SetVisible(
false);
321 T_red2_00->SetVisible(
false);
322 T_1UP_00->SetVisible(
false);
323 T_coin_x_00->SetVisible(
false);
324 T_coinPoint_00->SetVisible(
false);
325 N_coin_00->SetVisible(
false);
326 mEnableBigSmallAnim =
false;
328 mState = dSmallScore_c::STATE_NONE;
331void dSmallScore_c::GoalScoreDisp() {}
333void dSmallScore_c::PositionSet() {
334 if (!mpRootPane->IsVisible()) {
338 if (mPosDelta.y <= 0.0f) {
341 mPosOffset.y += mPosDelta.y;
342 mPosDelta.y -= mPosDeceleration.y;
346 globalPos.x = mPos.x;
347 globalPos.y = mPos.y + mPosOffset.y;
349 if (globalPos.y >= mMaxHeight) {
350 globalPos.y = mMaxHeight;
353 dGameCom::getGlbPosToLyt(globalPos);
358 mpRootPane->SetTranslate(mVec3_c(pos, 0.0f));
361void dSmallScore_c::CreateSmallScore(
const mVec3_c &pos,
int popupType,
int playerType) {
362 mpRootPane->SetVisible(
false);
367 mPopupType = popupType;
368 mPlayerType = playerType;
375 mIsGoalScore =
false;
376 mState = dSmallScore_c::STATE_MAKE_START;
379void dSmallScore_c::PosSet(
const mVec3_c &pos) {
static unsigned int mGameFlag
See GAME_FLAG_e.
int mChgColorCounter
Counter that is incremented every call to dSmallScore_c::chgColor(), which ensures that the 1-up colo...
STATE_e mState
Determines the state the score popup is in.
int mDispWaitCounter
Counter that is incremented every frame while in the 'DispWait' state.
int mDispWaitTime
Number of frames to wait in 'DispWait' (unless mPlayerType is 4, in which case the default value is 6...
LytTextBox_c * getTextBox(int n)
Gets the n-th text box.
A three-dimensional floating point vector.