NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_wipe_circle.hpp
1#pragma once
2#include <game/mLib/m_fader_base.hpp>
3#include <game/bases/d_lytbase.hpp>
4#include <nw4r/ut.h>
5
6/// @brief A fader that animates a circle in/out.
7/// @details Seen when entering a pipe, for example.
8/// @ingroup bases
9class dWipeCircle_c : public mFaderBase_c {
10public:
11
12 /// @brief The possible actions performed in ::calc.
13 enum ACTION_e {
14 OPEN_SETUP, ///< Prepare the fade-out transition.
15 ANIME_END_CHECK, ///< Fade has begun, waiting for it to end.
16 CLOSE_SETUP, ///< Prepare the fade-in transition.
17 IDLE, ///< The fade has not been started.
18 ACTION_COUNT = IDLE,
19 };
20
21 /// @brief The animations for this fader.
22 enum ANIM_e {
23 IN, ///< Fade-in animation.
24 OUT, ///< Fade-out animation.
25 ANIM_COUNT
26 };
27
28 /// @brief The animation names used for the fader.
30 inWindow,
31 outWindow,
32 ANIM_NAME_COUNT
33 };
34
35 /// @brief The window panes used for the fader.
36 enum W_PANE_e {
37 W_circle_00,
38 W_COUNT
39 };
40
41 dWipeCircle_c(nw4r::ut::Color, mFaderBase_c::EStatus status); ///< @copydoc mFaderBase_c::mFaderBase_c
42 ~dWipeCircle_c(); ///< @copydoc mFaderBase_c::~mFaderBase_c
43
44 /// @brief Loads the resources and creates the layout for the fader.
45 /// @return Whether the creation was successful.
46 bool createLayout();
47
48 /// @brief Sets the circle's center position.
49 void CenterPosSet();
50
51 /// @brief Prepares the fade-out transition.
52 void OpenSetup();
53
54 /// @brief Checks if the fade animation has finished yet.
55 /// @details If the animation has finished, sets the status accordingly
56 /// and switches back to the ::IDLE action.
57 void AnimeEndCheck();
58
59 /// @brief Prepares the fade-in transition.
60 void CloseSetup();
61
62 virtual int calc();
63 virtual void draw();
64 virtual void setStatus(mFaderBase_c::EStatus status); ///< @copydoc mFaderBase_c::setStatus
65 virtual bool fadeIn();
66 virtual bool fadeOut();
67
68 static dWipeCircle_c *m_instance; ///< The instance of the fader.
69
70private:
71 LytBase_c mLyt; ///< The layout for the fader.
72 nw4r::lyt::Pane *mpRootPane; ///< The root pane of the fader layout.
73 nw4r::lyt::Window *mpWnd[W_COUNT]; ///< The window panes of the fader.
74 mVec2_c mCenterPos; ///< The screen position of the circle's center point.
75 ACTION_e mAction; ///< The action to be performed in ::calc.
76 bool mIsCreated; ///< Whether the layout for the fader has been created.
77
78 /// @brief Whether the circle's center point needs to be targeted at a specific position.
79 /// @details If set to @p false, the circle is centered on the screen automatically.
81
82 /// @brief Whether ::mCenterPos should be used as the circle's center point.
83 /// @details If set to @p false, the circle is centered on the current demo player.
85};
bool mHasTarget
Whether the circle's center point needs to be targeted at a specific position.
LytBase_c mLyt
The layout for the fader.
virtual bool fadeOut()
Initiates a fade out from no-obstruction.
void AnimeEndCheck()
Checks if the fade animation has finished yet.
bool createLayout()
Loads the resources and creates the layout for the fader.
static dWipeCircle_c * m_instance
The instance of the fader.
~dWipeCircle_c()
Destroys the fader.
bool mIsCreated
Whether the layout for the fader has been created.
ACTION_e
The possible actions performed in calc.
@ 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.
nw4r::lyt::Pane * mpRootPane
The root pane of the fader layout.
void CloseSetup()
Prepares the fade-in transition.
dWipeCircle_c(nw4r::ut::Color, mFaderBase_c::EStatus status)
Constructs a new fader.
virtual void setStatus(mFaderBase_c::EStatus status)
Sets the fader's status.
virtual void draw()
Draws the fader.
W_PANE_e
The window panes used for the fader.
mVec2_c mCenterPos
The screen position of the circle's center point.
void OpenSetup()
Prepares the fade-out transition.
nw4r::lyt::Window * mpWnd[W_COUNT]
The window panes of the fader.
void CenterPosSet()
Sets the circle's center position.
ACTION_e mAction
The action to be performed in calc.
ANIM_e
The animations for this fader.
@ IN
Fade-in animation.
@ OUT
Fade-out animation.
virtual int calc()
Calculates the fader at the current frame.
bool mUseCenterPos
Whether mCenterPos should be used as the circle's center point.
virtual bool fadeIn()
Initiates a fade in from pure blacked-out.
ANIM_NAME_e
The animation names used for the fader.
mFaderBase_c(const mColor &color, EStatus status)
Constructs a new fader.
EStatus
The fader's status.
A two-dimensional floating point vector.
Definition m_vec.hpp:9