NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_wipe_mario.cpp
1#include <game/bases/d_wipe_mario.hpp>
2#include <game/bases/d_base_actor.hpp>
3#include <game/bases/d_game_com.hpp>
4#include <game/bases/d_a_py_mng.hpp>
5#include <game/bases/d_a_py_demo_mng.hpp>
6
8
10mFaderBase_c(mColor(color.rgba), stat) {
11 m_instance = this;
12 mIsCreated = false;
13}
14
18
20 static const char *AnmNameTbl[] = {
21 "wipeMario_02_inWindow.brlan",
22 "wipeMario_02_outWindow.brlan"
23 };
24
25 static const int ANIME_INDEX_TBL[] = {0, 1};
26 static const char *GROUP_NAME_DT[] = {
27 "A00_inWindow",
28 "B00_outWindow"
29 };
30
31 static const char *WPANE_NAME_DT[] = {
32 "W_Mario_00"
33 };
34
35 if (mIsCreated) {
36 return true;
37 }
38
39 bool res = mLyt.ReadResource("wipeMario/wipeMario.arc", false);
40 if (!res) {
41 return false;
42 }
43
44 mLyt.build("wipeMario_02.brlyt", 0);
45 mLyt.AnimeResRegister(AnmNameTbl, ARRAY_SIZE(AnmNameTbl));
46 mLyt.GroupRegister(GROUP_NAME_DT, ANIME_INDEX_TBL, ARRAY_SIZE(GROUP_NAME_DT));
47 mpRootPane = mLyt.getRootPane();
48 mLyt.WPaneRegister(WPANE_NAME_DT, mpWnd, ARRAY_SIZE(mpWnd));
49
50 mIsCreated = true;
51
52 mLyt.AllAnimeEndSetup();
53
54 mpRootPane->setVisible(false);
55 mLyt.mDrawOrder = 154;
56 mAction = IDLE;
57
58 return true;
59}
60
61typedef void (dWipeMario_c::*actMeth)();
62const actMeth actMeths[] = {
66};
67
69 if (!mIsCreated) {
70 return 1;
71 }
72 if (mAction != IDLE) {
73 (this->*actMeths[mAction])();
74 mLyt.AnimePlay();
75 mLyt.calc();
76 }
77 return 1;
78}
79
81 if (mIsCreated) {
82 mLyt.entry();
83 }
84}
85
87 mLyt.AllAnimeEndSetup();
88 mLyt.AnimeStartSetup(OUT, false);
90}
91
93 if (!mLyt.isAnime(-1)) {
94 if (getStatus() == FADE_IN) {
96 mFlag |= FADE_IN_COMPLETE;
97 mpRootPane->setVisible(false);
98 } else {
100 mFlag |= FADE_OUT_COMPLETE;
101 }
102 mAction = IDLE;
103 }
104}
105
107 mLyt.AllAnimeEndSetup();
108 mLyt.AnimeStartSetup(IN, false);
110}
111
113 if (stat == OPAQUE) {
114 mStatus = OPAQUE;
115
116 mpWnd[0]->setFieldB8(255);
117 mLyt.ReverseAnimeStartSetup(OUT, false);
118
119 mpRootPane->setVisible(true);
120 mLyt.AnimePlay();
121 mLyt.calc();
122 } else if (stat == HIDDEN) {
123 mStatus = HIDDEN;
124
125 mpWnd[0]->setFieldB8(0);
126 mLyt.ReverseAnimeStartSetup(IN, false);
127
128 mpRootPane->setVisible(true);
129 mLyt.AnimePlay();
130 mLyt.calc();
131 }
132}
133
135 bool res = mFaderBase_c::fadeIn();
136 if (res) {
138 }
139 return res;
140}
141
143 bool res = mFaderBase_c::fadeOut();
144 if (res) {
146 }
147 return res;
148}
A fader that animates a Mario texture in/out.
dWipeMario_c(nw4r::ut::Color, mFaderBase_c::EStatus stat)
See mFaderBase_c::mFaderBase_c.
@ CLOSE_SETUP
Prepare the fade-in transition.
@ OPEN_SETUP
Prepare the fade-out transition.
@ ANIME_END_CHECK
Fade has begun, waiting for it to end.
@ IDLE
The fade has not been started.
virtual bool fadeOut()
Initiates a fade out from no-obstruction.
void CloseSetup()
Prepares the fade-in transition.
bool mIsCreated
Whether the layout for the fader has been created.
static dWipeMario_c * m_instance
The instance of the fader.
virtual int calc()
Calculates the fader at the current frame.
nw4r::lyt::Pane * mpRootPane
The root pane of the fader layout.
void AnimeEndCheck()
Checks if the fade animation has finished yet.
virtual void setStatus(mFaderBase_c::EStatus stat)
Sets the fader's status.
virtual bool fadeIn()
Initiates a fade in from pure blacked-out.
void OpenSetup()
Prepares the fade-out transition.
~dWipeMario_c()
Destroys the fader.
@ IN
Fade-in animation.
@ OUT
Fade-out animation.
LytBase_c mLyt
The layout for the fader.
virtual void draw()
Draws the fader.
ACTION_e mAction
The action to be performed in calc.
bool createLayout()
Loads the resources and creates the layout for the fader.
nw4r::lyt::Window * mpWnd[1]
The window pane containing the fader texture.
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
A 32-bit RGBA color.
Definition color.hpp:8