NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_SelectCursor.hpp
1#pragma once
2#include <types.h>
3#include <game/bases/d_base.hpp>
4#include <game/bases/d_lytbase.hpp>
5#include <game/bases/d_2d/multi.hpp>
6
7/// @brief Manages the animated L-shaped corner rectangles around selected buttons.
8/// @details Owns and updates multiple @ref dSelectCursor_c::Layout_c "cursor layout instances"
9/// that can be attached to target @ref nw4r::lyt::Pane "panes".
10/// @todo Add the draw order values to the dedicated enum.
11/// @ingroup bases
12class dSelectCursor_c : public dBase_c {
13public:
14
15 /// @brief The possible cursor slots.
16 /// @todo Figure out the behaviour differences between slots and give each one a name.
17 /// @unofficial
18 enum LAYOUT_e {
19 UNK_0,
20 UNK_1,
21 UNK_2,
22 UNK_3,
23 UNK_4,
24 LAYOUT_COUNT
25 };
26
27 /// @brief The null panes used in the layout.
28 /// @unofficial
29 enum N_PANE_e {
30 N_cursor_00,
31 N_LU_00,
32 N_RU_00,
33 N_LD_00,
34 N_RD_00,
35 N_COUNT
36 };
37
38 /// @brief The picture panes used in the layout.
39 /// @unofficial
40 enum P_PANE_e {
41 P_cursor_00,
42 P_cursor_01,
43 P_cursor_02,
44 P_cursor_03,
45 P_COUNT
46 };
47
48 /// @brief The animations used in the layout.
49 /// @unofficial
50 enum ANIM_e {
51 ANIM_CURSOR,
52 ANIM_COUNT
53 };
54
55 /// @brief A cursor layout instance.
56 class Layout_c {
57 public:
58 LytBase_c mBase; ///< The layout of the instance.
59 nw4r::lyt::Pane *mpRootPane; ///< The root pane of the view.
60 nw4r::lyt::Picture *mpPicturePanes[P_COUNT]; ///< The picture panes of the view.
61 nw4r::lyt::Pane *mpNullPanes[N_COUNT]; ///< The null panes of the view.
62 bool mIsActive; ///< Whether the layout is drawn.
63
64 char mPaneName[100]; ///< The name of the parent pane.
65 nw4r::lyt::Size mPaneSize; ///< The size of the parent pane.
66 nw4r::lyt::Size mPaneOffset; ///< The offset of the parent pane.
67 mVec2_c mPaneGlbMtxScale; ///< The scale of the parent pane's global matrix.
68 mVec2_c mPaneGlbMtxTrans; ///< The translation of the parent pane's global matrix.
69
70 u32 m_248; ///< @unused
71 mVec2_c mRootPaneOffset; ///< Additional offset from the layout root pane. @unused
72 float m_254; ///< Only set to 0, never read. @unused
73
74 u8 mPaneBasePosH; ///< The horizontal base position of the parent pane. Value is a nw4r::lyt::HorizontalPosition.
75 u8 mPaneBasePosV; ///< The vertical base position of the parent pane. Value is a nw4r::lyt::VerticalPosition.
76 int mPaneAlpha; ///< The opacity of the layout.
77 bool mDoFade; ///< Whether the layout should be faded out and deactivated.
78 };
79
80 dSelectCursor_c(); ///< @copydoc dBase_c::dBase_c
81 virtual ~dSelectCursor_c(); ///< @copydoc dBase_c::~dBase_c
82
83 int create();
84 int doDelete();
85 int execute();
86 int draw();
87
88 /// @brief Updates the position of an attached cursor layout.
89 /// @param layoutId The cursor slot index.
90 void PosSet(int layoutId);
91
92 /// @brief Deactivates and hides the specified cursor layout.
93 /// @param layoutId The cursor slot index.
94 void Cancel(int layoutId);
95
96 /// @brief Attaches a cursor to the given pane.
97 /// @param pane The pane to attach the cursor to.
98 /// @param layoutId The cursor slot index.
99 /// @param forceTopDrawOrder If @p true , sets this cursor's draw order to a higher priority value.
100 /// If @p false , it restores the default draw order for all cursors.
101 void SetPane(const nw4r::lyt::Pane *pane, int layoutId, bool forceTopDrawOrder);
102
103 /// @brief Sets the alpha of a cursor to match the given pane.
104 /// @param pane The source pane whose alpha value will be copied.
105 /// @param layoutId The cursor slot index.
106 void SetAlpha(const nw4r::lyt::Pane *pane, int layoutId);
107
108 d2d::ResAccMultLoader_c mResLoader; ///< The resource loader for the layout.
109 Layout_c mLayouts[LAYOUT_COUNT]; ///< The cursor layout instances.
110 bool mHasLoadedLayout; ///< Whether the layout has been loaded.
111
112 static dSelectCursor_c *m_instance; ///< The static instance of the selection cursor manager.
113};
dBase_c()
Constructs a new base.
Definition d_base.cpp:13
A cursor layout instance.
mVec2_c mPaneGlbMtxScale
The scale of the parent pane's global matrix.
u8 mPaneBasePosH
The horizontal base position of the parent pane. Value is a nw4r::lyt::HorizontalPosition.
LytBase_c mBase
The layout of the instance.
nw4r::lyt::Size mPaneSize
The size of the parent pane.
int mPaneAlpha
The opacity of the layout.
nw4r::lyt::Pane * mpNullPanes[N_COUNT]
The null panes of the view.
bool mDoFade
Whether the layout should be faded out and deactivated.
u8 mPaneBasePosV
The vertical base position of the parent pane. Value is a nw4r::lyt::VerticalPosition.
char mPaneName[100]
The name of the parent pane.
nw4r::lyt::Pane * mpRootPane
The root pane of the view.
nw4r::lyt::Picture * mpPicturePanes[P_COUNT]
The picture panes of the view.
mVec2_c mPaneGlbMtxTrans
The translation of the parent pane's global matrix.
bool mIsActive
Whether the layout is drawn.
mVec2_c mRootPaneOffset
Additional offset from the layout root pane.
float m_254
Only set to 0, never read.
nw4r::lyt::Size mPaneOffset
The offset of the parent pane.
void PosSet(int layoutId)
Updates the position of an attached cursor layout.
void Cancel(int layoutId)
Deactivates and hides the specified cursor layout.
dSelectCursor_c()
Constructs a new base.
int execute()
do method for the execute operation.
bool mHasLoadedLayout
Whether the layout has been loaded.
ANIM_e
The animations used in the layout.
int doDelete()
do method for the delete operation.
LAYOUT_e
The possible cursor slots.
void SetPane(const nw4r::lyt::Pane *pane, int layoutId, bool forceTopDrawOrder)
Attaches a cursor to the given pane.
void SetAlpha(const nw4r::lyt::Pane *pane, int layoutId)
Sets the alpha of a cursor to match the given pane.
virtual ~dSelectCursor_c()
Destroys the base.
Layout_c mLayouts[LAYOUT_COUNT]
The cursor layout instances.
N_PANE_e
The null panes used in the layout.
P_PANE_e
The picture panes used in the layout.
d2d::ResAccMultLoader_c mResLoader
The resource loader for the layout.
int create()
do method for the create operation.
static dSelectCursor_c * m_instance
The static instance of the selection cursor manager.
int draw()
do method for the draw operation.
A two-dimensional floating point vector.
Definition m_vec.hpp:16