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

Keyframed animation of one Rnd::ParticleSys. More...

#include <particlesysanim.h>

Inheritance diagram for Rnd::ParticleSysAnim:
Collaboration diagram for Rnd::ParticleSysAnim:

Public Types

enum  { kSerialVersion = 1 }
 Revision Save() writes, and the highest revision Load() accepts. More...
enum  { kCopyShareKeys = 0x80 }
 Bit of the copy flags that shares the source's keyframe channels rather than copying them. More...
Public Types inherited from Rnd::Animatable
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

 ParticleSysAnim (const HxStr &name)
 Construct an animation with no channels and no system that owns its own frames.
virtual ~ParticleSysAnim ()
virtual void DumpText (Dbg &sink)
 Write the animation to the engine text sink.
virtual void Save (Stream &stream)
 Serialise the animation.
virtual void Replace (Object *pFrom, Object *pTo)
 Replace one object reference with another.
virtual const HxStr & ClassName () const
 Return the registered class name, "ParticleSysAnim".
virtual void Copy (const Object *pSource, unsigned nFlags)
 Copy another animation over this one.
virtual void Load (Stream &stream)
 Load the animation.
virtual float FilteredFrameEnd ()
 Report the last frame this animation runs to.
Public Member Functions inherited from Rnd::Animatable
 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 void StartAnim ()
 Restart the animation of this object and its whole subtree.
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().

Protected Member Functions

virtual void SetFrameSelf (float flFrame)
 Animate the system to a frame.
void SetParticleSys (ParticleSys *pParticleSys)
 Make a particle system the one this animation drives.
void SetFramesOwner (ParticleSysAnim *pOwner)
 Make another animation the one whose keyframes drive this one.
Protected Member Functions inherited from Rnd::Object
void ReleaseAllRefs ()
 Tell every referrer to drop its pointer to this object.

Additional Inherited Members

Static Public Member Functions inherited from Rnd::Animatable
static Filter * NewFilter (int nType)
 Build one default-constructed filter for a type tag.
Public Attributes inherited from Rnd::Animatable
float mFilteredFrame
 The frame SetFrame() last received, after the filter chain.
Public Attributes inherited from Rnd::Object
HxStr mName
int mInternal
Protected Attributes inherited from Rnd::Object
std::list< Object * > mRefs

Detailed Description

Keyframed animation of one Rnd::ParticleSys.

Its RTTI descriptor is at 0x008f0eb0. It has Rnd::Animatable as its one public base at offset

  1. The shared Object subobject sits at +0x30, an offset the -0x30 adjustment on every entry of the Object subobject table confirms. The members below therefore occupy +0x18 through +0x2f, and the Animatable subobject is the 0x18 bytes ahead of them. The creator allocates exactly 0x4c bytes, the layout with no surplus.

Two vtables belong to the class, each identified by its own GetTypeInfo slot addressing 0x0052b7f0. The Object subobject table at 0x00827a80 stores the seven Object overrides, and the Animatable table at 0x00827ac8 stores FilteredFrameEnd() at slot 1 and SetFrameSelf() at slot 3. Slot 2 still addresses the base StartAnim() at 0x0049a3b8, so restarting an animation does nothing of its own here.

Three channels drive the system, and the text dump labels them "startColorKeys:", "endColorKeys:", and "emitRateKeys:". The two colour channels are std::list of Rnd::ColorKey and share the dump routine at 0x004d8de8. The emission rate channel is a std::list of Rnd::FloatKey and has its own dump at 0x004d8f08. FilteredFrameEnd() reads the frame of the two colour channels at list node +0x20 and of the rate channel at node +0x0c, which is the two element sizes rather than one.

Keys are shared rather than copied, the same arrangement Rnd::MeshAnim uses with mKeysOwner. Both FilteredFrameEnd() and SetFrameSelf() read the channels of mFramesOwner rather than their own, so an animation whose frames belong to another animation reads that object's keys.

SetFrameSelf() is blocked rather than unrecovered; see its own documentation.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Revision Save() writes, and the highest revision Load() accepts.

Enumerator
kSerialVersion 

◆ anonymous enum

anonymous enum

Bit of the copy flags that shares the source's keyframe channels rather than copying them.

Recovered from the andi at 0x0052706c in Copy(). Rnd::MeshAnim reads bit 0x40 and Rnd::LightAnim bit 0x02 for the same purpose, so the bit is per class rather than shared across the hierarchy.

Enumerator
kCopyShareKeys 

Constructor & Destructor Documentation

◆ ParticleSysAnim()

Rnd::ParticleSysAnim::ParticleSysAnim ( const HxStr & name)

Construct an animation with no channels and no system that owns its own frames.

mEmitRateRatio starts at zero. Rnd::NewParticleSysAnim() is the only construction site.

Parameters
nameThe object name, passed to the Rnd::Object constructor.
Ghidra address:
NTSC-U/C: 0x0052bca0
Ghidra address:
PAL: 0x0056c318

◆ ~ParticleSysAnim()

virtual Rnd::ParticleSysAnim::~ParticleSysAnim ( )
virtual
Ghidra address:
NTSC-U/C: 0x0052b9c0
Ghidra address:
PAL: 0x0056c038

Member Function Documentation

◆ DumpText()

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

Write the animation to the engine text sink.

Emits the Object and Animatable dumps, then the "[ParticleSysAnim]" block. The block is suppressed while the dump level of the sink is not positive.

Parameters
sinkThe text sink.
Ghidra address:
NTSC-U/C: 0x00526980
Ghidra address:
PAL: 0x00566f58

Reimplemented from Rnd::Animatable.

◆ Save()

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

Serialise the animation.

Writes kSerialVersion, the Rnd::Animatable subobject, mParticleSys as a name, the three channels, mFramesOwner as a name, and finally mEmitRateRatio.

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

Reimplemented from Rnd::Animatable.

◆ Replace()

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

Replace one object reference with another.

Parameters
pFromThe object being replaced.
pToThe object to point at, which may be null.
Ghidra address:
NTSC-U/C: 0x005267a8
Ghidra address:
PAL: 0x00566d80

Reimplemented from Rnd::Animatable.

◆ ClassName()

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

Return the registered class name, "ParticleSysAnim".

Returns
The class name.
Ghidra address:
NTSC-U/C: 0x0052bc90
Ghidra address:
PAL: 0x0056c308

Implements Rnd::Object.

◆ Copy()

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

Copy another animation over this one.

kCopyShareKeys shares the source's channels instead of copying them, and a source that is itself sharing is always shared from rather than copied. mEmitRateRatio is copied either way.

Parameters
pSourceThe source object, which has to be an animation for the copy to have any effect.
nFlagsThe copy flags.
Ghidra address:
NTSC-U/C: 0x00526fc8
Ghidra address:
PAL: 0x005675f0

Reimplemented from Rnd::Animatable.

◆ Load()

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

Load the animation.

Reports "Can't load new ParticleSysAnim" through the failure sink when the file version exceeds what this build writes.

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

Reimplemented from Rnd::Animatable.

◆ FilteredFrameEnd()

virtual float Rnd::ParticleSysAnim::FilteredFrameEnd ( )
virtual

Report the last frame this animation runs to.

Rnd::Animatable vtable slot 1. Counts the keys of each channel of mFramesOwner and reports the frame of the last key across the three, taking the frame from the final list node of each. An empty channel contributes zero.

Returns
The last frame.
Ghidra address:
NTSC-U/C: 0x00527128
Ghidra address:
PAL: 0x00567750

Reimplemented from Rnd::Animatable.

◆ SetFrameSelf()

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

Animate the system to a frame.

Rnd::Animatable vtable slot 3. Returns at once when mParticleSys is null. Each of the two colour channels of mFramesOwner selects the bracketing keyframe pair, blends the pair on VU0, and then moves one spawn colour range of the system so that the blended colour becomes the low end while the spread of the range survives. The move is AddColor() followed by SubColor().

The emission rate channel interpolates its two scalars linearly instead, then divides Rnd::ParticleSys::mEmitRateHigh by mEmitRateLow into mEmitRateRatio whenever the second is not zero, and finally writes the interpolated rate to mEmitRateLow and that rate scaled by mEmitRateRatio to mEmitRateHigh. An empty rate channel finishes the routine.

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

Reimplemented from Rnd::Animatable.

◆ SetParticleSys()

void Rnd::ParticleSysAnim::SetParticleSys ( ParticleSys * pParticleSys)
protected

Make a particle system the one this animation drives.

Moves this object's reference from the previous system to the new one. No call site survives in the shipped program, and the name is inferred.

Parameters
pParticleSysThe new system, or null.
Ghidra address:
NTSC-U/C: 0x0052c700
Ghidra address:
PAL: 0x0056cd78

◆ SetFramesOwner()

void Rnd::ParticleSysAnim::SetFramesOwner ( ParticleSysAnim * pOwner)
protected

Make another animation the one whose keyframes drive this one.

Moves this object's reference from the previous owner to the new one, and then empties this object's own channels unless it is its own owner. No call site survives in the shipped program, and the name follows the Rnd::TransAnim counterpart.

Parameters
pOwnerThe new frames owner, or null.
Ghidra address:
NTSC-U/C: 0x0052c7a0
Ghidra address:
PAL: 0x0056ce18

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