resonance 1.0.1
Loading...
Searching...
No Matches
Rnd::Button Class Reference

Selectable widget, as one mesh and one text run plus a palette for each. More...

#include <button.h>

Inheritance diagram for Rnd::Button:
Collaboration diagram for Rnd::Button:

Public Member Functions

 Button (const HxStr &name)
 Construct a button with no targets and one empty palette entry each.
virtual ~Button ()
 Drop this object's reference on both targets and on every palette entry.
virtual void DumpText (Dbg &sink)
 Write a description of this button to sink.
virtual void Save (Stream &stream)
 Write this button to stream at revision 0.
virtual void Replace (Object *pFrom, Object *pTo)
 Retarget both targets and every palette entry that refers to the replaced object.
virtual const HxStr & ClassName () const
 Report the class key a .rnd file writes for a button.
virtual void Copy (const Object *pSource, unsigned nFlags)
 Copy the state and both palettes of pSource into this button.
virtual void Load (Stream &stream)
 Read this button from stream.
void SetShowing (int nShowing)
 Show or hide both targets.
void SetMesh (Mesh *pMesh)
 Replace mMesh, moving this object's reference to the new mesh.
void SetText (Text *pText)
 Replace mText, moving this object's reference to the new text.
void SetMat (int nState, Mat *pMat)
 Replace one entry of mMats, moving this object's reference to the new material.
void SetFont (int nState, Font *pFont)
 Replace one entry of mFonts, moving this object's reference to the new font.
void SetState (int nState)
 Select one of mMats and one of mFonts.
Public Member Functions inherited from Rnd::Object
 Object ()
 Construct an unnamed object.
 Object (const HxStr &name)
 Construct an object and register it under name.
virtual ~Object ()
 Erase the registry entry and release the name buffer.
void SetName (const HxStr &name)
 Re-register this object under a different name.
void AddRef (Object *pReferrer)
 Register pReferrer as a store of a pointer to this object.
void RemoveRef (Object *pReferrer)
 Drop one registration made by AddRef().

Static Public Member Functions

static void * operator new (size_t nSize)
 Allocate a button under the tag "Rnd::Button".
static void operator delete (void *pBlock)
 Release a button block under the same tag.

Public Attributes

int mState
 The palette entry SetState() last selected.
Text * mText
 Label drawn over mMesh.
std::vector< Mat * > mMats
 Materials the state selects among, for mMesh.
std::vector< Font * > mFonts
 Fonts the state selects among, for mText.
Public Attributes inherited from Rnd::Object
HxStr mName
int mInternal

Additional Inherited Members

Protected Member Functions inherited from Rnd::Object
void ReleaseAllRefs ()
 Tell every referrer to drop its pointer to this object.
Protected Attributes inherited from Rnd::Object
std::list< Object * > mRefs

Detailed Description

Selectable widget, as one mesh and one text run plus a palette for each.

Its RTTI descriptor is at 0x008efde0. It has Rnd::Object as its only public non-virtual base at offset 0. The factory at 0x005346f8 pins the class at 0x40 bytes by requesting exactly that many. The Rnd::Object vptr therefore sits at +0x18 and this class's members run from +0x1c to +0x3f with no padding. The eight-entry vtable at 0x008282d8 is the Rnd::Object set exactly, and the class does not declare a virtual.

The member titles come from the text DumpText() writes, "state: ", " mesh: ", " text: ", "mats: ", and "fonts: ".

What the state selects is not implemented here. SetState() records the index and SetShowing() forwards to both targets, and the class draws nothing and updates nothing, so the two palettes and the index are a record the front end reads. Over two hundred call sites across the metagame and the front-end screens narrow an object to this class, and few of those translation units are reconstructed yet, so which palette entry a given state applies to which of the two targets is recovered nowhere in this tree.

Constructor & Destructor Documentation

◆ Button()

Rnd::Button::Button ( const HxStr & name)
explicit

Construct a button with no targets and one empty palette entry each.

Both palettes start with a single null entry rather than empty, which the constructor produces by requesting four bytes and then inserting one null.

Parameters
nameThe registry key for this object.
Ghidra address:
NTSC-U/C: 0x00530eb8
Ghidra address:
PAL: 0x005706b0

◆ ~Button()

virtual Rnd::Button::~Button ( )
virtual

Drop this object's reference on both targets and on every palette entry.

Ghidra address:
NTSC-U/C: 0x00530cd0
Ghidra address:
PAL: 0x005704c8

Member Function Documentation

◆ operator new()

void * Rnd::Button::operator new ( size_t nSize)
static

Allocate a button under the tag "Rnd::Button".

Parameters
nSizeThe object size the compiler supplies.
Returns
The block.
Ghidra address:
NTSC-U/C: 0x005344b8
Ghidra address:
PAL: 0x00573d38

◆ operator delete()

void Rnd::Button::operator delete ( void * pBlock)
static

Release a button block under the same tag.

Parameters
pBlockThe block.
Ghidra address:
NTSC-U/C: 0x005344d8
Ghidra address:
PAL: 0x00573d58

◆ DumpText()

virtual void Rnd::Button::DumpText ( Dbg & sink)
virtual

Write a description of this button to sink.

Parameters
sinkThe diagnostic sink to write to.
Ghidra address:
NTSC-U/C: 0x005304f0
Ghidra address:
PAL: 0x0056fc98

Reimplemented from Rnd::Object.

◆ Save()

virtual void Rnd::Button::Save ( Stream & stream)
virtual

Write this button to stream at revision 0.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x00530690
Ghidra address:
PAL: 0x0056fe38

Implements Rnd::Object.

◆ Replace()

virtual void Rnd::Button::Replace ( Object * pFrom,
Object * pTo )
virtual

Retarget both targets and every palette entry that refers to the replaced object.

A palette entry whose replacement is null is still overwritten with that null, and the whole of each palette is walked rather than stopping at the first match.

Parameters
pFromThe object being replaced.
pToThe replacement, or null.
Ghidra address:
NTSC-U/C: 0x00530a20
Ghidra address:
PAL: 0x00570218

Implements Rnd::Object.

◆ ClassName()

virtual const HxStr & Rnd::Button::ClassName ( ) const
virtual

Report the class key a .rnd file writes for a button.

The returned string is the global at 0x0071d8f8, which the class registration fills with "Button".

Returns
The class key.
Ghidra address:
NTSC-U/C: 0x00534620
Ghidra address:
PAL: 0x00573ea0

Implements Rnd::Object.

◆ Copy()

virtual void Rnd::Button::Copy ( const Object * pSource,
unsigned nFlags )
virtual

Copy the state and both palettes of pSource into this button.

Neither target is copied; both are cleared instead. nFlags is not read, and no base implementation is invoked. A pSource that is not a Button is dereferenced through the null the cast produces rather than rejected.

Parameters
pSourceThe button to copy from.
nFlagsUnread.
Ghidra address:
NTSC-U/C: 0x00534780
Ghidra address:
PAL: 0x00574000

Implements Rnd::Object.

◆ Load()

virtual void Rnd::Button::Load ( Stream & stream)
virtual

Read this button from stream.

A revision above 0 produces the report "Can't load new Button" and then returns, leaving the object as it was. Unlike the other renderer classes, this one does not transfer control to the abort handler of Rnd::TheDbg afterwards.

Parameters
streamThe stream to read from.
Ghidra address:
NTSC-U/C: 0x005307f8
Ghidra address:
PAL: 0x0056ffa0

Implements Rnd::Object.

◆ SetShowing()

void Rnd::Button::SetShowing ( int nShowing)

Show or hide both targets.

The argument goes to slot 1 of the Rnd::Drawable table of mMesh and then of mText, and a null target is passed over. The class declares no virtual of its own, so the member is an ordinary method rather than an override.

Parameters
nShowingWhether the button draws.
Ghidra address:
NTSC-U/C: 0x005349e0
Ghidra address:
PAL: 0x00574260

◆ SetMesh()

void Rnd::Button::SetMesh ( Mesh * pMesh)

Replace mMesh, moving this object's reference to the new mesh.

The new mesh also takes the material mState selects. The routine has no caller in the shipped build.

Parameters
pMeshThe new mesh, or null.
Ghidra address:
NTSC-U/C: 0x00534ad0
Ghidra address:
PAL: 0x00574350

◆ SetText()

void Rnd::Button::SetText ( Text * pText)

Replace mText, moving this object's reference to the new text.

The new text also takes the font mState selects. The routine has no caller in the shipped build. The name is inferred from SetMesh().

Parameters
pTextThe new text, or null.
Ghidra address:
NTSC-U/C: 0x00534b48
Ghidra address:
PAL: 0x005743c8

◆ SetMat()

void Rnd::Button::SetMat ( int nState,
Mat * pMat )

Replace one entry of mMats, moving this object's reference to the new material.

When nState is the current state, mMesh takes the new material at once. The index is not checked against the palette size. The name is inferred.

Parameters
nStateThe palette entry.
pMatThe new material, or null.
Ghidra address:
NTSC-U/C: 0x00534bd0
Ghidra address:
PAL: 0x00574450

◆ SetFont()

void Rnd::Button::SetFont ( int nState,
Font * pFont )

Replace one entry of mFonts, moving this object's reference to the new font.

When nState is the current state, mText takes the new font at once. The index is not checked against the palette size. The name is inferred.

Parameters
nStateThe palette entry.
pFontThe new font, or null.
Ghidra address:
NTSC-U/C: 0x00534c78
Ghidra address:
PAL: 0x005744f8

◆ SetState()

void Rnd::Button::SetState ( int nState)

Select one of mMats and one of mFonts.

Parameters
nStateThe state index. MetButtonList passes over an entry whose state is 3, which is how a disabled button is skipped.
Ghidra address:
NTSC-U/C: 0x00534a48
Ghidra address:
PAL: 0x005742c8

Member Data Documentation

◆ mState

int Rnd::Button::mState

The palette entry SetState() last selected.

Public rather than private, because MetButtonList::SelectPrevious() at 0x001fcc40 and MetButtonList::SelectNext() at 0x001fcd10 read it directly to pass over a disabled button, and the image has no accessor to route that read through. +0x1c

◆ mText

Text* Rnd::Button::mText

Label drawn over mMesh.

Public rather than private, because MetButtonList::Add() and MetLoadFreqBaseScreen::UpdateNameLabel() both set the label text through a plain load at +0x24 and the image has no accessor to route either read through. A friend declaration fits the image equally well. +0x24

◆ mMats

std::vector<Mat *> Rnd::Button::mMats

Materials the state selects among, for mMesh.

The assignment operator this class uses is instantiated out of line at 0x00533260. Public rather than private, because MetArenasScreen::ResolveContainerViews() at 0x001f6a08 reads its elements directly. +0x28

◆ mFonts

std::vector<Font *> Rnd::Button::mFonts

Fonts the state selects among, for mText.

Three of its operations are instantiated out of line, the assignment operator at 0x00533488, the grow-and-fill that insert() and resize() share at 0x00533f88, and the uninitialised fill that grow-and-fill calls at 0x00534fd0. Public rather than private, because MetArenasScreen::ResolveContainerViews() at 0x001f6a08 reads its elements directly. +0x34


The documentation for this class was generated from the following file: