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

Mix-in for an object driven by a frame number. More...

#include <animatable.h>

Inheritance diagram for Rnd::Animatable:
Collaboration diagram for Rnd::Animatable:

Classes

class  Filter
 One stage of the frame-number filter chain. More...
class  ScaleOffset
 Filter stage that applies an affine map. More...
class  MinMaxLoop
 Filter stage that wraps or clamps the value into a range. More...
class  ZeroOrder
 Filter stage that limits how far the value may move in one frame. More...
class  FirstOrder
 Filter stage that moves the value a fixed fraction of the way towards its input. More...
class  SecondOrder
 Filter stage that drives the value with a spring and a damper. More...

Public Types

enum  FilterType {
  kFilterScaleOffset = 0 , kFilterMinMaxLoop = 1 , kFilterZeroOrder = 2 , kFilterFirstOrder = 3 ,
  kFilterSecondOrder = 4
}
 Value a filter reports from Filter::Type() and a .rnd file stores in front of its payload. More...

Public Member Functions

 Animatable ()
 Construct an animatable with no children, no filters, and a zero frame.
virtual ~Animatable ()
 Drop this object's references on its children and delete its filters.
Animatable * Parent ()
 Report the animatable that animates this one.
void AddAnim (Animatable *pAnim)
 Append pAnim to mAnims.
void RemoveAnim (Animatable *pAnim)
 Erase pAnim from mAnims.
void SetFrame (float flFrame)
 Drive this object and its whole subtree to a frame.
float UnfilterFrame (float flValue)
 Map a value back through mFilters.
void AddFilter (Filter *pFilter)
 Append an already-built filter to mFilters.
void AddScaleOffset (float flScale, float flOffset)
 Append a new ScaleOffset stage to mFilters.
void AddMinMaxLoop (float flMin, float flMax, int nLoop)
 Append a new MinMaxLoop stage to mFilters.
void AddZeroOrder (float flLevel, float flMaxDelta)
 Append a new ZeroOrder stage to mFilters.
void AddFirstOrder (float flLevel, float flRatio)
 Append a new FirstOrder stage to mFilters.
void AddSecondOrder (float flLevel, float flSpring, float flDamper)
 Append a new SecondOrder stage to mFilters.
void RemoveFilter (int nIndex)
 Delete and erase the filter at one position in mFilters.
Filter * FilterAt (int nIndex)
 Return the filter at one position in mFilters.
void SetRate (float flRate)
 Change the multiplier of the ScaleOffset stage at the front of mFilters.
void SetOffset (float flOffset)
 Change the addend of the ScaleOffset stage at the front of mFilters.
void SetLoopRange (float flMin, float flMax)
 Change both ends of the MinMaxLoop stage at the back of mFilters.
virtual float FilteredFrameEnd ()
 Report the last frame this object's subtree animates to.
virtual void StartAnim ()
 Restart the animation of this object and its whole subtree.
virtual void DumpText (Dbg &sink)
 Write a description of this object to sink.
virtual void Save (Stream &stream)
 Write the revision, mFilters, and mAnims to stream.
virtual void Replace (Object *pFrom, Object *pTo)
 Retarget every mAnims entry equal to pFrom at pTo.
virtual void Copy (const Object *pSource, unsigned nFlags)
 Clone the filter chain of pSource, and its child list when nFlags requests it.
virtual void Load (Stream &stream)
 Replace the filter chain and the child list from stream.
void RemoveAllAnims ()
 Drop this object's reference on every mAnims entry and then empty mAnims.
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 Filter * NewFilter (int nType)
 Build one default-constructed filter for a type tag.

Public Attributes

float mFilteredFrame
 The frame SetFrame() last received, after the filter chain.
Public Attributes inherited from Rnd::Object
HxStr mName
int mInternal

Protected Member Functions

virtual void SetFrameSelf (float flFrame)
 Animate this object alone to a frame.
Protected Member Functions inherited from Rnd::Object
void ReleaseAllRefs ()
 Tell every referrer to drop its pointer to this object.

Friends

class ::MetRenderer
void CollectChildren (std::list< Object * > &objects, Animatable *pAnimatable)
 Append every animation descendant of an animatable.

Additional Inherited Members

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

Detailed Description

Mix-in for an object driven by a frame number.

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

  1. The subobject is 0x18 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 +0x14. The declared members therefore occupy +0x04 through +0x13. For a standalone Animatable the Rnd::Object subobject sits at +0x18. The -0x18 adjustment on every entry of the second vtable confirms that placement.

The size is also pinned from outside the class, which is the stronger argument. Rnd::TransAnim and Rnd::View each derive from this class at offset 0 and place Rnd::Drawable at offset 0x18, so the next base begins exactly 0x18 bytes in. A constructor's highest store would only give a lower bound.

Two vtables belong to the class. The four-entry table at 0x0081e7f0 is addressed by the vptr at +0x14 and stores the three virtuals declared here. The nine-entry table at 0x0081e818 is addressed by the Rnd::Object subobject vptr and stores the overrides of the Rnd::Object virtuals, each with a -0x18 adjustment back to the Animatable subobject. Slot 5 of the second table still addresses the pure-virtual stub at 0x005381a8. ClassName() is therefore unimplemented here and the class remains abstract.

An animatable owns two lists. mAnims stores the animatables this one drives, and every entry registers this object as a referrer through Rnd::Object::AddRef(). mFilters stores a chain of value filters this object owns outright and deletes in its destructor. SetFrame() maps the incoming frame forward through that chain before handing it to the SetFrameSelf() hook and to the children, and UnfilterFrame() maps a child frame back the other way.

Member Enumeration Documentation

◆ FilterType

Value a filter reports from Filter::Type() and a .rnd file stores in front of its payload.

The five names come from the type-name dumper at 0x0049a8a8, whose switch table pairs each tag with its literal. Nothing invokes that routine in the shipped build. The literals are therefore the only surviving record of the enumeration.

Enumerator
kFilterScaleOffset 

A ScaleOffset filter.

kFilterMinMaxLoop 

A MinMaxLoop filter.

kFilterZeroOrder 

A ZeroOrder filter.

kFilterFirstOrder 

A FirstOrder filter.

kFilterSecondOrder 

A SecondOrder filter.

Constructor & Destructor Documentation

◆ Animatable()

Rnd::Animatable::Animatable ( )

Construct an animatable with no children, no filters, and a zero frame.

Ghidra address:
NTSC-U/C: 0x0049a108
Ghidra address:
PAL: 0x004d8068

◆ ~Animatable()

virtual Rnd::Animatable::~Animatable ( )
virtual

Drop this object's references on its children and delete its filters.

Ghidra address:
NTSC-U/C: 0x00499f48
Ghidra address:
PAL: 0x004d7ea8

Member Function Documentation

◆ Parent()

Animatable * Rnd::Animatable::Parent ( )

Report the animatable that animates this one.

Walks the referrer list of the Rnd::Object subobject, casts each referrer to Animatable and returns the first whose own mAnims list includes this object. The result is therefore the parent in the animation hierarchy rather than a plain cast.

Returns
The parent animatable, or null when no referrer animates this one.
Ghidra address:
NTSC-U/C: 0x00494a88
Ghidra address:
PAL: 0x004d2950

◆ AddAnim()

void Rnd::Animatable::AddAnim ( Animatable * pAnim)

Append pAnim to mAnims.

Registers this object as a referrer of pAnim. A pAnim already in mAnims produces the report "%s already in %s" and no insertion.

Parameters
pAnimThe animatable to add.
Ghidra address:
NTSC-U/C: 0x004953c0
Ghidra address:
PAL: 0x004d3288

◆ RemoveAnim()

void Rnd::Animatable::RemoveAnim ( Animatable * pAnim)

Erase pAnim from mAnims.

Drops this object's reference on pAnim first. A pAnim absent from mAnims does nothing.

Parameters
pAnimThe animatable to remove.
Ghidra address:
NTSC-U/C: 0x00495540
Ghidra address:
PAL: 0x004d3408

◆ SetFrame()

void Rnd::Animatable::SetFrame ( float flFrame)

Drive this object and its whole subtree to a frame.

Records the frame as given, maps it forward through mFilters, records the filtered result, hands the filtered result to the SetFrameSelf() hook, and then passes the same filtered result to every mAnims entry. A child therefore receives its parent's filtered frame and applies its own filters to it in turn.

Parameters
flFrameThe frame to move to.
Ghidra address:
NTSC-U/C: 0x0049a428
Ghidra address:
PAL: 0x004d8390

◆ UnfilterFrame()

float Rnd::Animatable::UnfilterFrame ( float flValue)

Map a value back through mFilters.

Walks mFilters from back to front and applies Filter::Unapply() at each stage. That undoes what SetFrame() does on the way in. FilteredFrameEnd() uses it to bring a child's end frame into this object's frame numbering.

Parameters
flValueThe value to map.
Returns
The value in this object's incoming frame numbering.
Ghidra address:
NTSC-U/C: 0x00495050
Ghidra address:
PAL: 0x004d2f18

◆ AddFilter()

void Rnd::Animatable::AddFilter ( Filter * pFilter)

Append an already-built filter to mFilters.

The list takes ownership, and the destructor deletes the filter.

Parameters
pFilterThe filter to append.
Ghidra address:
NTSC-U/C: 0x00499940
Ghidra address:
PAL: 0x004d78a0

◆ AddScaleOffset()

void Rnd::Animatable::AddScaleOffset ( float flScale,
float flOffset )

Append a new ScaleOffset stage to mFilters.

Parameters
flScaleThe multiplier.
flOffsetThe addend.
Ghidra address:
NTSC-U/C: 0x004999e8
Ghidra address:
PAL: 0x004d7948

◆ AddMinMaxLoop()

void Rnd::Animatable::AddMinMaxLoop ( float flMin,
float flMax,
int nLoop )

Append a new MinMaxLoop stage to mFilters.

Parameters
flMinThe lower end of the range.
flMaxThe upper end of the range.
nLoopNon-zero to wrap into the range instead of clamping to it.
Ghidra address:
NTSC-U/C: 0x00499ae0
Ghidra address:
PAL: 0x004d7a40

◆ AddZeroOrder()

void Rnd::Animatable::AddZeroOrder ( float flLevel,
float flMaxDelta )

Append a new ZeroOrder stage to mFilters.

Parameters
flLevelThe starting output.
flMaxDeltaThe largest step one frame may take.
Ghidra address:
NTSC-U/C: 0x00499be8
Ghidra address:
PAL: 0x004d7b48

◆ AddFirstOrder()

void Rnd::Animatable::AddFirstOrder ( float flLevel,
float flRatio )

Append a new FirstOrder stage to mFilters.

Parameters
flLevelThe starting output.
flRatioThe fraction of the remaining distance each frame covers.
Ghidra address:
NTSC-U/C: 0x00499ce0
Ghidra address:
PAL: 0x004d7c40

◆ AddSecondOrder()

void Rnd::Animatable::AddSecondOrder ( float flLevel,
float flSpring,
float flDamper )

Append a new SecondOrder stage to mFilters.

Parameters
flLevelThe starting output.
flSpringThe acceleration per unit of distance to the input.
flDamperThe fraction of the velocity shed each frame.
Ghidra address:
NTSC-U/C: 0x00499dd8
Ghidra address:
PAL: 0x004d7d38

◆ RemoveFilter()

void Rnd::Animatable::RemoveFilter ( int nIndex)

Delete and erase the filter at one position in mFilters.

An index at or past the end does nothing. No call site survives in the shipped build.

Parameters
nIndexHow far into mFilters the filter sits.
Ghidra address:
NTSC-U/C: 0x00494c00
Ghidra address:
PAL: 0x004d2ac8

◆ FilterAt()

Filter * Rnd::Animatable::FilterAt ( int nIndex)

Return the filter at one position in mFilters.

The position is not tested against the list. The out-of-line copy has no caller, and the title is inferred.

Parameters
nIndexHow far into mFilters the filter sits.
Returns
The filter.
Ghidra address:
NTSC-U/C: 0x0049a0b0
Ghidra address:
PAL: 0x004d8010

◆ SetRate()

void Rnd::Animatable::SetRate ( float flRate)

Change the multiplier of the ScaleOffset stage at the front of mFilters.

The addend is recomputed as well, so the stage maps the current mFrame to the same output as before and only later frames advance at the new rate. An empty chain, or a front stage of another type, produces the fatal report "%s must have scale-offset filter in slot 1". The definition sits in the unit of the tunnel object cache. The title is inferred.

Parameters
flRateThe new multiplier.
Ghidra address:
NTSC-U/C: 0x0040d2b0
Ghidra address:
PAL: 0x00446d10

◆ SetOffset()

void Rnd::Animatable::SetOffset ( float flOffset)

Change the addend of the ScaleOffset stage at the front of mFilters.

An empty chain, or a front stage of another type, produces the fatal report "%s must have scale-offset filter in slot 1". The definition sits in the unit of the tunnel object cache. The title is inferred.

Parameters
flOffsetThe new addend.
Ghidra address:
NTSC-U/C: 0x0040d3d0
Ghidra address:
PAL: 0x00446e30

◆ SetLoopRange()

void Rnd::Animatable::SetLoopRange ( float flMin,
float flMax )

Change both ends of the MinMaxLoop stage at the back of mFilters.

An empty chain, or a back stage of another type, produces the fatal report "%s must have min-max-loop filter in last slot". The definition sits in the unit of the tunnel object cache. The title is inferred.

Parameters
flMinThe new lower end.
flMaxThe new upper end.
Ghidra address:
NTSC-U/C: 0x0040d4a8
Ghidra address:
PAL: 0x00446f08

◆ NewFilter()

Filter * Rnd::Animatable::NewFilter ( int nType)
static

Build one default-constructed filter for a type tag.

The reader and Copy() both use this to turn a stored tag back into an object. A tag outside the FilterType range produces the report path of Rnd::TheDbg and a null result.

Parameters
nTypeOne of the FilterType constants.
Returns
The new filter, or null for an unrecognised tag.
Ghidra address:
NTSC-U/C: 0x004950e8
Ghidra address:
PAL: 0x004d2fb0

◆ FilteredFrameEnd()

virtual float Rnd::Animatable::FilteredFrameEnd ( )
virtual

Report the last frame this object's subtree animates to.

Animatable vtable slot 1. The base implementation animates nothing of its own and reports the largest child end frame, each brought into this object's frame numbering through that child's own filter chain, starting from zero. Rnd::MeshAnim, Rnd::MatAnim, and Rnd::LightAnim override it with the timestamp of their last keyframe.

Returns
The last frame, never below zero.
Ghidra address:
NTSC-U/C: 0x00494b50
Ghidra address:
PAL: 0x004d2a18

Reimplemented in Rnd::LightAnim, Rnd::MatAnim, Rnd::MeshAnim, Rnd::ParticleSysAnim, and Rnd::TransAnim.

◆ StartAnim()

virtual void Rnd::Animatable::StartAnim ( )
virtual

Restart the animation of this object and its whole subtree.

Animatable vtable slot 2. The base implementation forwards to the same slot on every mAnims entry. Rnd::ParticleSys overrides it at 0x0052c490, releases its live particles, and then chains to this implementation. The title is inferred from that one override. No string in the image identifies the slot, and no direct call site survives.

Ghidra address:
NTSC-U/C: 0x0049a3b8
Ghidra address:
PAL: 0x004d8320

Reimplemented in Rnd::ParticleSys.

◆ DumpText()

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

Write a description of this object to sink.

Writes mFilters and mAnims, 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 in any case.

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

Reimplemented from Rnd::Object.

Reimplemented in Rnd::Arena, Rnd::Generator, Rnd::LightAnim, Rnd::MatAnim, Rnd::MeshAnim, Rnd::Movie, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.

◆ Save()

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

Write the revision, mFilters, and mAnims to stream.

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

Implements Rnd::Object.

Reimplemented in Rnd::Arena, Rnd::Generator, Rnd::LightAnim, Rnd::MatAnim, Rnd::MeshAnim, Rnd::Movie, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.

◆ Replace()

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

Retarget every mAnims entry equal to pFrom at pTo.

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

Implements Rnd::Object.

Reimplemented in Rnd::Arena, Rnd::Generator, Rnd::LightAnim, Rnd::MatAnim, Rnd::MeshAnim, Rnd::Movie, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.

◆ Copy()

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

Clone the filter chain of pSource, and its child list when nFlags requests it.

Parameters
pSourceThe object to copy from.
nFlagsThe set of fields to copy; see kCopyChildLists.
Ghidra address:
NTSC-U/C: 0x00494e70
Ghidra address:
PAL: 0x004d2d38

Implements Rnd::Object.

Reimplemented in Rnd::Arena, Rnd::Generator, Rnd::LightAnim, Rnd::MatAnim, Rnd::MeshAnim, Rnd::Movie, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.

◆ Load()

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

Replace the filter chain and the child list from stream.

A revision above the one this build writes produces the report "Can't load new Animatable" followed by the abort handler of Rnd::TheDbg.

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

Implements Rnd::Object.

Reimplemented in Rnd::Arena, Rnd::Generator, Rnd::LightAnim, Rnd::MatAnim, Rnd::MeshAnim, Rnd::Movie, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::TransAnim, Rnd::Tunnel, and Rnd::View.

◆ RemoveAllAnims()

void Rnd::Animatable::RemoveAllAnims ( )

Drop this object's reference on every mAnims entry and then empty mAnims.

Every derived destructor invokes this before its own teardown. The tail at 0x0049a9c0 passes the address of mAnims to the list clear at 0x0045edc8, whose body returns every node to the pool and re-self-links the dummy node. ReleaseObjects() at 0x00494cb0 is the routine that walks mAnims without emptying it, and the two bodies are otherwise alike.

Public because Rnd::MetScreen::ResolveContainerViews() calls it at 0x0038b294 on the Rnd::View it just resolved, and MetScreen derives from MsgSink rather than from this class. A friend declaration for MetScreen fits the image equally well.

Ghidra address:
NTSC-U/C: 0x0049a960
Ghidra address:
PAL: 0x004d88c8

◆ SetFrameSelf()

virtual void Rnd::Animatable::SetFrameSelf ( float flFrame)
protectedvirtual

Animate this object alone to a frame.

Animatable vtable slot 3. The base implementation animates nothing. Every animation subclass overrides it to interpolate its keyframes at the frame SetFrame() has already filtered. Only SetFrame() invokes it. The arrangement matches Rnd::Drawable::DrawShowing().

Parameters
flFrameThe filtered frame to animate to.
Ghidra address:
NTSC-U/C: 0x0049a100
Ghidra address:
PAL: 0x004d8060

Reimplemented in Rnd::Arena, Rnd::Generator, Rnd::LightAnim, Rnd::MatAnim, Rnd::MeshAnim, Rnd::Movie, Rnd::ParticleSys, Rnd::ParticleSysAnim, Rnd::TransAnim, and Rnd::Tunnel.

◆ ::MetRenderer

friend class ::MetRenderer
friend

◆ CollectChildren

void CollectChildren ( std::list< Object * > & objects,
Animatable * pAnimatable )
friend

Append every animation descendant of an animatable.

Parameters
objectsThe list to append to.
pAnimatableThe animatable to start from, or null.
Ghidra address:
NTSC-U/C: 0x00519fc8
Ghidra address:
PAL: 0x0055a3c0

Member Data Documentation

◆ mFilteredFrame

float Rnd::Animatable::mFilteredFrame

The frame SetFrame() last received, after the filter chain.

This is the value handed to SetFrameSelf() and to every child. Public because TnlCrippleFX::SetFrame() at 0x0043e500 reads it through the crippler path, and the image has no accessor. +0x10


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