NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_collection_coin_base.cpp
1#include <game/bases/d_collection_coin_base.hpp>
3#include <game/framework/f_profile_name.hpp>
4#include <game/bases/d_game_com.hpp>
5
6BASE_PROFILE(COLLECTION_COIN_BASE, dCollectionCoinBase_c);
7
9
11
13 if (mIsCreated) {
14 return SUCCEEDED;
15 }
16
17 if (!createLayout()) {
18 return NOT_READY;
19 }
20
21 mpRootPane->SetVisible(true);
22 mLayout.mDrawOrder = m2d::DRAW_ORDER_COLLECTION_COIN_BASE;
23 mIsCreated = true;
24 mIsVisible = false;
25
26 return SUCCEEDED;
27}
28
30 static const char *N_PANE_NAME_TBL[] = {
31 "N_coinDateAll_00",
32 "N_coinBarPos_00", "N_coinBarPos_01", "N_coinBarPos_02",
33 "N_coinBarPos_03", "N_coinBarPos_04", "N_coinBarPos_05",
34 "N_coinBarPos_06", "N_coinBarPos_07", "N_coinBarPos_08",
35 "N_coinBarPos_09", "N_coinBarPos_10", "N_coinBarPos_11"
36 };
37
38 if (mLayout.mpResAccessor == nullptr) {
39 return false;
40 }
41
42 mLayout.build("worldCollectionCoinBase_01.brlyt", nullptr);
43 mpRootPane = mLayout.getRootPane();
44 mLayout.NPaneRegister(N_PANE_NAME_TBL, mpNullPanes, ARRAY_SIZE(N_PANE_NAME_TBL));
45 return true;
46}
47
50 return NOT_READY;
51 }
52
53 return !dGameCom::isGameStop(-1);
54}
55
57 if (mIsCreated && mIsVisible) {
58 mpRootPane->SetVisible(true);
59 mLayout.calc();
60 setDatePos();
61 } else {
62 mpRootPane->SetVisible(false);
63 }
64
65 return SUCCEEDED;
66}
67
69 if (mIsCreated && mIsVisible) {
70 mLayout.entry();
71 }
72
73 return SUCCEEDED;
74}
75
77 return mLayout.doDelete();
78}
79
81 for (int i = 0; i < STAR_COIN_MENU_LEVEL_COUNT; i++) {
82 nw4r::lyt::Pane *N_coinBarPos = mpNullPanes[N_coinBarPos_00 + i];
83 nw4r::lyt::Pane *rootPane = mpDates[i]->mpRootPane;
84
85 nw4r::math::MTX34 mtx = N_coinBarPos->GetGlobalMtx();
86
87 mVec3_c trans;
88 trans.x = mtx[0][3];
89 trans.y = mtx[1][3];
90 trans.z = 0.0f;
91 rootPane->SetTranslate(trans);
92
93 mVec2_c scale;
94 scale.x = mtx[0][0];
95 scale.y = mtx[1][1];
96 rootPane->SetScale(scale);
97
98 u8 alpha = mpNullPanes[N_coinDateAll_00]->GetAlpha();
99 mpDates[i]->N_coinBarDate_00->SetAlpha(alpha);
100 }
101}
virtual int preExecute()
pre method for the execute operation.
Definition d_base.cpp:54
The pages for the Star Coins Menu.
bool createLayout()
Loads the resources and creates the layout for the base.
LytBase_c mLayout
The layout of the page.
void setDatePos()
Updates the position of the dates every frame.
virtual int preExecute()
pre method for the execute operation.
virtual int execute()
do method for the execute operation.
virtual int create()
do method for the create operation.
virtual ~dCollectionCoinBase_c()
Destroys the base.
dCollectionCoinDate_c * mpDates[STAR_COIN_MENU_LEVEL_COUNT]
The date bases.
dCollectionCoinBase_c()
Constructs a new base.
bool mIsVisible
Whether the layout is currently visible.
virtual int draw()
do method for the draw operation.
bool mIsCreated
Whether the layout has been successfully created.
virtual int doDelete()
do method for the delete operation.
nw4r::lyt::Pane * mpRootPane
The root pane of the layout.
nw4r::lyt::Pane * mpNullPanes[N_COUNT]
The null panes of the layout.
@ NOT_READY
The step could not completed at this time.
Definition f_base.hpp:45
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:46
A two-dimensional floating point vector.
Definition m_vec.hpp:26
A three-dimensional floating point vector.
Definition m_vec.hpp:122
#define STAR_COIN_MENU_LEVEL_COUNT
The maximum number of levels in the Star Coins Menu.
#define BASE_PROFILE(profName, className)
Creates a basic profile, using the profile number as the execute and draw order value.
Definition f_profile.hpp:23
bool isGameStop(ulong flag)
Determines if gameplay is currently stopped for the specified reason(s).