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

Motion trail that redraws one drawable at the transforms it recently occupied. More...

#include <blur.h>

Inheritance diagram for Rnd::Blur:
Collaboration diagram for Rnd::Blur:

Classes

struct  Xfm
 One recorded transform. More...

Public Member Functions

 Blur (const HxStr &name)
 Construct a trail with no subject.
virtual ~Blur ()
void SetMesh (Mesh *pMesh)
 Set the mesh the trail is drawn from and discard the recorded transforms.
void SetText (Text *pText)
 Set the text the trail is drawn from and discard the recorded transforms.
void SetLength (int nLength)
 Set how many transforms the trail records and discard the recorded transforms.
void SetRate (int nRate)
 Set how many frames pass between two recorded transforms and discard the recorded ones.
void SetFalloff (float flFalloff)
 Set the fraction of the subject's alpha the oldest trail step is drawn with.
Mesh * GetMesh () const
 Report the mesh the trail is drawn from.
Text * GetText () const
 Report the text the trail is drawn from.
int GetLength () const
 Report how many transforms the trail records.
int GetRate () const
 Report how many frames pass between two recorded transforms.
float GetFalloff () const
 Report the alpha fraction of the oldest trail step.
virtual void DumpText (Dbg &sink)
 Write a description of this trail to sink.
virtual void Save (Stream &stream)
 Write this trail's serialised form to stream.
virtual void Replace (Object *pFrom, Object *pTo)
 Repoint a subject when the object it addressed is replaced.
virtual const HxStr & ClassName () const
 Report the class key a .rnd file writes for a trail.
virtual void Copy (const Object *pSource, unsigned nFlags)
 Copy the state of pSource into this trail.
virtual void Load (Stream &stream)
 Read this trail's serialised form from stream.
Public Member Functions inherited from Rnd::Drawable
 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.
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 Blur * NewBlur (const HxStr &name)
 Build a trail the class registry vends.
static Blur * NewFromHook (const HxStr &name)
 Build a trail through g_pfnNewBlur.
static Blur * Find (const HxStr &name)
 Resolve a registry key to a trail.
static void Init ()
 Install the trail factory and register the class key with Rnd::TheManager.
Static Public Member Functions inherited from Rnd::Drawable
static Drawable * Find (const HxStr &name)
 Resolve a registry key to a drawable.

Public Attributes

std::list< Xfm > mXfms
 The transforms recorded for the trail.
Public Attributes inherited from Rnd::Drawable
int mShowing
Public Attributes inherited from Rnd::Object
HxStr mName
int mInternal

Protected Member Functions

virtual int DrawShowing ()
 Draw the subject at its own transform, then once per recorded transform.
Protected Member Functions inherited from Rnd::Drawable
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

Motion trail that redraws one drawable at the transforms it recently occupied.

Its RTTI descriptor is at 0x008ef068, its name string at 0x00821b28, and its single base entry at 0x00821b38 records Rnd::Drawable at offset 0, non-virtual and public. The class is 0x4c bytes, which the factory at 0x004c3570 proves by allocating exactly that much, and the Rnd::Object virtual base subobject sits at 0x30, which the constructor proves by writing that address into the virtual-base pointer at +0x00.

Two vtables belong to the class. The four-entry table at 0x00821ae8 is addressed by the Rnd::Drawable vptr at +0x10 and overrides only DrawShowing(), and the eight-entry table at 0x00821aa0 is addressed by the Rnd::Object subobject vptr with a -0x30 adjustment on every entry. Both tables end in an all-zero entry, which is the terminator rather than a null slot.

The member titles come from the text DumpText() writes: "[Blur]", "mesh:", " length:", " rate:", "falloff:", and " text:".

The seventeen routines between 0x004b9a68 and 0x004bf858 belong to Rnd::String. Only the routines listed below belong to this class.

Constructor & Destructor Documentation

◆ Blur()

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

Construct a trail with no subject.

The trail length starts at 0, the rate at 1, the falloff at 1.0, and the countdown at the rate. Both subject pointers start null, so the two reference acquisitions the constructor ends with take no effect on a freshly built object.

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

◆ ~Blur()

virtual Rnd::Blur::~Blur ( )
virtual
Ghidra address:
NTSC-U/C: 0x004c0be8
Ghidra address:
PAL: 0x004fecd8

Member Function Documentation

◆ SetMesh()

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

Set the mesh the trail is drawn from and discard the recorded transforms.

The previous subject loses its reference on this object and the new one gains one. The pointer is stored before the null test, so clearing the mesh stores the null.

Parameters
pMeshThe mesh to trail, or null for none.
Ghidra address:
NTSC-U/C: 0x004c3758
Ghidra address:
PAL: 0x00501880

◆ SetText()

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

Set the text the trail is drawn from and discard the recorded transforms.

A text subject takes precedence over a mesh subject in DrawShowing().

Parameters
pTextThe text to trail, or null for none.
Ghidra address:
NTSC-U/C: 0x004c37b8
Ghidra address:
PAL: 0x005018e0

◆ SetLength()

void Rnd::Blur::SetLength ( int nLength)

Set how many transforms the trail records and discard the recorded transforms.

A negative argument is clamped to 0, which disables the trail.

Parameters
nLengthThe number of transforms to record.
Ghidra address:
NTSC-U/C: 0x004c3818
Ghidra address:
PAL: 0x00501940

◆ SetRate()

void Rnd::Blur::SetRate ( int nRate)

Set how many frames pass between two recorded transforms and discard the recorded ones.

An argument below 1 is clamped to 1.

Parameters
nRateThe frame interval.
Ghidra address:
NTSC-U/C: 0x004c3858
Ghidra address:
PAL: 0x00501980

◆ SetFalloff()

void Rnd::Blur::SetFalloff ( float flFalloff)

Set the fraction of the subject's alpha the oldest trail step is drawn with.

Parameters
flFalloffThe fraction.
Ghidra address:
NTSC-U/C: 0x004c34b0
Ghidra address:
PAL: 0x005015d8

◆ GetMesh()

Mesh * Rnd::Blur::GetMesh ( ) const

Report the mesh the trail is drawn from.

Returns
The mesh, or null when none is set.
Ghidra address:
NTSC-U/C: 0x004c3490
Ghidra address:
PAL: 0x005015b8

◆ GetText()

Text * Rnd::Blur::GetText ( ) const

Report the text the trail is drawn from.

Returns
The text, or null when none is set.
Ghidra address:
NTSC-U/C: 0x004c3498
Ghidra address:
PAL: 0x005015c0

◆ GetLength()

int Rnd::Blur::GetLength ( ) const

Report how many transforms the trail records.

Returns
The number of transforms.
Ghidra address:
NTSC-U/C: 0x004c34a0
Ghidra address:
PAL: 0x005015c8

◆ GetRate()

int Rnd::Blur::GetRate ( ) const

Report how many frames pass between two recorded transforms.

Returns
The frame interval.
Ghidra address:
NTSC-U/C: 0x004c34a8
Ghidra address:
PAL: 0x005015d0

◆ GetFalloff()

float Rnd::Blur::GetFalloff ( ) const

Report the alpha fraction of the oldest trail step.

Returns
The fraction.
Ghidra address:
NTSC-U/C: 0x004c34b8
Ghidra address:
PAL: 0x005015e0

◆ DumpText()

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

Write a description of this trail to sink.

The two base descriptions come first, and everything below is produced only at a positive dump level. A subject that is not set produces "no object".

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

Reimplemented from Rnd::Drawable.

◆ Save()

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

Write this trail's serialised form to stream.

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

Reimplemented from Rnd::Drawable.

◆ Replace()

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

Repoint a subject when the object it addressed is replaced.

A replacement that is not of the subject's class clears the subject rather than storing a pointer of the wrong type.

Parameters
pFromThe object going away.
pToThe object to store instead, or null.
Ghidra address:
NTSC-U/C: 0x004c04c0
Ghidra address:
PAL: 0x004fe5b0

Reimplemented from Rnd::Drawable.

◆ ClassName()

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

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

The returned string is g_blurClassName, which the static initialiser at 0x004c32a8 fills with "Blur".

Returns
The class key.
Ghidra address:
NTSC-U/C: 0x004c3480
Ghidra address:
PAL: 0x005015a8

Implements Rnd::Object.

◆ Copy()

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

Copy the state of pSource into this trail.

Both subject pointers are copied without a reference transfer of their own, because the acquisition at the end registers this object against whichever subjects it ends up with.

Parameters
pSourceThe trail to copy from.
nFlagsThe set of fields to copy.
Ghidra address:
NTSC-U/C: 0x004c35e8
Ghidra address:
PAL: 0x00501710

Reimplemented from Rnd::Drawable.

◆ Load()

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

Read this trail's serialised form from stream.

A revision of 3 or more is rejected with "Can't load new Blur". The falloff is present from revision 1 and the text subject from revision 2.

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

Reimplemented from Rnd::Drawable.

◆ NewBlur()

Blur * Rnd::Blur::NewBlur ( const HxStr & name)
static

Build a trail the class registry vends.

Parameters
nameThe registry key for the new trail.
Returns
The new trail.
Ghidra address:
NTSC-U/C: 0x004c3570
Ghidra address:
PAL: 0x00501698

◆ NewFromHook()

Blur * Rnd::Blur::NewFromHook ( const HxStr & name)
static

Build a trail through g_pfnNewBlur.

Unlike the registered thunk at 0x004c34e0, the result is returned as a Blur without the narrowing to Rnd::Object. An exception from the factory produces null. Nothing in the image calls it, and the only reference is the exception range table at 0x008693d0. The name is inferred.

Parameters
nameThe registry key for the new trail.
Returns
The new trail, or null.
Ghidra address:
NTSC-U/C: 0x004c3398
Ghidra address:
PAL: 0x005014c0

◆ Find()

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

Resolve a registry key to a trail.

A key that resolves to an object of another class produces null rather than a pointer of the wrong type.

Parameters
nameThe registry key to resolve.
Returns
The trail, or null.
Ghidra address:
NTSC-U/C: 0x004c3418
Ghidra address:
PAL: 0x00501540

◆ Init()

void Rnd::Blur::Init ( )
static

Install the trail factory and register the class key with Rnd::TheManager.

Rnd::Manager::Init() also expands this inline.

Ghidra address:
NTSC-U/C: 0x004c3358
Ghidra address:
PAL: 0x00501480

◆ DrawShowing()

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

Draw the subject at its own transform, then once per recorded transform.

Drawable vtable slot 3. The text subject is drawn in preference to the mesh, but a mesh subject supplies the material even when a text is set, and a subject with no material draws no trail. Each recorded transform, newest first, is written into the subject's local transform and drawn with Rnd::Mat::SetAlpha() at a value that starts at the material alpha scaled by mFalloff and falls by an equal step per entry. A recorded transform equal to the one before it, the first compared with the current world transform, is skipped. A mesh subject draws its trail with Rnd::Mesh::kZModeZReadOnly. The subject's transforms, the material alpha, and the depth state are restored afterwards. Every mRate frames the current world transform goes to the front of mXfms, the oldest entry dropping once mLength are stored.

Returns
Non-zero, which draws the children as well.
Ghidra address:
NTSC-U/C: 0x004c0638
Ghidra address:
PAL: 0x004fe728

Reimplemented from Rnd::Drawable.

Member Data Documentation

◆ mXfms

std::list<Xfm> Rnd::Blur::mXfms

The transforms recorded for the trail.

+0x28

Public because the head-up display empties it directly through the list's clear() at 0x00415de8 whenever it restarts a trail, from HudPoints, HudTextMessage, ten of Overlay's handlers, and three further routines at 0x00412628, 0x004158c0, and 0x0041b658, and the image has no accessor for it.


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