NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches

#include <game/bases/d_SelectCursor.hpp>

Inheritance diagram for dSelectCursor_c:
[legend]

Description

Manages the animated L-shaped corner rectangles around selected buttons.

Owns and updates multiple cursor layout instances that can be attached to target panes.

Todo
Add the draw order values to the dedicated enum.

Definition at line 12 of file d_SelectCursor.hpp.

Classes

class  Layout_c
 A cursor layout instance. More...

Public Types

enum  LAYOUT_e {
  UNK_0 ,
  UNK_1 ,
  UNK_2 ,
  UNK_3 ,
  UNK_4 ,
  LAYOUT_COUNT
}
 The possible cursor slots. More...
enum  N_PANE_e {
  N_cursor_00 ,
  N_LU_00 ,
  N_RU_00 ,
  N_LD_00 ,
  N_RD_00 ,
  N_COUNT
}
 The null panes used in the layout. More...
enum  P_PANE_e {
  P_cursor_00 ,
  P_cursor_01 ,
  P_cursor_02 ,
  P_cursor_03 ,
  P_COUNT
}
 The picture panes used in the layout. More...
enum  ANIM_e {
  ANIM_CURSOR ,
  ANIM_COUNT
}
 The animations used in the layout. More...
Public Types inherited from fBase_c
enum  LIFECYCLE_e {
  CREATING ,
  ACTIVE ,
  DELETING
}
 The possible lifecycle states. More...
enum  GROUP_TYPE_e {
  OTHER ,
  SCENE ,
  ACTOR ,
  ENEMY
}
 The possible group types. More...
enum  MAIN_STATE_e {
  CANCELED ,
  ERROR ,
  SUCCESS ,
  WAITING
}
 The possible operation results. More...
enum  PACK_RESULT_e {
  NOT_READY ,
  SUCCEEDED ,
  FAILED
}
 The possible operation step results. More...
enum  PROC_DISABLE_e {
  ROOT_DISABLE_EXECUTE = BIT_FLAG(0) ,
  DISABLE_EXECUTE = BIT_FLAG(1) ,
  ROOT_DISABLE_DRAW = BIT_FLAG(2) ,
  DISABLE_DRAW = BIT_FLAG(3)
}
 Controls if the execute and draw operations should be skipped. More...

Public Member Functions

 dSelectCursor_c ()
 Constructs a new base.
virtual ~dSelectCursor_c ()
 Destroys the base.
int create ()
 do method for the create operation.
int doDelete ()
 do method for the delete operation.
int execute ()
 do method for the execute operation.
int draw ()
 do method for the draw operation.
void PosSet (int layoutId)
 Updates the position of an attached cursor layout.
void Cancel (int layoutId)
 Deactivates and hides the specified cursor layout.
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.
Public Member Functions inherited from dBase_c
 dBase_c ()
 Constructs a new base.
virtual int preCreate ()
 pre method for the create operation.
virtual void postCreate (fBase_c::MAIN_STATE_e status)
 post method for the create operation.
virtual int preDelete ()
 pre method for the delete operation.
virtual void postDelete (fBase_c::MAIN_STATE_e status)
 post method for the delete operation.
virtual int preExecute ()
 pre method for the execute operation.
virtual void postExecute (fBase_c::MAIN_STATE_e status)
 post method for the execute operation.
virtual int preDraw ()
 pre method for the draw operation.
virtual void postDraw (fBase_c::MAIN_STATE_e status)
 post method for the draw operation.
virtual ~dBase_c ()
 Destroys the base.
virtual const char * getKindString () const
 Gets the base's kind string.
Public Member Functions inherited from fBase_c
 fBase_c ()
 Constructs a new base.
void deleteRequest ()
 Requests deletion of the base.
fBase_cgetConnectParent () const
 Gets the base's parent.
fBase_cgetConnectChild () const
 Gets the base's first child.
fBase_cgetConnectBrNext () const
 Gets the base's next sibling.
bool checkChildProcessCreateState () const
 Checks if the base has at least one child in the CREATING state.
Public Member Functions inherited from cOwnerSetMg_c
 cOwnerSetMg_c ()
 Constructs a new set container.
 ~cOwnerSetMg_c ()
 Destroys the set.
void add (cOwnerSetNd_c *nd, void *owner)
 Adds a node to the set.
void remove (cOwnerSetNd_c *nd, void *owner)
 Removes a node from the set.

Public Attributes

d2d::ResAccMultLoader_c mResLoader
 The resource loader for the layout.
Layout_c mLayouts [LAYOUT_COUNT]
 The cursor layout instances.
bool mHasLoadedLayout
 Whether the layout has been loaded.
Public Attributes inherited from fBase_c
fBaseID_e mUniqueID
 The base's unique identifier.
u32 mParam
 A bitfield that configures the base's behaviour. Its usage varies from profile to profile.
ProfileName mProfName
 The base's profile name.

Static Public Attributes

static dSelectCursor_cm_instance = nullptr
 The static instance of the selection cursor manager.

Additional Inherited Members

Static Public Member Functions inherited from dBase_c
static dBase_csearchBaseByProfName (ProfileName profile, const dBase_c *parent)
 Searches for a base with a given profile name, optionally under a given parent.
static void initLoader ()
 Sets the callbacks for the scrapped relocatable profile system.
static dBase_ccreateBase (ProfileName profName, dBase_c *parent, unsigned long param, u8 groupType)
 Creates a child base under the given parent.
static dBase_ccreateRoot (ProfileName profName, unsigned long param, u8 groupType)
 Creates a root base.
Static Public Member Functions inherited from fBase_c
static void * operator new (size_t)
 new operator override for all bases.
static void operator delete (void *)
 delete operator override for all bases.
static fBase_ccreateChild (ProfileName profName, fBase_c *parent, unsigned long param, u8 groupType)
 Creates a child base under the given parent.
static fBase_ccreateRoot (ProfileName profName, unsigned long param, u8 groupType)
 Creates a root base.
Protected Member Functions inherited from fBase_c
bool isProcControlFlag (u8 flag) const
 Checks if a flag is set in mProcControl.
void setProcControlFlag (u8 flag)
 Sets a flag in mProcControl.
void clearProcControlFlag (u8 flag)
 Clears a flag in mProcControl.
virtual void deleteReady ()
 Informs the base that it's about to be deleted.
virtual bool entryFrmHeap (unsigned long size, EGG::Heap *parentHeap)
 Creates a heap of the given size for the base.
virtual bool entryFrmHeapNonAdjust (unsigned long size, EGG::Heap *parentHeap)
 Creates a heap of the given size for the base.
virtual bool createHeap ()
 [Does nothing].
virtual ~fBase_c ()
 Destroys the base.
Protected Attributes inherited from dBase_c
const char * mpKindString
 The base's kind string.
const char * mpNameString
 The base's profile name string.
Protected Attributes inherited from fBase_c
u8 mLifecycleState
 The base's lifecycle state. Value is a LIFECYCLE_e.
bool mDeleteRequested
 If deletion of the base was requested, but the delete operation has not been scheduled yet.
bool mDeferExecute
 If the create operation was completed, but scheduling the execute and draw operations isn't possible at this time.
bool mDeferRetryCreate
 If the create operation has not been completed, and rescheduling it isn't possible at this time.
u8 mGroupType
 The base's group type. Value is a GROUP_TYPE_e.
u8 mProcControl
 The operations to be skipped. Value is a PROC_DISABLE_e.
fManager_c mMng
 The base's process manager.
fBaHelper_cmpUnusedHelper
 See Unused Content.
fLiMgBa_c mUnusedList
 See Unused Content.
EGG::FrmHeap * mHeap
 The base's dedicated heap.
Static Protected Attributes inherited from fBase_c
static int(* sLoadAsyncCallback )()
 See Unused Content.
static void(* sUnloadCallback )()
 See Unused Content.

Member Enumeration Documentation

◆ LAYOUT_e

The possible cursor slots.

Todo
Figure out the behaviour differences between slots and give each one a name.

Definition at line 18 of file d_SelectCursor.hpp.

◆ N_PANE_e

The null panes used in the layout.

Definition at line 29 of file d_SelectCursor.hpp.

◆ P_PANE_e

The picture panes used in the layout.

Definition at line 40 of file d_SelectCursor.hpp.

◆ ANIM_e

The animations used in the layout.

Definition at line 50 of file d_SelectCursor.hpp.

Constructor & Destructor Documentation

◆ dSelectCursor_c()

dSelectCursor_c::dSelectCursor_c ( )

Constructs a new base.

Definition at line 7 of file d_SelectCursor.cpp.

◆ ~dSelectCursor_c()

dSelectCursor_c::~dSelectCursor_c ( )
virtual

Destroys the base.

Definition at line 12 of file d_SelectCursor.cpp.

Member Function Documentation

◆ create()

int dSelectCursor_c::create ( )
virtual

do method for the create operation.

Returns
A PACK_RESULT_e value.

Reimplemented from fBase_c.

Definition at line 16 of file d_SelectCursor.cpp.

◆ doDelete()

int dSelectCursor_c::doDelete ( )
virtual

do method for the delete operation.

This method was renamed due to conflict with the delete C++ keyword.

Returns
A PACK_RESULT_e value.

Reimplemented from fBase_c.

Definition at line 103 of file d_SelectCursor.cpp.

◆ execute()

int dSelectCursor_c::execute ( )
virtual

do method for the execute operation.

Returns
A PACK_RESULT_e value.

Reimplemented from fBase_c.

Definition at line 81 of file d_SelectCursor.cpp.

◆ draw()

int dSelectCursor_c::draw ( )
virtual

do method for the draw operation.

Returns
A PACK_RESULT_e value.

Reimplemented from fBase_c.

Definition at line 93 of file d_SelectCursor.cpp.

◆ PosSet()

void dSelectCursor_c::PosSet ( int layoutId)

Updates the position of an attached cursor layout.

Parameters
layoutIdThe cursor slot index.

Definition at line 117 of file d_SelectCursor.cpp.

◆ Cancel()

void dSelectCursor_c::Cancel ( int layoutId)

Deactivates and hides the specified cursor layout.

Parameters
layoutIdThe cursor slot index.

Definition at line 183 of file d_SelectCursor.cpp.

◆ SetPane()

void dSelectCursor_c::SetPane ( const nw4r::lyt::Pane * pane,
int layoutId,
bool forceTopDrawOrder )

Attaches a cursor to the given pane.

Parameters
paneThe pane to attach the cursor to.
layoutIdThe cursor slot index.
forceTopDrawOrderIf true , sets this cursor's draw order to a higher priority value. If false , it restores the default draw order for all cursors.

Definition at line 191 of file d_SelectCursor.cpp.

◆ SetAlpha()

void dSelectCursor_c::SetAlpha ( const nw4r::lyt::Pane * pane,
int layoutId )

Sets the alpha of a cursor to match the given pane.

Parameters
paneThe source pane whose alpha value will be copied.
layoutIdThe cursor slot index.

Definition at line 228 of file d_SelectCursor.cpp.

Member Data Documentation

◆ mResLoader

d2d::ResAccMultLoader_c dSelectCursor_c::mResLoader

The resource loader for the layout.

Definition at line 108 of file d_SelectCursor.hpp.

◆ mLayouts

Layout_c dSelectCursor_c::mLayouts[LAYOUT_COUNT]

The cursor layout instances.

Definition at line 109 of file d_SelectCursor.hpp.

◆ mHasLoadedLayout

bool dSelectCursor_c::mHasLoadedLayout

Whether the layout has been loaded.

Definition at line 110 of file d_SelectCursor.hpp.

◆ m_instance

dSelectCursor_c * dSelectCursor_c::m_instance = nullptr
static

The static instance of the selection cursor manager.

Definition at line 112 of file d_SelectCursor.hpp.