NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_wipe_dokan.cpp
1#include <game/bases/d_wipe_dokan.hpp>
2#include <game/bases/d_base_actor.hpp>
3#include <game/bases/d_game_com.hpp>
4#include <game/bases/d_a_player_manager.hpp>
5#include <game/bases/d_a_player_demo_manager.hpp>
6
8
10mFaderBase_c(mColor(color), status) {
11 m_instance = this;
12 mIsCreated = false;
13}
14
18
20 static const char *AnmNameTbl[ANIM_NAME_COUNT] = {
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 char *GROUP_NAME_DT[ANIM_COUNT] = {
28 "A00_wipeDokan",
29 "A00_wipeDokan",
30 "A00_wipeDokan",
31 "A00_wipeDokan"
32 };
33
34 static const int ANIME_INDEX_TBL[ANIM_COUNT] = {
35 inBlackDown,
36 outBlackUp,
37 outBlackDown,
38 inBlackUp
39 };
40
41 static const char *PPANE_NAME_DT[P_COUNT] = {
42 "P_baseBlack_00"
43 };
44
45 if (mIsCreated) {
46 return true;
47 }
48
49 bool res = mLyt.ReadResource("wipeDokan/wipeDokan.arc", false);
50 if (!res) {
51 return false;
52 }
53
54 mLyt.build("wipeDokan_02.brlyt", 0);
55 mLyt.AnimeResRegister(AnmNameTbl, ANIM_NAME_COUNT);
56 mLyt.GroupRegister(GROUP_NAME_DT, ANIME_INDEX_TBL, ANIM_COUNT);
57 mpRootPane = mLyt.getRootPane();
58 mLyt.PPaneRegister(PPANE_NAME_DT, mpPic, P_COUNT);
59
60 mIsCreated = true;
61
62 mLyt.AllAnimeEndSetup();
63
64 mpRootPane->SetVisible(false);
65 mLyt.mDrawOrder = m2d::DRAW_ORDER_WIPE;
66 mAction = IDLE;
67
68 return true;
69}
70
71typedef void (dWipeDokan_c::*Proc)();
72
74 static const Proc Proc_tbl[] = {
78 };
79
80 if (!mIsCreated) {
81 return 1;
82 }
83 if (mAction != IDLE) {
84 (this->*Proc_tbl[mAction])();
85 mLyt.AnimePlay();
86 mLyt.calc();
87 }
88 return 1;
89}
90
92 if (mIsCreated) {
93 mLyt.entry();
94 }
95}
96
98 mLyt.AllAnimeEndSetup();
99 if (MuKiDecision()) {
100 mLyt.AnimeStartSetup(OUT_DOWN, false);
101 } else {
102 mLyt.AnimeStartSetup(OUT_UP, false);
103 }
105}
106
108 if (!mLyt.isAnime(-1)) {
109 if (getStatus() == FADE_IN) {
110 mStatus = HIDDEN;
111 mFlag |= FADE_IN_COMPLETE;
112 mpRootPane->SetVisible(false);
113 } else {
114 mStatus = OPAQUE;
115 mFlag |= FADE_OUT_COMPLETE;
116 }
117 mAction = IDLE;
118 }
119}
120
122 int actPlayer = daPyDemoMng_c::mspInstance->mPlNo;
123 if (actPlayer < 0) {
124 return false;
125 }
126 dAcPy_c *player = daPyMng_c::getPlayer(actPlayer);
127 if (player == nullptr) {
128 return false;
129 }
130 return dGameCom::getDispCenterY() < player->mPos.y;
131}
132
134 mLyt.AllAnimeEndSetup();
135 if (MuKiDecision()) {
136 mLyt.AnimeStartSetup(IN_UP, false);
137 } else {
138 mLyt.AnimeStartSetup(IN_DOWN, false);
139 }
141}
142
144 if (status == OPAQUE) {
145 mStatus = OPAQUE;
146
147 mpPic[P_baseBlack_00]->SetAlpha(255);
148 mLyt.ReverseAnimeStartSetup(OUT_UP, false);
149
150 mpRootPane->SetVisible(true);
151 mLyt.AnimePlay();
152 mLyt.calc();
153 } else if (status == HIDDEN) {
154 mStatus = HIDDEN;
155
156 mpPic[P_baseBlack_00]->SetAlpha(0);
157 mLyt.ReverseAnimeStartSetup(IN_DOWN, false);
158
159 mpRootPane->SetVisible(true);
160 mLyt.AnimePlay();
161 mLyt.calc();
162 }
163}
164
166 bool res = mFaderBase_c::fadeIn();
167 if (res) {
169 }
170 return res;
171}
172
174 bool res = mFaderBase_c::fadeOut();
175 if (res) {
177 }
178 return res;
179}
mVec3_c mPos
The actor's position.
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.
void AnimeEndCheck()
Checks if the fade animation has finished yet.
virtual void setStatus(mFaderBase_c::EStatus status)
Sets the fader's status.
@ 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.
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::Picture * mpPic[P_COUNT]
The picture panes.
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 status)
Constructs a new fader.
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.
mFaderBase_c(const mColor &color, EStatus status)
Constructs a new fader.
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.
A 32-bit RGBA color.
Definition m_color.hpp:6