NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_wipe_kuppa.cpp
1#include <game/bases/d_wipe_kuppa.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 *animeNames[] = {
21 "wipeKuppa_05_inWindow.brlan",
22 "wipeKuppa_05_outWindow.brlan"
23 };
24
25 static const int groupIdxs[] = {0, 1};
26 static const char *groupNames[] = {
27 "A00_inWindow",
28 "B00_outWindow"
29 };
30
31 static const char *windowNames[] = {
32 "W_kuppa_00"
33 };
34
35 if (mIsCreated) {
36 return true;
37 }
38
39 bool res = mLyt.ReadResource("wipeKuppa/wipeKuppa.arc", false);
40 if (!res) {
41 return false;
42 }
43
44 mLyt.build("wipeKuppa_05.brlyt", 0);
45 mLyt.AnimeResRegister(animeNames, ARRAY_SIZE(animeNames));
46 mLyt.GroupRegister(groupNames, groupIdxs, ARRAY_SIZE(groupNames));
47 mpRootPane = mLyt.getRootPane();
48 mLyt.WPaneRegister(windowNames, 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 (dWipeKuppa_c::*actMeth)();
62const actMeth actMeths[] = {
66};
68 if (!mIsCreated) {
69 return 1;
70 }
71 if (mAction != IDLE) {
72 (this->*actMeths[mAction])();
73 mLyt.AnimePlay();
74 mLyt.calc();
75 }
76 return 1;
77}
78
80 if (mIsCreated) {
81 mLyt.entry();
82 }
83}
84
86 mLyt.AllAnimeEndSetup();
87 mLyt.AnimeStartSetup(OUT, false);
89}
90
92 if (!mLyt.isAnime(-1)) {
93 if (getStatus() == FADE_IN) {
95 mFlag |= FADE_IN_COMPLETE;
96 mpRootPane->setVisible(false);
97 } else {
99 mFlag |= FADE_OUT_COMPLETE;
100 }
101 mAction = IDLE;
102 }
103}
104
106 mLyt.AllAnimeEndSetup();
107 mLyt.AnimeStartSetup(IN, false);
109}
110
112 if (stat == OPAQUE) {
113 mStatus = OPAQUE;
114
115 mpWnd[0]->setFieldB8(255);
116 mLyt.ReverseAnimeStartSetup(OUT, false);
117
118 mpRootPane->setVisible(true);
119 mLyt.AnimePlay();
120 mLyt.calc();
121 } else if (stat == HIDDEN) {
122 mStatus = HIDDEN;
123
124 mpWnd[0]->setFieldB8(0);
125 mLyt.ReverseAnimeStartSetup(IN, false);
126
127 mpRootPane->setVisible(true);
128 mLyt.AnimePlay();
129 mLyt.calc();
130 }
131}
132
134 bool res = mFaderBase_c::fadeIn();
135 if (res) {
137 }
138 return res;
139}
140
142 bool res = mFaderBase_c::fadeOut();
143 if (res) {
145 }
146 return res;
147}
A fader that animates a Bowser texture in/out.
virtual void draw()
Draws the fader.
void AnimeEndCheck()
Checks if the fade animation has finished yet.
static dWipeKuppa_c * m_instance
The instance of the fader.
bool mIsCreated
Whether the layout for the fader has been created.
ACTION_e mAction
The action to be performed in calc.
@ ANIME_END_CHECK
Fade has begun, waiting for it to end.
@ IDLE
The fade has not been started.
@ OPEN_SETUP
Prepare the fade-out transition.
@ CLOSE_SETUP
Prepare the fade-in transition.
void OpenSetup()
Prepares the fade-out transition.
dWipeKuppa_c(nw4r::ut::Color, mFaderBase_c::EStatus stat)
See mFaderBase_c::mFaderBase_c.
virtual int calc()
Calculates the fader at the current frame.
@ OUT
Fade-out animation.
@ IN
Fade-in animation.
virtual bool fadeOut()
Initiates a fade out from no-obstruction.
bool createLayout()
Loads the resources and creates the layout for the fader.
nw4r::lyt::Pane * mpRootPane
The root pane of the fader layout.
LytBase_c mLyt
The layout for the fader.
virtual void setStatus(mFaderBase_c::EStatus stat)
Sets the fader's status.
nw4r::lyt::Window * mpWnd[1]
The window pane containing the fader texture.
void CloseSetup()
Prepares the fade-in transition.
virtual bool fadeIn()
Initiates a fade in from pure blacked-out.
~dWipeKuppa_c()
Destroys the fader.
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.
A 32-bit RGBA color.
Definition m_color.hpp:6
A 32-bit RGBA color.
Definition color.hpp:8