resonance 1.0.1
Loading...
Searching...
No Matches
PlayMapRepeatRing Class Reference

Traversal that wraps and repeats a section of the sequence. More...

#include <playmaprepeatring.h>

Inheritance diagram for PlayMapRepeatRing:
Collaboration diagram for PlayMapRepeatRing:

Public Member Functions

 PlayMapRepeatRing ()
 Construct a map whose run holds one span from zero to the terminator.
virtual ~PlayMapRepeatRing ()
virtual void SetBarCount (int nBarCount)
 Stores the bar count, resets the spans, and pads the span run to match.
virtual void ResetSpans ()
 Resets mSpanStarts to a single empty span.
virtual int MapBar (int nBar)
 Maps the bar into one turn of the repeating ring.
virtual std::vector< int > & FindBarsPlaying (int nStart, int nMin, int nEnd)
 Collects every position between two bounds that plays the same step offset as a position.
virtual void CloseSpan (int nRepeats)
 Closes the last span and opens a new one.
virtual int EndLoop (int nBar)
 Close the open span a bar falls in after the number of passes that reaches the bar.
virtual int StartLoop (int nBar)
 Reopen the span a bar falls in by making it the last one.
virtual int ToggleLoop (int nBar)
 Toggle the span a bar falls in between open and closed.
virtual void AddUnlabeledStep (int nPosition)
 Append a step with an empty label, through PlayMap::AddStep() called directly.
Public Member Functions inherited from PlayMap
void * operator new (size_t nSize)
 Allocate a map from the tagged heap under the tag PlayMap.
void operator delete (void *pBlock)
 Release a map to the tagged heap under the tag PlayMap.
 PlayMap ()
 Construct an empty map whose first step is at zero.
virtual ~PlayMap ()
 Inline.
virtual void AddStep (int nPosition, HxStr strLabel)
 Slot 2.
virtual int MapToLinkedStep (int nPosition, int nSet)
 Slot 7.
virtual int GetLength () const
 Slot 8.
virtual int GetEndBar ()
 Slot 9.
virtual int GetNumSections () const
 Slot 10.
virtual int GetPatternSection (int nIndex)
 Slot 11.
virtual int GetPatternIndex (int nBar)
 Slot 12.
virtual int GetAbsoluteSectionIndex (int nBar)
 Slot 13.
virtual int IsLooping (int nBar)
 Slot 14.
int FindStepIndex (int nPosition)
 Report the index of the step at or before a position that has already been mapped.
int IsStepStart (int nBar)
 Report whether a bar maps exactly onto a step.
int StepStartBar (int nBar)
 Report the bar at which the step containing a bar began.
int NextStepBar (int nBar)
 Report the bar at which the first step at or after a bar begins.
int FollowingStepBar (int nBar)
 Report the bar at which the first step strictly after a bar begins.

Protected Member Functions

int SpanIndex (int nBar)
 Report the index of the span a bar falls in.

Protected Attributes

std::vector< int > mSpanStarts
Protected Attributes inherited from PlayMap
int mUnusedValue
std::vector< int > mFoundBars

Additional Inherited Members

Public Attributes inherited from PlayMap
int mBarCount
 The number of bars SetBarCount() stores.
std::vector< int > mSteps
 Ascending sequence of positions.
std::vector< int > mSectionLengths
 Length of each section, the gap between one step and the previous one.
std::vector< HxStr > mSectionNames
 Label of each section, the one AddStep() receives with the step.

Detailed Description

Traversal that wraps and repeats a section of the sequence.

PlayMapRepeatRing in the RTTI descriptor at 0x00901dc0, with PlayMap as its only base at offset 0. Its table runs twenty entries, one past the base's nineteen, and the entry it adds is slot 19. It overrides slots 1, 3 through 6, and 15.

The object is 0x48 bytes. One member of its own follows the base at +0x3c, a vector of four byte elements storing an ascending run of span starts terminated by the literal 10000000. SetBarCount(), ResetSpans(), and CloseSpan() all operate on it.

CloseSpan() reads the span vector and the base's gap vector together, indexing the gaps modulo their count. Reading a gap by a wrapped index is what the class name describes, and it is the clearest evidence recovered for what any of these three subclasses does.

Constructor & Destructor Documentation

◆ PlayMapRepeatRing()

PlayMapRepeatRing::PlayMapRepeatRing ( )

Construct a map whose run holds one span from zero to the terminator.

Runs the PlayMap constructor, reserves 32 elements in mSpanStarts, and appends 0 and then 10000000, the same state ResetSpans() resets it to.

Ghidra address:
NTSC-U/C: 0x0012b660
Ghidra address:
PAL: 0x0012bd98

◆ ~PlayMapRepeatRing()

virtual PlayMapRepeatRing::~PlayMapRepeatRing ( )
virtual
Ghidra address:
NTSC-U/C: 0x0012d1b8
Ghidra address:
PAL: 0x0012d900

Member Function Documentation

◆ SetBarCount()

virtual void PlayMapRepeatRing::SetBarCount ( int nBarCount)
virtual

Stores the bar count, resets the spans, and pads the span run to match.

The body calls the base directly rather than through the table, which is what a non-virtual-looking call to a known base compiles to, then dispatches ResetSpans() through the vptr, and this class's reset runs. It then searches mSteps for the value and appends -1 to mSpanStarts once for every element before the match. The run is then as long as the prefix the value falls at. A miss searches the whole of mSteps and pads by its full length.

Parameters
nBarCountThe value to store.
Ghidra address:
NTSC-U/C: 0x0012bb60
Ghidra address:
PAL: 0x0012c2a8

Reimplemented from PlayMap.

◆ ResetSpans()

virtual void PlayMapRepeatRing::ResetSpans ( )
virtual

Resets mSpanStarts to a single empty span.

The body clears the vector and appends 0 and then 10000000, so the class starts from one span covering everything up to that terminator. The zero-length move at the top is the inlined range erase that implements the clear.

Ghidra address:
NTSC-U/C: 0x0012ba88
Ghidra address:
PAL: 0x0012c1d0

Reimplemented from PlayMap.

◆ MapBar()

virtual int PlayMapRepeatRing::MapBar ( int nBar)
virtual

Maps the bar into one turn of the repeating ring.

The span the bar falls in selects a section by its index modulo the section count, and the result is that section's first step plus the bar's distance into the span, wrapped to the section's length.

Parameters
nBarThe bar to map.
Returns
The mapped position.
Ghidra address:
NTSC-U/C: 0x0012d500
Ghidra address:
PAL: 0x0012dc60

Implements PlayMap.

◆ FindBarsPlaying()

virtual std::vector< int > & PlayMapRepeatRing::FindBarsPlaying ( int nStart,
int nMin,
int nEnd )
virtual

Collects every position between two bounds that plays the same step offset as a position.

The walk starts at the span at or before nMin and stops at the first span that starts after nEnd, which the terminator guarantees. Within each span whose wrapped section matches the position's step, it steps by that section's length while below nEnd.

Parameters
nStartThe first position.
nMinThe lowest position to collect.
nEndThe position to stop below.
Returns
mFoundBars.
Ghidra address:
NTSC-U/C: 0x0012be68
Ghidra address:
PAL: 0x0012c5b0

Implements PlayMap.

◆ CloseSpan()

virtual void PlayMapRepeatRing::CloseSpan ( int nRepeats)
virtual

Closes the last span and opens a new one.

The body overwrites the last element of mSpanStarts with the second to last plus nRepeats times a gap from the base's gap vector, indexed by the second-to-last position modulo the gap count, then appends the 10000000 terminator again. Indexing the gaps by a wrapped index is the repeat in this class's name.

Parameters
nRepeatsThe multiplier applied to the wrapped gap.
Ghidra address:
NTSC-U/C: 0x0012bc48
Ghidra address:
PAL: 0x0012c390

Reimplemented from PlayMap.

◆ EndLoop()

virtual int PlayMapRepeatRing::EndLoop ( int nBar)
virtual

Close the open span a bar falls in after the number of passes that reaches the bar.

Parameters
nBarThe bar.
Returns
1 when the span after the bar's span was the terminator and has been closed, and 0 otherwise.
Ghidra address:
NTSC-U/C: 0x0012bd00
Ghidra address:
PAL: 0x0012c448

Reimplemented from PlayMap.

◆ StartLoop()

virtual int PlayMapRepeatRing::StartLoop ( int nBar)
virtual

Reopen the span a bar falls in by making it the last one.

The element after the bar's span becomes the terminator and the final element is dropped.

Parameters
nBarThe bar.
Returns
0 when the span was already open, and 1 otherwise.
Ghidra address:
NTSC-U/C: 0x0012bdd8
Ghidra address:
PAL: 0x0012c520

Reimplemented from PlayMap.

◆ ToggleLoop()

virtual int PlayMapRepeatRing::ToggleLoop ( int nBar)
virtual

Toggle the span a bar falls in between open and closed.

Parameters
nBarThe bar.
Returns
1 when a span was closed, and 0 otherwise.
Ghidra address:
NTSC-U/C: 0x0012d5d0
Ghidra address:
PAL: 0x0012dd30

Reimplemented from PlayMap.

◆ AddUnlabeledStep()

virtual void PlayMapRepeatRing::AddUnlabeledStep ( int nPosition)
virtual

Append a step with an empty label, through PlayMap::AddStep() called directly.

Slot 19.

Parameters
nPositionThe step position.
Ghidra address:
NTSC-U/C: 0x0012d4b0
Ghidra address:
PAL: 0x0012dc10

◆ SpanIndex()

int PlayMapRepeatRing::SpanIndex ( int nBar)
protected

Report the index of the span a bar falls in.

Inline. EndLoop() and StartLoop() expand it, and MapBar() calls the out-of-line copy at 0x0012d588.

Parameters
nBarThe bar.
Returns
The index of the last element of mSpanStarts at or before the bar.
Ghidra address:
NTSC-U/C: 0x0012d588
Ghidra address:
PAL: 0x0012dce8

Member Data Documentation

◆ mSpanStarts

std::vector<int> PlayMapRepeatRing::mSpanStarts
protected

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