resonance 1.0.1
Loading...
Searching...
No Matches
playmaplinear.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "game/playmap.h"
6
26class PlayMapLinear : public PlayMap {
27public:
39 explicit PlayMapLinear(int bLoadStepRings);
40
45 virtual ~PlayMapLinear();
46
58 virtual int MapBar(int nBar);
59
74 virtual std::vector<int> &FindBarsPlaying(int nStart, int nMin, int nEnd);
75
88 virtual int MapToLinkedStep(int nPosition, int nSet);
89
98 virtual int GetLength() const;
99
105 virtual int GetEndBar();
106
112 virtual int GetNumSections() const;
113
120 virtual int GetPatternSection(int nIndex);
121
130 virtual int GetPatternIndex(int nBar);
131
140 virtual int GetAbsoluteSectionIndex(int nBar);
141
148 virtual int IsLooping(int nBar);
149
161 virtual int EndLoop(int nBar);
162
171 virtual int StartLoop(int nBar);
172
181 virtual int ToggleLoop(int nBar);
182
191 virtual void RecordPattern();
192
202 virtual void AppendSection(int nSection);
203
214 static int SelfTest();
215
225 static int RunSelfTest();
226
227protected:
229 static constexpr int kSetCount = 8;
230
232 static constexpr int kRepeatForever = 10000;
233
235 struct Entry {
238 };
239
246 struct StepPair {
247 int mStep;
249 };
250
262
282 void GrowPastLimit(int nLimit);
283
296 int WindowIndex(int nBar);
297
306 void RestartFrom(std::vector<int>::size_type nFirst);
307
308 // The window, one entry per section played.
309 std::vector<Entry> mWindow; // +0x3c
310 // The start position of each window entry.
311 std::vector<int> mWindowStarts; // +0x48
312 // Running count of elements the trim has dropped from the front of the two vectors above.
313 int mTrimmedCount; // +0x54
314 // The pattern RecordPattern() records and GrowPastLimit() appends again.
315 std::vector<Entry> mPattern; // +0x58
316 // The window end RecordPattern() records.
317 int mPatternEnd; // +0x64
318 // One partner table per set.
319 std::vector<std::vector<StepPair> > mStepRings; // +0x68
320};
virtual int GetLength() const
Report the position at which the window ends.
std::vector< Entry > mPattern
Definition playmaplinear.h:315
int WindowIndex(int nBar)
Grow the window past a bar and report the index of the entry it falls in.
virtual void AppendSection(int nSection)
Slot 20.
virtual int MapBar(int nBar)
Map a bar to its offset within the base's steps.
void GrowPastLimit(int nLimit)
Advance the window until GetLength() passes the limit, then drop what it has passed.
virtual ~PlayMapLinear()
virtual int GetAbsoluteSectionIndex(int nBar)
Report the absolute index of the window entry a bar falls in.
int mTrimmedCount
Definition playmaplinear.h:313
virtual int MapToLinkedStep(int nPosition, int nSet)
Carry a position from its step to the partner step the table for one set records.
void RestartFrom(std::vector< int >::size_type nFirst)
Recompute the start of every window entry from an index onward.
virtual int GetPatternSection(int nIndex)
std::vector< int > mWindowStarts
Definition playmaplinear.h:311
virtual int GetPatternIndex(int nBar)
Report the index within the recorded pattern of the window entry a bar falls in.
static int RunSelfTest()
Run SelfTest() in the shape TestRegistry::TestFunc requires.
std::vector< std::vector< StepPair > > mStepRings
Definition playmaplinear.h:319
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 GetNumSections() const
virtual int StartLoop(int nBar)
Set the section a bar falls in looping forever, and move every later entry to follow it.
virtual int IsLooping(int nBar)
virtual int GetEndBar()
virtual int EndLoop(int nBar)
End the looping section at a bar.
PlayMapLinear(int bLoadStepRings)
Construct an empty linear map.
virtual void RecordPattern()
Record the sections appended so far as the pattern, and the window end with it.
static constexpr int kSetCount
The number of partner tables in mStepRings.
Definition playmaplinear.h:229
std::vector< Entry > mWindow
Definition playmaplinear.h:309
static constexpr int kRepeatForever
The repeat count that marks a section looping until EndLoop() ends it.
Definition playmaplinear.h:232
int mPatternEnd
Definition playmaplinear.h:317
static int SelfTest()
Exercise the map on four steps and seven sections.
void LoadStepRings()
Fill mStepRings from the script.
virtual int ToggleLoop(int nBar)
Toggle the loop on the section a bar falls in.
PlayMap()
Construct an empty map whose first step is at zero.
One section of the window, a step index paired with its repeat count.
Definition playmaplinear.h:235
int mRepeats
Definition playmaplinear.h:237
int mSection
Definition playmaplinear.h:236
One partner record, a step paired with the step MapToLinkedStep() moves it to.
Definition playmaplinear.h:246
int mStep
Definition playmaplinear.h:247
int mPartner
Definition playmaplinear.h:248