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

Mix-in for an object that draws itself and then a list of other drawables. More...

#include <drawable.h>

Inheritance diagram for Rnd::Drawable:
Collaboration diagram for Rnd::Drawable:

Public Member Functions

 Drawable ()
 Construct a visible drawable with no children.
virtual ~Drawable ()
 Drop this object's references on its children.
void Draw ()
 Draw this object followed by each of its children.
Drawable * Parent ()
 Report the drawable that draws this one.
void AddDraw (Drawable *pDraw, Drawable *pBefore)
 Insert pDraw into mDraws in front of pBefore.
void AddDraw (Drawable *pDraw)
 Insert pDraw at the front of mDraws.
void RemoveDraw (Drawable *pDraw)
 Erase pDraw from mDraws.
void RemoveAllDraws ()
 Empty mDraws, dropping this object's reference on every entry.
void MoveDraw (Drawable *pDraw, int nSteps)
 Move pDraw nSteps places later in mDraws, or earlier for a negative count.
virtual void SetShowing (int nShowing)
 Set whether this object draws at all.
void SetShowingRecursive (int nShowing)
 Set whether this object and every drawable beneath it in mDraws draw at all.
virtual void SetHighlight (int nHighlight)
 Set whether this object draws with its highlight treatment.
int GetHighlight () const
 Report the highlight flag.
int GetShowing () const
 Report the showing flag.
std::list< Drawable * > & GetDraws ()
 Report the child list.
virtual void DumpText (Dbg &sink)
 Write a description of this object to sink.
virtual void Save (Stream &stream)
 Write the revision, the showing flag as one byte, and the draw list.
virtual void Replace (Object *pFrom, Object *pTo)
 Point every mDraws entry that is pFrom at pTo instead, moving the reference, and drop the entries left null.
virtual void Copy (const Object *pSource, unsigned nFlags)
 Take the showing flag, and with kCopyChildLists the draw list, from another drawable.
virtual void Load (Stream &stream)
 Read what Save() writes, replacing the draw list and moving its references.
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().
virtual const HxStr & ClassName () const =0
 Report the name of this object's most derived class.

Static Public Member Functions

static Drawable * Find (const HxStr &name)
 Resolve a registry key to a drawable.

Public Attributes

int mShowing
Public Attributes inherited from Rnd::Object
HxStr mName
int mInternal

Protected Member Functions

virtual int DrawShowing ()
 Draw this object alone.
void ReleaseDrawsRefs ()
 Drop this object's reference on every mDraws entry without emptying the list.
Protected Member Functions inherited from Rnd::Object
void ReleaseAllRefs ()
 Tell every referrer to drop its pointer to this object.

Additional Inherited Members

Protected Attributes inherited from Rnd::Object
std::list< Object * > mRefs

Detailed Description

Mix-in for an object that draws itself and then a list of other drawables.

Its RTTI descriptor is at 0x008ef320. It has Rnd::Object as a public virtual base at offset

  1. The subobject is 0x14 bytes. The compiler places the virtual-base pointer at +0x00 and, following the g++ 2.x layout for a class with no non-virtual base, the vptr at +0x10. The declared members therefore occupy +0x04 through +0x0f. For a standalone Drawable the Rnd::Object subobject sits at +0x14.

Two vtables belong to the class. The four-entry table at 0x00825498 is addressed by the vptr at +0x10 and stores the three virtuals declared here. The nine-entry table at 0x008254c0 is addressed by the Rnd::Object subobject vptr and stores the overrides of the Rnd::Object virtuals, each with a -0x14 adjustment back to the Drawable subobject.

Every entry of mDraws registers this object as a referrer through Rnd::Object::AddRef(), so a drawable that goes away is removed from its parents' lists by Replace() rather than leaving a stale pointer.

Constructor & Destructor Documentation

◆ Drawable()

Rnd::Drawable::Drawable ( )

Construct a visible drawable with no children.

Ghidra address:
NTSC-U/C: 0x005066f8
Ghidra address:
PAL: 0x005455b8

◆ ~Drawable()

virtual Rnd::Drawable::~Drawable ( )
virtual

Drop this object's references on its children.

Ghidra address:
NTSC-U/C: 0x00506590
Ghidra address:
PAL: 0x00545450

Member Function Documentation

◆ Draw()

void Rnd::Drawable::Draw ( )

Draw this object followed by each of its children.

Draws nothing when mShowing is clear, and skips the children when DrawShowing() reports that the subtree is invisible.

Ghidra address:
NTSC-U/C: 0x00506920
Ghidra address:
PAL: 0x005457e8

◆ Parent()

Drawable * Rnd::Drawable::Parent ( )

Report the drawable that draws this one.

Walks the referrer list of the Rnd::Object subobject, casts each referrer to Drawable and returns the first whose own mDraws list includes this object, which makes the result the parent in the draw hierarchy rather than a plain cast.

Returns
The parent drawable, or null when no referrer draws this one.
Ghidra address:
NTSC-U/C: 0x00502d78
Ghidra address:
PAL: 0x00541ba0

◆ AddDraw() [1/2]

void Rnd::Drawable::AddDraw ( Drawable * pDraw,
Drawable * pBefore )

Insert pDraw into mDraws in front of pBefore.

Registers this object as a referrer of pDraw. A pBefore that is absent from mDraws appends instead. A pDraw already in mDraws produces the report "%s already in %s" and no insertion.

Parameters
pDrawThe drawable to add.
pBeforeThe drawable to insert in front of.
Ghidra address:
NTSC-U/C: 0x00503188
Ghidra address:
PAL: 0x00541fb0

◆ AddDraw() [2/2]

void Rnd::Drawable::AddDraw ( Drawable * pDraw)

Insert pDraw at the front of mDraws.

Parameters
pDrawThe drawable to add.
Ghidra address:
NTSC-U/C: 0x005064e0
Ghidra address:
PAL: 0x005453a0

◆ RemoveDraw()

void Rnd::Drawable::RemoveDraw ( Drawable * pDraw)

Erase pDraw from mDraws.

Drops this object's reference on pDraw first. A pDraw absent from mDraws does nothing.

Parameters
pDrawThe drawable to remove.
Ghidra address:
NTSC-U/C: 0x00503360
Ghidra address:
PAL: 0x00542188

◆ RemoveAllDraws()

void Rnd::Drawable::RemoveAllDraws ( )

Empty mDraws, dropping this object's reference on every entry.

Ghidra address:
NTSC-U/C: 0x00503420
Ghidra address:
PAL: 0x00542248

◆ MoveDraw()

void Rnd::Drawable::MoveDraw ( Drawable * pDraw,
int nSteps )

Move pDraw nSteps places later in mDraws, or earlier for a negative count.

The move stops at either end of the list, and a pDraw absent from mDraws does nothing. No reference changes hands. FreqAppearanceDetail reorders the parts of an avatar with it. The title is inferred.

Parameters
pDrawThe drawable to move.
nStepsThe number of places to move it.
Ghidra address:
NTSC-U/C: 0x005034b8
Ghidra address:
PAL: 0x005422e0

◆ SetShowing()

virtual void Rnd::Drawable::SetShowing ( int nShowing)
virtual

Set whether this object draws at all.

Drawable vtable slot 1.

Parameters
nShowingNon-zero to draw.
Ghidra address:
NTSC-U/C: 0x005066d8
Ghidra address:
PAL: 0x00545598

Reimplemented in Rnd::Text.

◆ SetShowingRecursive()

void Rnd::Drawable::SetShowingRecursive ( int nShowing)
inline

Set whether this object and every drawable beneath it in mDraws draw at all.

Runs SetShowing() on this object and then recurses over mDraws. Defined in the header. The one out-of-line copy is emitted in FreqAppearance's translation unit, where FreqAppearance::AttachToBurnSlot() expands the first level of the recursion.

Parameters
nShowingNon-zero to draw.
Ghidra address:
NTSC-U/C: 0x00174480
Ghidra address:
PAL: 0x00176e58

◆ SetHighlight()

virtual void Rnd::Drawable::SetHighlight ( int nHighlight)
virtual

Set whether this object draws with its highlight treatment.

Drawable vtable slot 2.

Parameters
nHighlightNon-zero to highlight.
Ghidra address:
NTSC-U/C: 0x00506c88
Ghidra address:
PAL: 0x00545b50

Reimplemented in Rnd::String, and Rnd::Text.

◆ GetHighlight()

int Rnd::Drawable::GetHighlight ( ) const
inline

Report the highlight flag.

Returns
Non-zero when this object draws with its highlight treatment.
Ghidra address:
NTSC-U/C: 0x005066e0
Ghidra address:
PAL: 0x005455a0

◆ GetShowing()

int Rnd::Drawable::GetShowing ( ) const
inline

Report the showing flag.

The out-of-line copy has no callers. Rnd::LodMesh::Draw() inlines it.

Returns
Non-zero when this object draws at all.
Ghidra address:
NTSC-U/C: 0x00506520
Ghidra address:
PAL: 0x005453e0

◆ Find()

Drawable * Rnd::Drawable::Find ( const HxStr & name)
static

Resolve a registry key to a drawable.

A key that resolves to an object of another class produces null. The image has no caller.

Parameters
nameThe registry key to resolve.
Returns
The drawable, or null.
Ghidra address:
NTSC-U/C: 0x00506528
Ghidra address:
PAL: 0x005453e8

◆ GetDraws()

std::list< Drawable * > & Rnd::Drawable::GetDraws ( )
inline

Report the child list.

Returns
The list of drawables this object draws after itself.
Ghidra address:
NTSC-U/C: 0x005066e8
Ghidra address:
PAL: 0x005455a8

◆ DumpText()

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

Write a description of this object to sink.

Writes mShowing, mHighlight, and the mDraws list, and produces nothing at all when the dump level of sink is not positive. Dbg::Print() discards its text in the shipped build. The routine therefore produces no output on this target either way.

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

Reimplemented from Rnd::Object.

Reimplemented in Rnd::Arena, Rnd::Blur, Rnd::Cam, Rnd::Environ, Rnd::Generator, Rnd::Mesh, Rnd::MultiMesh, Rnd::ParticleSys, Rnd::String, Rnd::Text, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.

◆ Save()

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

Write the revision, the showing flag as one byte, and the draw list.

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

Implements Rnd::Object.

Reimplemented in Rnd::Arena, Rnd::Blur, Rnd::Cam, Rnd::Environ, Rnd::Generator, Rnd::Mesh, Rnd::MultiMesh, Rnd::ParticleSys, Rnd::String, Rnd::Text, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.

◆ Replace()

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

Point every mDraws entry that is pFrom at pTo instead, moving the reference, and drop the entries left null.

An entry already equal to pTo is reported through the debug sink.

Parameters
pFromThe object to replace.
pToThe replacement, which only counts when it is a Drawable.
Ghidra address:
NTSC-U/C: 0x00502e40
Ghidra address:
PAL: 0x00541c68

Implements Rnd::Object.

Reimplemented in Rnd::Arena, Rnd::Blur, Rnd::Cam, Rnd::Environ, Rnd::Generator, Rnd::Mesh, Rnd::MultiMesh, Rnd::ParticleSys, Rnd::String, Rnd::Text, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.

◆ Copy()

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

Take the showing flag, and with kCopyChildLists the draw list, from another drawable.

The references on the old and new draw lists are released and taken around the copy.

Parameters
pSourceThe drawable to copy from.
nFlagsThe copy flags.
Ghidra address:
NTSC-U/C: 0x00506a88
Ghidra address:
PAL: 0x00545950

Implements Rnd::Object.

Reimplemented in Rnd::Arena, Rnd::Blur, Rnd::Cam, Rnd::Environ, Rnd::Generator, Rnd::Mesh, Rnd::MultiMesh, Rnd::ParticleSys, Rnd::String, Rnd::Text, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.

◆ Load()

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

Read what Save() writes, replacing the draw list and moving its references.

A revision newer than this build supports is reported and aborts the load.

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

Implements Rnd::Object.

Reimplemented in Rnd::Arena, Rnd::Blur, Rnd::Cam, Rnd::Environ, Rnd::Generator, Rnd::Mesh, Rnd::MultiMesh, Rnd::ParticleSys, Rnd::String, Rnd::Text, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.

◆ DrawShowing()

virtual int Rnd::Drawable::DrawShowing ( )
protectedvirtual

Draw this object alone.

Drawable vtable slot 3. The base implementation draws nothing and reports that the children are still to be drawn. Only Draw() invokes it.

Returns
Non-zero when the children are to be drawn as well.
Ghidra address:
NTSC-U/C: 0x005066f0
Ghidra address:
PAL: 0x005455b0

Reimplemented in Rnd::Arena, Rnd::Blur, Rnd::Cam, Rnd::Environ, Rnd::Generator, Rnd::MultiMesh, Rnd::PsCam, Rnd::PsEnviron, Rnd::PsMesh, Rnd::PsMultiMesh, Rnd::PsParticleSys, Rnd::String, Rnd::Text, and Rnd::Tunnel.

◆ ReleaseDrawsRefs()

void Rnd::Drawable::ReleaseDrawsRefs ( )
protected

Drop this object's reference on every mDraws entry without emptying the list.

Every derived destructor invokes this before its own teardown.

Ghidra address:
NTSC-U/C: 0x00506ba8
Ghidra address:
PAL: 0x00545a70

Member Data Documentation

◆ mShowing

int Rnd::Drawable::mShowing

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