wavelength 1.0.0
Loading...
Searching...
No Matches
RndCollideable Class Reference

Mix-in for an object that can be hit-tested, and that tests a list of other collideables. More...

#include <rndcollideable.h>

Inheritance diagram for RndCollideable:
Collaboration diagram for RndCollideable:

Classes

struct  Collision
 One recorded intersection. More...

Public Member Functions

 RndCollideable ()
 Construct a collideable without children.
 ~RndCollideable () override
 Drop the references on the children.
virtual void Collide (const Segment &segment, std::list< Collision > &collisions)
 Test a segment against the collideable and add what it strikes to a list.
virtual void Collide (const Vector2 &point, std::list< Collision > &collisions)
 Test a screen point against the collideable and add what it strikes to a list.
void DumpText (PrnStream &stream) override
 Write a description of the collideable.
void Save (BinStream &stream) override
 Write the names of the children.
void Replace (RndObject *pFrom, RndObject *pTo) override
 Replace a child with another object.
void Copy (const RndObject *pSource, int nFlags) override
 Copy the children when the flags request them.
void Load (BinStream &stream) override
 Read what Save() wrote.
RndCollideable * Parent ()
 Find the collideable whose children include this one.
bool AddCollide (RndCollideable *pCollide)
 Append a child.
void RemoveCollide (RndCollideable *pCollide)
 Remove a child.
Public Member Functions inherited from RndObject
 RndObject (const char *pszName)
 Construct an object and register it under a name.
virtual ~RndObject ()
 Notify every referrer, then erase the registration.
virtual const char * ClassName () const =0
 Report the name of the object's most derived class.
void SetName (const char *pszName)
 Register the object under a different name.
void AddRef (RndObject *pReferrer)
 Register an object as a store of a pointer to this one.
void RemoveRef (RndObject *pReferrer)
 Drop the first registration AddRef() made for a referrer.
const char * GetName () const
const std::list< RndObject * > & GetRefs () const
int GetInternal () const
void SetInternal (int nInternal)

Static Public Member Functions

static void CollectChildren (std::list< RndObject * > &objects, RndCollideable *pCollideable)
 Append every collision descendant of a collideable, depth first, each before its descendants.

Static Public Attributes

static int sRev
 The format version Save() writes and Load() accepts.
Static Public Attributes inherited from RndObject
static constexpr int kCopyChildLists = 0x200
 The bit of the Copy() flags that copies the child lists of the mix-ins.

Protected Member Functions

void ReleaseCollideRefs ()
 Drop the reference on every child without emptying the list.
void AcquireCollideRefs ()
 Take a reference on every child.

Additional Inherited Members

Protected Attributes inherited from RndObject
std::list< RndObject * > mRefs
String mName

Detailed Description

Mix-in for an object that can be hit-tested, and that tests a list of other collideables.

The RTTI includes the class name and records RndObject as a virtual base. Every entry of mCollides registers this object as a referrer through RndObject::AddRef().

Constructor & Destructor Documentation

◆ RndCollideable()

RndCollideable::RndCollideable ( )
inline

Construct a collideable without children.

The constructor has no out-of-line copy.

◆ ~RndCollideable()

RndCollideable::~RndCollideable ( )
override

Drop the references on the children.

Ghidra address:
NTSC-U/C: 0x0037fb80
Ghidra address:
PAL: 0x003ee298

Member Function Documentation

◆ Collide() [1/2]

virtual void RndCollideable::Collide ( const Segment & segment,
std::list< Collision > & collisions )
virtual

Test a segment against the collideable and add what it strikes to a list.

The base body tests the children.

Parameters
segmentThe segment.
collisionsThe list to add to.
Ghidra address:
NTSC-U/C: 0x002224c8
Ghidra address:
PAL: 0x0022b298

Reimplemented in RndArena, RndCam, RndLine, RndMesh, and RndText.

◆ Collide() [2/2]

virtual void RndCollideable::Collide ( const Vector2 & point,
std::list< Collision > & collisions )
virtual

Test a screen point against the collideable and add what it strikes to a list.

The base body tests the children.

Parameters
pointThe screen point.
collisionsThe list to add to.
Ghidra address:
NTSC-U/C: 0x00222568
Ghidra address:
PAL: 0x0022b338

Reimplemented in RndArena, RndCam, RndLine, RndMesh, and RndText.

◆ DumpText()

void RndCollideable::DumpText ( PrnStream & stream)
overridevirtual

Write a description of the collideable.

Nothing is written unless the dump level of the stream is above 0.

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

Reimplemented from RndObject.

Reimplemented in RndLine, RndMesh, RndText, and RndView.

◆ Save()

void RndCollideable::Save ( BinStream & stream)
overridevirtual

Write the names of the children.

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

Implements RndObject.

Reimplemented in RndLine, RndMesh, RndText, and RndView.

◆ Replace()

void RndCollideable::Replace ( RndObject * pFrom,
RndObject * pTo )
overridevirtual

Replace a child with another object.

A replacement that is not a collideable, or null, removes the child.

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

Implements RndObject.

Reimplemented in RndLine, RndMesh, RndText, and RndView.

◆ Copy()

void RndCollideable::Copy ( const RndObject * pSource,
int nFlags )
overridevirtual

Copy the children when the flags request them.

Parameters
pSourceThe collideable to copy from.
nFlagsThe set of fields to copy. RndObject::kCopyChildLists copies the children.
Ghidra address:
NTSC-U/C: 0x00222430
Ghidra address:
PAL: 0x0022b200

Implements RndObject.

Reimplemented in RndLine, RndMesh, RndText, and RndView.

◆ Load()

void RndCollideable::Load ( BinStream & stream)
overridevirtual

Read what Save() wrote.

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

Implements RndObject.

Reimplemented in RndLine, RndMesh, RndText, and RndView.

◆ Parent()

RndCollideable * RndCollideable::Parent ( )

Find the collideable whose children include this one.

Returns
The parent, or null.
Ghidra address:
NTSC-U/C: 0x00221f58
Ghidra address:
PAL: 0x0022ad28

◆ AddCollide()

bool RndCollideable::AddCollide ( RndCollideable * pCollide)

Append a child.

A collideable already among the children is not added again.

Parameters
pCollideThe new child.
Returns
Whether the child was added.
Ghidra address:
NTSC-U/C: 0x00222608
Ghidra address:
PAL: 0x0022b3d8

◆ RemoveCollide()

void RndCollideable::RemoveCollide ( RndCollideable * pCollide)

Remove a child.

Parameters
pCollideThe child.
Ghidra address:
NTSC-U/C: 0x00222700
Ghidra address:
PAL: 0x0022b4d0

◆ CollectChildren()

void RndCollideable::CollectChildren ( std::list< RndObject * > & objects,
RndCollideable * pCollideable )
inlinestatic

Append every collision descendant of a collideable, depth first, each before its descendants.

Each unit that uses the inline routine emits a copy. The first address is the copy of RndManager, and the second the copy of UIList.

Parameters
objectsThe list to append to.
pCollideableThe collideable to start from, or null.
Ghidra address:
NTSC-U/C: 0x00237fb0
Ghidra address:
PAL: 0x00240b30
Ghidra address:
NTSC-U/C: 0x00205530
Ghidra address:
PAL: 0x0020e2e8

◆ ReleaseCollideRefs()

void RndCollideable::ReleaseCollideRefs ( )
protected

Drop the reference on every child without emptying the list.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x002222a0
Ghidra address:
PAL: 0x0022b070

◆ AcquireCollideRefs()

void RndCollideable::AcquireCollideRefs ( )
protected

Take a reference on every child.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00222328
Ghidra address:
PAL: 0x0022b0f8

Member Data Documentation

◆ sRev

int RndCollideable::sRev
static

The format version Save() writes and Load() accepts.

Ghidra address:
NTSC-U/C: 0x003b0998
Ghidra address:
PAL: 0x0042f830

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