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

#include <game/bases/d_lytbase.hpp>

Inheritance diagram for LytBase_c:
[legend]

Description

A 2D layout.

Definition at line 9 of file d_lytbase.hpp.

Public Member Functions

 LytBase_c ()
 Constructs a new layout.
virtual ~LytBase_c ()
 Destroys the layout.
virtual bool build (const char *name, d2d::ResAccMult_c *resAcc)
 Builds the layout from a binary layout file.
LytTextBox_cfindTextBox (const char *name)
 Finds a text box by name.
void allocStringBuffer (nw4r::lyt::Pane *pane)
 Recursively allocates string buffers for all text boxes in the layout.
bool ReadResourceEx (const char *name, int allocDirection, bool isLocalized)
 Reads an .arc file which contains the layout.
bool ReadResource (const char *name, bool isLocalized)
 Reads an .arc file which contains the layout.
bool ReadResource2 (const char *name, int allocDirection)
 Reads an .arc file which contains the layout.
bool ReadResource3 (const char *name, int allocDirection)
 Reads an .arc file which contains the layout.
void NPaneRegister (const char **paneNames, nw4r::lyt::Pane **panes, int count)
 Finds null panes by name and registers them to the list.
void WPaneRegister (const char **windowPaneNames, nw4r::lyt::Window **panes, int count)
 Finds windows by name and registers them to the list.
void PPaneRegister (const char **picPaneNames, nw4r::lyt::Picture **panes, int count)
 Finds picture panes by name and registers them to the list.
void TPaneRegister (const char **textboxNames, LytTextBox_c **panes, int count)
 Finds text boxes by name and registers them to the list.
void TPaneNameRegister (const char **textboxNames, const int *messageIDs, int messageGroup, int count)
 Finds text boxes by name, sets their messages, and registers them to the list.
void AnimeResRegister (const char **animeNames, int count)
 Loads animation resources given by their names.
void GroupRegister (const char **groupNames, const int *animeIdxs, int count)
 Registers animation groups to the layout.
void AnimeStartBaseSetup (int animeIdx)
 Base setup for starting an animation.
void AnimeStartSetup (int animeIdx, bool startAtEnd)
 Prepares an animation to be played.
void LoopAnimeStartSetup (int animeIdx)
 Prepares a looping animation to be played.
void ReverseAnimeStartSetup (int animeIdx, bool startAtEnd)
 Prepares a reverse animation to be played.
void AnimeEndSetup (int animeIdx)
 Prepares an animation to be stopped.
void AllAnimeEndSetup ()
 Prepares all animations to be stopped.
void AnimePlay ()
 Starts playing all enabled animations.
bool isAnime (int animeIdx)
 Returns whether the specified animation is currently playing.
bool isAllAnime ()
 Returns whether any animation is currently playing.
void SetScissorMask (const nw4r::lyt::Pane *pane, d2d::ScissorMask &scissorMask)
bool doDelete ()
 Cleans up all resources used by the layout.
m2d::AnmGroup_cgetAnmGroup (int index) const
Public Member Functions inherited from d2d::Multi_c
 Multi_c ()
 Creates a layout.
virtual ~Multi_c ()
 Destroys the layout.
virtual void draw ()
 Draws the layout.
virtual void calc ()
 Applies the view matrix.
void entry ()
 Registers the layout to be drawn.
void calcBefore ()
 Calculates an animation step before the main calculation.
void calcAfter ()
 Calculates the view rectangle and view matrix after the main calculation.
nw4r::lyt::Pane * getRootPane ()
 Gets the root pane of the layout.
nw4r::lyt::Pane * findPaneByName (const char *name)
 Finds a pane by name.
nw4r::lyt::TextBoxfindTextBoxByName (const char *name)
 Finds a text box pane by name.
nw4r::lyt::Picture * findPictureByName (const char *name)
 Finds a picture pane by name.
nw4r::lyt::Window * findWindowByName (const char *name)
 Finds a window pane by name.
Public Member Functions inherited from m2d::Base_c
void entry ()

Static Public Attributes

static TagProcessor_c s_TagPrc
 The tag processor for layouts.

Private Attributes

d2d::ResAccMultLoader_c mResAccessorLoader
 The resource loader used to load the layout's resources.
m2d::AnmResV2_cmpAnimRes
 The animations used by the layout.
m2d::AnmGroup_cmpAnimGroup
 The animation groups used by the layout.
bool * mpEnabledAnims
 A list of the enabled animations.
int mAnimCount
 The number of animations used by the layout.
int mAnimGroupCount
 The number of animation groups used by the layout.
int mLastStartedAnimNum
 The number of the most recently started animation.

Additional Inherited Members

Public Attributes inherited from d2d::Multi_c
ResAccMult_cmpResAccessor
 The resource accessor for the layout.
mVec2_c mPos
 The position of the layout.
ScissorMask mScissorMask
 The scissor mask for the layout.
Public Attributes inherited from m2d::Base_c
u8 mDrawOrder
Protected Attributes inherited from d2d::Multi_c
m2d::Layout_c mLayout
 The layout instance.
nw4r::lyt::DrawInfo mDrawInfo
 The parameters for drawing the layout.

Constructor & Destructor Documentation

◆ LytBase_c()

LytBase_c::LytBase_c ( )

Constructs a new layout.

Definition at line 11 of file d_lytbase.cpp.

◆ ~LytBase_c()

LytBase_c::~LytBase_c ( )
virtual

Destroys the layout.

Definition at line 13 of file d_lytbase.cpp.

Member Function Documentation

◆ build()

bool LytBase_c::build ( const char * name,
d2d::ResAccMult_c * resAcc )
virtual

Builds the layout from a binary layout file.

Parameters
nameThe name of the binary layout file.
resAccThe resource accessor to use. If nullptr, uses the internal accessor.
Returns
Whether the layout was built successfully.

Reimplemented from d2d::Multi_c.

Definition at line 15 of file d_lytbase.cpp.

◆ findTextBox()

LytTextBox_c * LytBase_c::findTextBox ( const char * name)

Finds a text box by name.

Definition at line 24 of file d_lytbase.cpp.

◆ allocStringBuffer()

void LytBase_c::allocStringBuffer ( nw4r::lyt::Pane * pane)

Recursively allocates string buffers for all text boxes in the layout.

Definition at line 28 of file d_lytbase.cpp.

◆ ReadResourceEx()

bool LytBase_c::ReadResourceEx ( const char * name,
int allocDirection,
bool isLocalized )

Reads an .arc file which contains the layout.

Parameters
nameThe name of the archive.
allocDirectionThe allocation direction.
isLocalizedWhether the layout is in a localized folder (/<Region>/<Language>/).

Definition at line 46 of file d_lytbase.cpp.

◆ ReadResource()

bool LytBase_c::ReadResource ( const char * name,
bool isLocalized )

Reads an .arc file which contains the layout.

Parameters
nameThe name of the archive.
isLocalizedWhether the layout is in a localized folder (/<Region>/<Language>/).

Definition at line 65 of file d_lytbase.cpp.

◆ ReadResource2()

bool LytBase_c::ReadResource2 ( const char * name,
int allocDirection )

Reads an .arc file which contains the layout.

Note
Use this function for layouts placed in /<Region>/Layout/.
Parameters
nameThe name of the archive.
allocDirectionThe allocation direction.

Definition at line 69 of file d_lytbase.cpp.

◆ ReadResource3()

bool LytBase_c::ReadResource3 ( const char * name,
int allocDirection )

Reads an .arc file which contains the layout.

Note
Use this function for layouts localized in Dutch (/EU/NedEU/Layout/).
Decompilation Note
Not in Shield version.
Parameters
nameThe name of the archive.
allocDirectionThe allocation direction.

Definition at line 83 of file d_lytbase.cpp.

◆ NPaneRegister()

void LytBase_c::NPaneRegister ( const char ** paneNames,
nw4r::lyt::Pane ** panes,
int count )

Finds null panes by name and registers them to the list.

Parameters
paneNamesThe names of the panes to find.
panesThe list to register the panes to.
countThe number of panes in paneNames.

Definition at line 96 of file d_lytbase.cpp.

◆ WPaneRegister()

void LytBase_c::WPaneRegister ( const char ** windowPaneNames,
nw4r::lyt::Window ** panes,
int count )

Finds windows by name and registers them to the list.

Parameters
windowPaneNamesThe names of the windows to find.
panesThe list to register the windows to.
countThe number of windows in windowPaneNames.

Definition at line 102 of file d_lytbase.cpp.

◆ PPaneRegister()

void LytBase_c::PPaneRegister ( const char ** picPaneNames,
nw4r::lyt::Picture ** panes,
int count )

Finds picture panes by name and registers them to the list.

Parameters
picPaneNamesThe names of the picture panes to find.
panesThe list to register the picture panes to.
countThe number of picture panes in picPaneNames.

Definition at line 108 of file d_lytbase.cpp.

◆ TPaneRegister()

void LytBase_c::TPaneRegister ( const char ** textboxNames,
LytTextBox_c ** panes,
int count )

Finds text boxes by name and registers them to the list.

Parameters
textboxNamesThe names of the text boxes to find.
panesThe list to register the text boxes to.
countThe number of text boxes in textboxNames.

Definition at line 114 of file d_lytbase.cpp.

◆ TPaneNameRegister()

void LytBase_c::TPaneNameRegister ( const char ** textboxNames,
const int * messageIDs,
int messageGroup,
int count )

Finds text boxes by name, sets their messages, and registers them to the list.

Parameters
textboxNamesThe names of the text boxes to find.
messageIDsThe message IDs of the messages to set for the text boxes.
messageGroupThe message group of the messages to set for the text boxes.
countThe number of text boxes in textboxNames.

Definition at line 120 of file d_lytbase.cpp.

◆ AnimeResRegister()

void LytBase_c::AnimeResRegister ( const char ** animeNames,
int count )

Loads animation resources given by their names.

Parameters
animeNamesThe names of the animation resources to load.
countThe number of animations in animeNames.

Definition at line 128 of file d_lytbase.cpp.

◆ GroupRegister()

void LytBase_c::GroupRegister ( const char ** groupNames,
const int * animeIdxs,
int count )

Registers animation groups to the layout.

Parameters
groupNamesThe names of the animation groups to register.
animeIdxsThe indices of the animations to use for the animation groups.
countThe number of animation groups in groupNames.

Definition at line 137 of file d_lytbase.cpp.

◆ AnimeStartBaseSetup()

void LytBase_c::AnimeStartBaseSetup ( int animeIdx)

Base setup for starting an animation.

Parameters
animeIdxThe index of the animation to start.

Definition at line 146 of file d_lytbase.cpp.

◆ AnimeStartSetup()

void LytBase_c::AnimeStartSetup ( int animeIdx,
bool startAtEnd )

Prepares an animation to be played.

Parameters
animeIdxThe index of the animation to start.
startAtEndWhether to skip to the end of the animation.

Definition at line 156 of file d_lytbase.cpp.

◆ LoopAnimeStartSetup()

void LytBase_c::LoopAnimeStartSetup ( int animeIdx)

Prepares a looping animation to be played.

Parameters
animeIdxThe index of the animation to start.

Definition at line 164 of file d_lytbase.cpp.

◆ ReverseAnimeStartSetup()

void LytBase_c::ReverseAnimeStartSetup ( int animeIdx,
bool startAtEnd )

Prepares a reverse animation to be played.

Parameters
animeIdxThe index of the animation to start.
startAtEndWhether to skip to the end of the animation.

Definition at line 169 of file d_lytbase.cpp.

◆ AnimeEndSetup()

void LytBase_c::AnimeEndSetup ( int animeIdx)

Prepares an animation to be stopped.

Parameters
animeIdxThe index of the animation to be stopped.

Definition at line 180 of file d_lytbase.cpp.

◆ AllAnimeEndSetup()

void LytBase_c::AllAnimeEndSetup ( )

Prepares all animations to be stopped.

Definition at line 187 of file d_lytbase.cpp.

◆ AnimePlay()

void LytBase_c::AnimePlay ( )

Starts playing all enabled animations.

Definition at line 194 of file d_lytbase.cpp.

◆ isAnime()

bool LytBase_c::isAnime ( int animeIdx)

Returns whether the specified animation is currently playing.

Parameters
animeIdxThe index of the animation to check.
Note
If animeIdx is negative, returns whether the most recently started animation is playing.

Definition at line 206 of file d_lytbase.cpp.

◆ isAllAnime()

bool LytBase_c::isAllAnime ( )

Returns whether any animation is currently playing.

Definition at line 213 of file d_lytbase.cpp.

◆ SetScissorMask()

void LytBase_c::SetScissorMask ( const nw4r::lyt::Pane * pane,
d2d::ScissorMask & scissorMask )

Definition at line 222 of file d_lytbase.cpp.

◆ doDelete()

bool LytBase_c::doDelete ( )

Cleans up all resources used by the layout.

Definition at line 276 of file d_lytbase.cpp.

◆ getAnmGroup()

m2d::AnmGroup_c & LytBase_c::getAnmGroup ( int index) const
inline

Definition at line 129 of file d_lytbase.hpp.

Member Data Documentation

◆ mResAccessorLoader

d2d::ResAccMultLoader_c LytBase_c::mResAccessorLoader
private

The resource loader used to load the layout's resources.

Definition at line 132 of file d_lytbase.hpp.

◆ mpAnimRes

m2d::AnmResV2_c* LytBase_c::mpAnimRes
private

The animations used by the layout.

Definition at line 134 of file d_lytbase.hpp.

◆ mpAnimGroup

m2d::AnmGroup_c* LytBase_c::mpAnimGroup
private

The animation groups used by the layout.

Definition at line 135 of file d_lytbase.hpp.

◆ mpEnabledAnims

bool* LytBase_c::mpEnabledAnims
private

A list of the enabled animations.

Definition at line 137 of file d_lytbase.hpp.

◆ mAnimCount

int LytBase_c::mAnimCount
private

The number of animations used by the layout.

Definition at line 138 of file d_lytbase.hpp.

◆ mAnimGroupCount

int LytBase_c::mAnimGroupCount
private

The number of animation groups used by the layout.

Definition at line 139 of file d_lytbase.hpp.

◆ mLastStartedAnimNum

int LytBase_c::mLastStartedAnimNum
private

The number of the most recently started animation.

Definition at line 141 of file d_lytbase.hpp.

◆ s_TagPrc

TagProcessor_c LytBase_c::s_TagPrc
static

The tag processor for layouts.

Definition at line 144 of file d_lytbase.hpp.