wavelength 1.0.0
Loading...
Searching...
No Matches
catchtrackstate.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
6#include "game/gemcursor.h"
7#include "game/player.h"
8#include "game/playmap.h"
9
18public:
30
41 CatchTrackState(CatchTrackData *pData, int nNumBars, int nTicksPerBar, PlayMap *pPlayMap);
42
50
61 void SetWrittenCapturedBy(int nBar, Player *pPlayer);
62
74 void SetCapturedBy(int nStartBar, int nEndBar, Player *pPlayer);
75
85
95 void SetEnabled(int nStartBar, int nEndBar, bool bEnabled);
96
105 bool IsEnabled(int nBar);
106
115 bool IsBarEmpty(int nBar);
116
127 bool IsWrittenBarEmpty(int nBar);
128
139 void SetWrittenEnabled(int nBar, bool bEnabled);
140
149 int GetPowerup(int nBar);
150
161 void SetPowerup(int nBar, int nPowerup);
162
173 void SetWrittenPowerup(int nBar, int nPowerup);
174
183
193 GemCursor GetCursor(int nLane, int nTick);
194
204
213 void ClearBars(int nStartBar, int nEndBar);
214
223 return mData;
224 }
225
226private:
228 static constexpr int kAnyLane = -1;
229
242 GemCursor FindCursor(int nLane, int nTick) {
243 GemCursor cursor(mPlayMap, mData, nTick);
244 if ((nLane != kAnyLane) && cursor.IsValid() && (cursor.GetLane() != nLane)) {
245 cursor.AdvanceToLane(nLane);
246 }
247 return cursor;
248 }
249
258 void MarkGems();
259
260 PlayMap *mPlayMap;
261 CatchTrackData *mData;
262 int mNumBars;
263 int mTicksPerBar;
264 std::vector<BarState> mBars;
265};
The gems of one catch track, in the order of their ticks.
Definition catchtrackdata.h:14
void SetPowerup(int nBar, int nPowerup)
Set the power-up a bar awards when its phrase is caught.
bool IsEnabled(int nBar)
Report whether the gems of a bar can be caught.
void SetWrittenPowerup(int nBar, int nPowerup)
Set the power-up a bar awards when its phrase is caught.
void SetCapturedBy(int nStartBar, int nEndBar, Player *pPlayer)
Record the player who captured the phrases of a range of bars.
CatchTrackData * GetData() const
Report the gems of the track.
Definition catchtrackstate.h:222
void SetWrittenEnabled(int nBar, bool bEnabled)
Set whether the gems of a bar can be caught.
GemCursor GetCursor(int nTick)
Construct a cursor at the first gem of any lane at or after a tick.
void ClearBars(int nStartBar, int nEndBar)
Disable a range of bars and remove the gems the range has.
Player * GetCapturedBy(int nBar)
Report the player who captured the phrase of a bar.
void SetWrittenCapturedBy(int nBar, Player *pPlayer)
Record the player who captured the phrase of a bar.
void SetEnabled(int nStartBar, int nEndBar, bool bEnabled)
Set whether the gems of a range of bars can be caught.
GemCursor GetCursor(int nLane, int nTick)
Construct a cursor at the first gem of a lane at or after a tick.
bool IsBarEmpty(int nBar)
Report whether no gem of the track lies in a bar.
~CatchTrackState()
Release the state of the bars.
int GetPowerup(int nBar)
Report the power-up a bar awards when its phrase is caught.
GemCursor GetCursor()
Construct a cursor at the first gem of the track.
bool IsWrittenBarEmpty(int nBar)
Report whether no gem of the track lies in a bar.
CatchTrackState(CatchTrackData *pData, int nNumBars, int nTicksPerBar, PlayMap *pPlayMap)
Construct the state of every bar and mark the bars that have gems.
Position at one gem of a catch track, walked in the order the song plays the gems.
Definition gemcursor.h:14
Map from the bars a song plays to the bars of the song as written, with the loops that repeat stretch...
Definition playmap.h:11
One participant in a song: the track the participant plays, the score, and the streak.
Definition player.h:19
State of one bar of the song as written.
Definition catchtrackstate.h:24
Player * mCapturedBy
Definition catchtrackstate.h:25
int mHasGems
Definition catchtrackstate.h:27
int mPowerup
Definition catchtrackstate.h:28
int mEnabled
Definition catchtrackstate.h:26