|
resonance 1.0.1
|
Loop of views the renderer walks as one continuous space. More...
#include <arena.h>


Classes | |
| struct | Section |
| One view in the loop. More... | |
| class | DrawEntry |
| One entry of mDrawOrder. More... | |
Public Member Functions | |
| void * | operator new (size_t nSize) |
| Allocate a loop from the tagged heap under the tag "Rnd::Arena". | |
| void | operator delete (void *pBlock) |
| Release a loop to the tagged heap. | |
| Arena (const HxStr &name) | |
| Construct an empty loop. | |
| virtual | ~Arena () |
| Release the section views and every referrer. | |
| virtual void | DumpText (Dbg &sink) |
| Write the loop to the engine text sink. | |
| virtual void | Save (Stream &stream) |
| Write revision 4 of the loop to stream. | |
| virtual void | Replace (Object *pFrom, Object *pTo) |
| Replace one object reference with another. | |
| virtual const HxStr & | ClassName () const |
| Return the registered class name, "Arena". | |
| virtual void | Copy (const Object *pSource, unsigned nFlags) |
| Copy another loop over this one. | |
| virtual void | Load (Stream &stream) |
| Read the loop from stream. | |
| Vector3 & | LoopDist () |
| Report the loop displacement. | |
| void | AddInstancesToHitList () |
| Register this loop as a referrer of every section view and resize mDrawOrder. | |
| void | RemoveInstancesFromHitList () |
| Drop this loop's registration on every section view and empty mDrawOrder. | |
| void | SetLoopDist (const Vector3 &loopDist) |
| Set the displacement one trip round the loop applies. | |
| void | SetLoopFrames (float flLoopFrames) |
| Set the number of frames one trip round the loop takes. | |
| void | SetSectionCount (unsigned int nCount) |
| Resize the loop to a number of sections. | |
| void | SetSectionView (int nIndex, View *pView) |
| Point one section at a view. | |
| void | SetSectionRange (int nIndex, float flStartFrame, float flEndFrame) |
| Set the frames one section is shown for. | |
| void | SetSectionTeleport (int nIndex, int nTeleport) |
| Set whether one section moves its view as the loop advances. | |
| 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 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. | |
| 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(). | |
| Public Member Functions inherited from Rnd::Collideable | |
| Collideable () | |
| Construct a collideable with no children. | |
| virtual | ~Collideable () |
| Drop this object's references on its children. | |
| Collideable * | Parent () |
| Report the collideable that hit-tests this one. | |
| void | AddCollide (Collideable *pCollide) |
| Append pCollide to mCollides. | |
| void | RemoveCollide (Collideable *pCollide) |
| Erase pCollide from mCollides. | |
| virtual void | FindCollisions (const Vector2 &point, std::list< Collision > &collisions) |
| Test a screen point against this object and append what it strikes to collisions. | |
| Public Member Functions inherited from Rnd::Transformable | |
| Transformable () | |
| Construct a dirty transformable with identity transforms and no children. | |
| virtual | ~Transformable () |
| Drop this object's references on its children. | |
| void | AddTrans (Transformable *pTrans) |
| Append pTrans to mTransList and mark it dirty. | |
| void | RemoveTrans (Transformable *pTrans) |
| Erase pTrans from mTransList. | |
| void | RemoveAllTranses () |
| Drop this object's reference on every mTransList entry and empty the list. | |
| Transformable * | Parent () |
| Report the transformable that positions this one. | |
| virtual void | SetBillboard (int nBillboard) |
| Set the billboard mode and mark the transform dirty. | |
| void | SetOrigin (const float *pOrigin) |
| Set the origin row and mark the transform dirty. | |
| float * | GetDrawXfm () |
| Build the transform this object draws with and return it. | |
| 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. | |
Static Public Member Functions | |
| static void | Init () |
| Install the creator hook and register the class with Rnd::TheManager under the key "Arena". | |
| Static Public Member Functions inherited from Rnd::Animatable | |
| static Filter * | NewFilter (int nType) |
| Build one default-constructed filter for a type tag. | |
| Static Public Member Functions inherited from Rnd::Drawable | |
| static Drawable * | Find (const HxStr &name) |
| Resolve a registry key to a drawable. | |
Protected Member Functions | |
| virtual int | DrawShowing () |
| Draw the section views in mDrawOrder. | |
| virtual int | UpdateWorldXfm (Transformable *pParent, int nForce) |
| Recompute the world transform, and then that of every showing section view. | |
| virtual void | FindCollisions (const Segment &ray, std::list< Collision > &collisions) |
| Test a ray against the loop and append what it strikes to sink. | |
| virtual void | SetFrameSelf (float flFrame) |
| Place every section and rebuild the draw order. | |
| Protected Member Functions inherited from Rnd::Object | |
| void | ReleaseAllRefs () |
| Tell every referrer to drop its pointer to this object. | |
| Protected Member Functions inherited from Rnd::Collideable | |
| void | ReleaseCollidesRefs () |
| Drop this object's reference on every mCollides entry without emptying the list. | |
| Protected Member Functions inherited from Rnd::Transformable | |
| void | AdoptXfmFrom (const Transformable &owner) |
| Adopt the transform of an owner this object is being detached from. | |
| void | ReleaseTransRefs () |
| Drop this object's reference on every mTransList entry without emptying the list. | |
| Protected Member Functions inherited from Rnd::Drawable | |
| void | ReleaseDrawsRefs () |
| Drop this object's reference on every mDraws entry without emptying the list. | |
Additional Inherited Members | |
| 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 Types inherited from Rnd::Transformable | |
| enum | Billboard { kBillboardNone = 0 , kBillboardX = 1 , kBillboardY = 2 , kBillboardZ = 4 , kBillboardXZ = 8 , kBillboardXYZ = 16 , kBillboardSimpleXYZ = 32 , kBillboardLocalRotate = 64 , kBillboardScaleX = 129 , kBillboardScaleY = 130 , kBillboardScaleZ = 132 , kBillboardScaleXZ = 136 , kBillboardScaleXYZ = 144 , kBillboardScaleSimpleXYZ = 160 } |
| Mode mBillboard selects, recovered from the name dumper at 0x004f26f0. More... | |
| 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 |
| Public Attributes inherited from Rnd::Transformable | |
| float | mLocalXfm [kXfmRowCount][kXfmRowFloatCount] |
| Transform this object is positioned by, before the parent transform is applied. | |
| float | mWorldXfm [kXfmRowCount][kXfmRowFloatCount] |
| Composed world transform. | |
| int | mDirty |
| Set by every writer of a transform field and cleared once UpdateWorldXfm has recomposed. | |
| Public Attributes inherited from Rnd::Drawable | |
| int | mShowing |
| Protected Attributes inherited from Rnd::Object | |
| std::list< Object * > | mRefs |
| Protected Attributes inherited from Rnd::Transformable | |
| float | mOrigin [kXfmRowFloatCount] |
| int | mBillboard |
Loop of views the renderer walks as one continuous space.
Its RTTI descriptor is at 0x008f0440, its name string at 0x008342f8, and its four base entries record Rnd::Animatable at +0x00, Rnd::Collideable at +0x18, Rnd::Transformable at +0x30, and Rnd::Drawable at +0xe0, each non-virtual and public. All four derive virtually from Rnd::Object, so one shared Object subobject sits at +0x130, which the constructor proves by writing this + 0x130 into the virtual-base pointer of each of the four subobjects. The class is therefore 0x14c bytes and the creator allocates 0x150.
The four offsets account for every byte ahead of +0xf4. Animatable uses 0x18 and needs no padding, Collideable uses 0xc and the twelve bytes after it are the padding that puts the 16-byte-aligned Transformable subobject on +0x30, Transformable uses 0xac and rounds to 0xb0, and Drawable uses 0x14. The twelve bytes from +0xf4 are the padding that puts the first member, which is 16-byte aligned, on +0x100, and the twelve past the last member are the same rounding applied to the non-virtual part before the virtual base subobject is placed. Rnd::Generator shows the identical rounding at its own tail.
Five vtables belong to the class, each identified by a GetTypeInfo slot addressing 0x005bb800 and by an adjustment matching its subobject offset. The Drawable table at 0x00834220 adjusts by -0xe0 and overrides DrawShowing(). The Transformable table at 0x00834248 adjusts by -0x30 and overrides UpdateWorldXfm(). The Collideable table at 0x00834268 adjusts by -0x18 and overrides FindCollisions(). The Animatable table at 0x00834288 has a zero adjustment and overrides SetFrameSelf(). The Object subobject table at 0x008342b0 adjusts by -0x130 and stores the seven Object virtuals. Every table ends in an all-zero terminator entry rather than a null slot. No table gains a slot past the own count of its base. This class therefore declares no virtual of its own.
The member and section titles come from the text the dumps write: "[Arena]", "loopDist:", " loopFrames:", and "sections:" from DumpText() at 0x005b5f08, and "\n\tview:", " frame:", " loop:", "\n\tdelta:", " teleport:", and " sortStart:" from the section dump at 0x005b82b0.
TnlArena is a different class. It derives from MsgSink and belongs to the game rather than the renderer, and so does MetArenasScreen.
|
explicit |
Construct an empty loop.
mLoopDist starts at the zero vector, mLoopFrames at 1000.0, and both containers empty. The body then runs AddInstancesToHitList(), which the binary expands inline and which does nothing more than size mDrawOrder to the empty section list.
| name | The registry key for this object. |
|
virtual |
Release the section views and every referrer.
Runs RemoveInstancesFromHitList(), which the binary expands inline, and then ReleaseAllRefs().
| void * Rnd::Arena::operator new | ( | size_t | nSize | ) |
Allocate a loop from the tagged heap under the tag "Rnd::Arena".
| nSize | The object size, which the compiler supplies. |
| void Rnd::Arena::operator delete | ( | void * | pBlock | ) |
Release a loop to the tagged heap.
| pBlock | The block. |
|
virtual |
Write the loop to the engine text sink.
The four base dumps run unconditionally and the block below them only while the dump level of the sink is positive. The Collideable dump runs last of the four.
| sink | The text sink. |
Reimplemented from Rnd::Animatable.
|
virtual |
Write revision 4 of the loop to stream.
The base blocks are written in a different order from the one DumpText() uses. mDrawOrder is not written, because AddInstancesToHitList() rebuilds it from the section count.
| stream | The stream to write to. |
Reimplemented from Rnd::Animatable.
Replace one object reference with another.
A matching section takes the replacement through a narrowing cast, and a matching entry of mDrawOrder is cleared to null rather than pointed at pTo.
| pFrom | The object being replaced. |
| pTo | The object to point at, which may be null. |
Reimplemented from Rnd::Animatable.
|
virtual |
Return the registered class name, "Arena".
Implements Rnd::Object.
|
virtual |
Copy another loop over this one.
Runs the four base copies, drops the view references, takes mLoopDist, mLoopFrames, and mSections from the source, and registers the views again. The source is narrowed with a checked cast whose result is used without a null test.
| pSource | The source object, which has to be a loop. |
| nFlags | The copy flags. |
Reimplemented from Rnd::Animatable.
|
virtual |
Read the loop from stream.
Rejects revision 5 and above, reporting "Can't load new Arena". The revision word is stored in Rnd::g_nRndArenaLoadRevision rather than in a local.
| stream | The stream to read from. |
Reimplemented from Rnd::Animatable.
| Vector3 & Rnd::Arena::LoopDist | ( | ) |
Report the loop displacement.
The routine is two instructions that return the address of the member. It is compiled out of line here, so it exists as a function rather than as an accessor this reconstruction added.
|
static |
Install the creator hook and register the class with Rnd::TheManager under the key "Arena".
Rnd::Manager::Init() also expands this inline.
| void Rnd::Arena::AddInstancesToHitList | ( | ) |
Register this loop as a referrer of every section view and resize mDrawOrder.
Load() runs it once the sections are in place. mDrawOrder receives one null entry per section.
| void Rnd::Arena::RemoveInstancesFromHitList | ( | ) |
Drop this loop's registration on every section view and empty mDrawOrder.
Load() runs it before reading the sections.
| void Rnd::Arena::SetLoopDist | ( | const Vector3 & | loopDist | ) |
Set the displacement one trip round the loop applies.
Does nothing when every component already matches. Otherwise every section is first moved back to loop zero, the displacement is stored, and SetFrameSelf() reruns at the current filtered frame to place the sections again. The routine has no caller, and the title is inferred from the member it writes.
| loopDist | The new displacement. |
| void Rnd::Arena::SetLoopFrames | ( | float | flLoopFrames | ) |
Set the number of frames one trip round the loop takes.
Zero is refused with "Can't set frames = 0". An unchanged value does nothing. Otherwise every section is first moved back to loop zero, the value is stored, and SetFrameSelf() reruns at the current filtered frame. The routine has no caller, and the title is inferred from the member it writes.
| flLoopFrames | The new frame count. |
| void Rnd::Arena::SetSectionCount | ( | unsigned int | nCount | ) |
Resize the loop to a number of sections.
Each section dropped from the end is moved back to loop zero and releases its reference on its view. mSections then grows or shrinks to nCount, new sections taking the default constructor, and mDrawOrder is resized to match. The routine has no caller, and the title is inferred.
| nCount | The new section count. |
| void Rnd::Arena::SetSectionView | ( | int | nIndex, |
| View * | pView ) |
Point one section at a view.
The section is moved back to loop zero and releases its old view, takes a reference on the new one, and is then placed for the current filtered frame. The routine has no caller, and the title is inferred.
| nIndex | The section. |
| pView | The view to draw, or null. |
| void Rnd::Arena::SetSectionRange | ( | int | nIndex, |
| float | flStartFrame, | ||
| float | flEndFrame ) |
Set the frames one section is shown for.
The section is moved back to loop zero, mFrame takes flEndFrame and mDelta the length of the range, and the section is then placed for the current filtered frame. The routine has no caller, and the title is inferred.
| nIndex | The section. |
| flStartFrame | The first frame the section is shown. |
| flEndFrame | The frame the section is hidden again. |
| void Rnd::Arena::SetSectionTeleport | ( | int | nIndex, |
| int | nTeleport ) |
Set whether one section moves its view as the loop advances.
When the flag changes and the section has a view, the view's translation is moved by mLoop trips of mLoopDist, forward when the flag is being set and back when it is being cleared, and the view is marked dirty. The routine has no caller, and the title is inferred from the member it writes.
| nIndex | The section. |
| nTeleport | Non-zero to move the view with the loop. |
|
protectedvirtual |
Draw the section views in mDrawOrder.
Rnd::Drawable vtable slot 3. An entry whose view is null is skipped.
Reimplemented from Rnd::Drawable.
|
protectedvirtual |
Recompute the world transform, and then that of every showing section view.
Rnd::Transformable vtable slot 2. Runs the base implementation, and passes its result to each section view that is showing as that view's nForce, with this loop as its parent.
| pParent | The parent whose world transform this one composes with. |
| nForce | Non-zero to recompute even while the dirty flag is clear. |
Reimplemented from Rnd::Transformable.
|
protectedvirtual |
Test a ray against the loop and append what it strikes to sink.
Rnd::Collideable vtable slot 1. Forwards the ray to every section view that is showing.
| ray | The segment to test along. |
| collisions | The list to append intersections to. |
Reimplemented from Rnd::Collideable.
|
protectedvirtual |
Place every section and rebuild the draw order.
Rnd::Animatable vtable slot 3. Runs UpdateSection() on each section, which reads mFilteredFrame rather than flFrame. The entry of mDrawOrder at the same index takes the section view and a sort key of mFrame plus mLoop trips of mLoopFrames, less mDelta when mSortStart is set, and the list is then sorted.
| flFrame | The filtered frame, which the body does not read. |
Reimplemented from Rnd::Animatable.