|
resonance 1.0.1
|
Traversal that runs the sequence once from start to end, repeating each section a set number of times. More...
#include <playmaplinear.h>


Classes | |
| struct | Entry |
| One section of the window, a step index paired with its repeat count. More... | |
| struct | StepPair |
| One partner record, a step paired with the step MapToLinkedStep() moves it to. More... | |
Public Member Functions | |
| PlayMapLinear (int bLoadStepRings) | |
| Construct an empty linear map. | |
| virtual | ~PlayMapLinear () |
| virtual int | MapBar (int nBar) |
| Map a bar to its offset within the base's steps. | |
| virtual std::vector< int > & | FindBarsPlaying (int nStart, int nMin, int nEnd) |
| Collect every position between two bounds that plays the same step offset as a position. | |
| virtual int | MapToLinkedStep (int nPosition, int nSet) |
| Carry a position from its step to the partner step the table for one set records. | |
| virtual int | GetLength () const |
| Report the position at which the window ends. | |
| virtual int | GetEndBar () |
| virtual int | GetNumSections () const |
| virtual int | GetPatternSection (int nIndex) |
| virtual int | GetPatternIndex (int nBar) |
| Report the index within the recorded pattern of the window entry a bar falls in. | |
| virtual int | GetAbsoluteSectionIndex (int nBar) |
| Report the absolute index of the window entry a bar falls in. | |
| virtual int | IsLooping (int nBar) |
| virtual int | EndLoop (int nBar) |
| End the looping section at a bar. | |
| virtual int | StartLoop (int nBar) |
| Set the section a bar falls in looping forever, and move every later entry to follow it. | |
| virtual int | ToggleLoop (int nBar) |
| Toggle the loop on the section a bar falls in. | |
| virtual void | RecordPattern () |
| Record the sections appended so far as the pattern, and the window end with it. | |
| virtual void | AppendSection (int nSection) |
| Slot 20. | |
| 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 void | SetBarCount (int nBarCount) |
| Slot 3. | |
| virtual void | ResetSpans () |
| Slot 4. | |
| virtual void | CloseSpan (int nRepeats) |
| Slot 15. | |
| 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. | |
Static Public Member Functions | |
| static int | SelfTest () |
| Exercise the map on four steps and seven sections. | |
| static int | RunSelfTest () |
| Run SelfTest() in the shape TestRegistry::TestFunc requires. | |
Protected Member Functions | |
| void | LoadStepRings () |
| Fill mStepRings from the script. | |
| void | GrowPastLimit (int nLimit) |
| Advance the window until GetLength() passes the limit, then drop what it has passed. | |
| int | WindowIndex (int nBar) |
| Grow the window past a bar and report the index of the entry it falls in. | |
| void | RestartFrom (std::vector< int >::size_type nFirst) |
| Recompute the start of every window entry from an index onward. | |
Protected Attributes | |
| std::vector< Entry > | mWindow |
| std::vector< int > | mWindowStarts |
| int | mTrimmedCount |
| std::vector< Entry > | mPattern |
| int | mPatternEnd |
| std::vector< std::vector< StepPair > > | mStepRings |
| Protected Attributes inherited from PlayMap | |
| int | mUnusedValue |
| std::vector< int > | mFoundBars |
Static Protected Attributes | |
| static constexpr int | kSetCount = 8 |
| The number of partner tables in mStepRings. | |
| static constexpr int | kRepeatForever = 10000 |
| The repeat count that marks a section looping until EndLoop() ends it. | |
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. | |
Traversal that runs the sequence once from start to end, repeating each section a set number of times.
PlayMapLinear in the RTTI descriptor at 0x008f2a20, with PlayMap as its only base at offset 0. It overrides the widest set of the three subclasses, slots 1, 5 through 14, and 16 through 19, and supplies slot 20, which no other subclass does.
The object is 0x74 bytes, which the tagged allocation in the LevelBuilder constructor at 0x001ea8f0 measures. Its own members follow the base at +0x3c.
The map plays a list of sections, each an index into the base's steps paired with a repeat count. AppendSection() appends one section, and RecordPattern() records the list as the pattern GrowPastLimit() appends again whenever a position runs past the end. A repeat count of kRepeatForever marks a section that loops until EndLoop() ends it at a bar, and StartLoop() sets a section looping again.
The unit registers SelfTest() with TestRegistry under the name PlayMapLinear.
|
explicit |
Construct an empty linear map.
Runs the PlayMap constructor, sizes mStepRings to kSetCount empty tables, and reserves eight elements in mWindow and mWindowStarts. A non-zero bLoadStepRings then runs LoadStepRings(). LevelBuilder's constructor passes 1, and SelfTest() passes 0.
| bLoadStepRings | Whether to fill the partner tables from the script. |
|
virtual |
|
virtual |
Map a bar to its offset within the base's steps.
Finds the window entry the bar falls in and returns that section's first step plus the bar's distance into the entry, wrapped to the section's length.
| nBar | The bar to map. |
Implements PlayMap.
|
virtual |
Collect every position between two bounds that plays the same step offset as a position.
The walk starts at the window entry at or before nMin and runs until an entry starts at or after nEnd. It does not test for the end of the window, and relies on GrowPastLimit() having grown the window past nEnd.
| nStart | The position whose section and offset are matched. |
| nMin | The lowest position to collect. |
| nEnd | The position to stop below. |
Implements PlayMap.
|
virtual |
Carry a position from its step to the partner step the table for one set records.
The position's step comes from PlayMap::FindStepIndex(). Without a record for that step in mStepRings[nSet] the position comes back unchanged.
| nPosition | The position to map. |
| nSet | The index into mStepRings. |
Reimplemented from PlayMap.
|
virtual |
Report the position at which the window ends.
Reimplemented from PlayMap.
|
virtual |
Reimplemented from PlayMap.
|
virtual |
Reimplemented from PlayMap.
|
virtual |
| nIndex | The index into the recorded pattern. |
Reimplemented from PlayMap.
|
virtual |
Report the index within the recorded pattern of the window entry a bar falls in.
| nBar | The bar. |
Reimplemented from PlayMap.
|
virtual |
Report the absolute index of the window entry a bar falls in.
| nBar | The bar. |
Reimplemented from PlayMap.
|
virtual |
| nBar | The bar. |
Reimplemented from PlayMap.
|
virtual |
End the looping section at a bar.
When the window entry the bar falls in repeats forever, its repeat count becomes the number of whole passes up to and including the bar, and every later entry is moved to follow it.
| nBar | The bar. |
Reimplemented from PlayMap.
|
virtual |
Set the section a bar falls in looping forever, and move every later entry to follow it.
| nBar | The bar. |
Reimplemented from PlayMap.
|
virtual |
Toggle the loop on the section a bar falls in.
| nBar | The bar. |
Reimplemented from PlayMap.
|
virtual |
Record the sections appended so far as the pattern, and the window end with it.
Slot 19.
|
virtual |
Slot 20.
Append one section, played once, at the end of the window.
LevelBuilder's constructor calls it once per value of configuration code 0x39d.
| nSection | The index of the section's first step. |
|
static |
Exercise the map on four steps and seven sections.
The routine maps seven positions and toggles two loops, and discards every result. Nothing in the shipped game calls it apart from the test registry.
|
static |
Run SelfTest() in the shape TestRegistry::TestFunc requires.
The unit's static initialiser registers it. The integer result reaches the hx.test command through the return register, which decides its ok report.
|
protected |
Fill mStepRings from the script.
Each of the kSetCount tables evaluates the script template 0x3a3 through EvalScriptTemplate() with its index, which yields a sequence of step rings. Each ring pairs every step with the one after it, and the last with the first. A step is read through Py::Int.
|
protected |
Advance the window until GetLength() passes the limit, then drop what it has passed.
Every one of MapBar(), FindBarsPlaying(), GetPatternIndex(), GetAbsoluteSectionIndex(), IsLooping(), EndLoop(), and StartLoop() calls it with its own argument before doing anything else. The growth half appends one start to mWindowStarts from the result of GetLength() and one Entry to mWindow per section of the pattern. The test is at the top of the loop, and the body can run zero times. GetLength() is dispatched through the table rather than called directly.
The trim half drops as many leading elements from mWindow and mWindowStarts as the pattern has, and adds that count to mTrimmedCount. Its guard compares a byte offset against an element count. The trim therefore fires only once mWindow is more than eight times the length of the pattern.
| nLimit | The value GetLength() must exceed for the growth to stop. |
|
protected |
Grow the window past a bar and report the index of the entry it falls in.
Inline. GetPatternIndex(), GetAbsoluteSectionIndex(), IsLooping(), EndLoop(), and StartLoop() expand it, and MapBar() and SelfTest() call the out-of-line copy at 0x0012ade8.
| nBar | The bar. |
|
protected |
Recompute the start of every window entry from an index onward.
Inline, and expanded in EndLoop() and StartLoop(). Each start is the previous start plus the previous section's length times its repeat count.
| nFirst | The first index to recompute. |
|
staticconstexprprotected |
The number of partner tables in mStepRings.
|
staticconstexprprotected |
The repeat count that marks a section looping until EndLoop() ends it.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |