NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_wipe_dokan.cpp
1#include <dol/bases/d_wipe_dokan.hpp>
2#include <dol/bases/d_base_actor.hpp>
3#include <dol/bases/d_game_com.hpp>
4#include <dol/bases/d_a_py_mng.hpp>
5#include <dol/bases/d_a_py_demo_mng.hpp>
6
8
10mFaderBase_c(mColor(color.rgba), stat) {
11 m_instance = this;
12 mIsCreated = false;
13}
14
16 m_instance = nullptr;
17}
18
20 static const char *animeNames[] = {
21 "wipeDokan_02_inBlackDown.brlan",
22 "wipeDokan_02_outBlackUp.brlan",
23 "wipeDokan_02_outBlackDown.brlan",
24 "wipeDokan_02_inBlackUp.brlan"
25 };
26
27 static const int groupIdxs[] = {0, 1, 2, 3};
28 static const char *groupNames[] = {
29 "A00_wipeDokan",
30 "A00_wipeDokan",
31 "A00_wipeDokan",
32 "A00_wipeDokan"
33 };
34
35 static const char *picNames[] = {
36 "P_baseBlack_00"
37 };
38
39 if (mIsCreated) {
40 return true;
41 }
42
43 bool res = mLyt.ReadResource("wipeDokan/wipeDokan.arc", false);
44 if (!res) {
45 return false;
46 }
47
48 mLyt.build("wipeDokan_02.brlyt", 0);
49 mLyt.AnimeResRegister(animeNames, ARRAY_SIZE(animeNames));
50 mLyt.GroupRegister(groupNames, groupIdxs, ARRAY_SIZE(groupNames));
51 mpRootPane = mLyt.getRootPane();
52 mLyt.PPaneRegister(picNames, mpPic, ARRAY_SIZE(mpPic));
53
54 mIsCreated = true;
55
56 mLyt.AllAnimeEndSetup();
57
58 mpRootPane->setVisible(false);
59 mLyt.mDrawOrder = 154;
60 mAction = IDLE;
61
62 return true;
63}
64
65typedef void (dWipeDokan_c::*actMeth)();
66const actMeth actMeths[] = {
70};
71
73 if (!mIsCreated) {
74 return 1;
75 }
76 if (mAction != IDLE) {
77 (this->*actMeths[mAction])();
78 mLyt.AnimePlay();
79 mLyt.calc();
80 }
81 return 1;
82}
83
85 if (mIsCreated) {
86 mLyt.entry();
87 }
88}
89
91 mLyt.AllAnimeEndSetup();
92 if (MuKiDecision()) {
93 mLyt.AnimeStartSetup(OUT_DOWN, false);
94 } else {
95 mLyt.AnimeStartSetup(OUT_UP, false);
96 }
98}
99
101 if (!mLyt.isAnime(-1)) {
102 if (getStatus() == FADE_IN) {
103 mStatus = HIDDEN;
104 mFlag |= FADE_IN_COMPLETE;
105 mpRootPane->setVisible(false);
106 } else {
107 mStatus = OPAQUE;
108 mFlag |= FADE_OUT_COMPLETE;
109 }
110 mAction = IDLE;
111 }
112}
113
115 int actPlayer = daPyDemoMng_c::mspInstance->mPlNo;
116 if (actPlayer < 0) {
117 return false;
118 }
119 dBaseActor_c *player = daPyMng_c::getPlayer(actPlayer);
120 if (player == nullptr) {
121 return false;
122 }
123 return dGameCom::getDispCenterY() < player->mPos.y;
124}
125
127 mLyt.AllAnimeEndSetup();
128 if (MuKiDecision()) {
129 mLyt.AnimeStartSetup(IN_UP, false);
130 } else {
131 mLyt.AnimeStartSetup(IN_DOWN, false);
132 }
134}
135
137 if (stat == OPAQUE) {
138 mStatus = OPAQUE;
139
140 mpPic[0]->setFieldB8(255);
141 mLyt.ReverseAnimeStartSetup(OUT_UP, false);
142
143 mpRootPane->setVisible(true);
144 mLyt.AnimePlay();
145 mLyt.calc();
146 } else if (stat == HIDDEN) {
147 mStatus = HIDDEN;
148
149 mpPic[0]->setFieldB8(0);
150 mLyt.ReverseAnimeStartSetup(IN_DOWN, false);
151
152 mpRootPane->setVisible(true);
153 mLyt.AnimePlay();
154 mLyt.calc();
155 }
156}
157
159 bool res = mFaderBase_c::fadeIn();
160 if (res) {
162 }
163 return res;
164}
165
167 bool res = mFaderBase_c::fadeOut();
168 if (res) {
170 }
171 return res;
172}
Basic actor class, supporting positioning, rotation and movement/acceleration.
mVec3_c mPos
The actor's position (top-left corner).
A fader that animates a wavy texture across the screen.
void OpenSetup()
Prepares the fade-out transition.
void CloseSetup()
Prepares the fade-in transition.
virtual bool fadeIn()
Initiates a fade in from pure blacked-out.
@ IN_DOWN
Downward fade-in.
@ IN_UP
Upward fade-in.
@ OUT_DOWN
Downward fade-out.
@ OUT_UP
Upward fade-out.
ACTION_e mAction
The action to be performed in calc.
LytBase_c mLyt
The layout for the fader.
bool mIsCreated
Whether the layout for the fader has been created.
virtual bool fadeOut()
Initiates a fade out from no-obstruction.
~dWipeDokan_c()
Destroys the fader.
virtual void setStatus(mFaderBase_c::EStatus stat)
Sets the fader's status.
void AnimeEndCheck()
Checks if the fade animation has finished yet.
@ OPEN_SETUP
Prepare the fade-out transition.
@ CLOSE_SETUP
Prepare the fade-in transition.
@ ANIME_END_CHECK
Fade has begun, waiting for it to end.
@ IDLE
The fade has not been started.
nw4r::lyt::Picture * mpPic[1]
The picture pane containing the fader texture.
bool MuKiDecision()
Returns whether the wipe should go upwards or downwards.
virtual int calc()
Calculates the fader at the current frame.
static dWipeDokan_c * m_instance
The instance of the fader.
nw4r::lyt::Pane * mpRootPane
The root pane of the fader layout.
virtual void draw()
Draws the fader.
bool createLayout()
Loads the resources and creates the layout for the fader.
dWipeDokan_c(nw4r::ut::Color, mFaderBase_c::EStatus stat)
See mFaderBase_c::mFaderBase_c.
Base fader implementation.
EStatus mStatus
The fader's status.
virtual EStatus getStatus() const
Gets the fader's status.
u8 mFlag
The fader's flags.
virtual bool fadeIn()
Initiates a fade in from pure blacked-out.
EStatus
The fader's status.
@ FADE_IN
Transition from OPAQUE to HIDDEN.
@ HIDDEN
The screen is completely unblocked.
@ OPAQUE
The screen is completely blacked out.
virtual bool fadeOut()
Initiates a fade out from no-obstruction.
float y
The coordinates on the Y axis.
Definition m_vec.hpp:172
A 32-bit RGBA color.
Definition m_color.hpp:6
A 32-bit RGBA color.
Definition color.hpp:8