Skip to content

Commit

Permalink
Specify and document new PlayerAI functions
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Nov 15, 2018
1 parent 2003f69 commit f63ea82
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/PlayerAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static TapScoreDistribution g_Distributions[NUM_SKILL_LEVELS];
HighScore* PlayerAI::pScoreData = nullptr;
map<int, vector<TapReplayResult>> PlayerAI::m_ReplayTapMap;
map<int, vector<HoldReplayResult>> PlayerAI::m_ReplayHoldMap;
map<int, vector<TapReplayResult>> PlayerAI::m_ReplayExactTapMap;

void
PlayerAI::InitFromDisk()
Expand Down Expand Up @@ -157,6 +158,8 @@ PlayerAI::SetScoreData(HighScore* pHighScore)
pScoreData = pHighScore;
m_ReplayTapMap.clear();
m_ReplayHoldMap.clear();
m_ReplayExactTapMap.clear();

auto replayNoteRowVector = pHighScore->GetCopyOfNoteRowVector();
auto replayOffsetVector = pHighScore->GetCopyOfOffsetVector();
auto replayTapNoteTypeVector = pHighScore->GetCopyOfTapNoteTypeVector();
Expand Down
26 changes: 26 additions & 0 deletions src/PlayerAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ class PlayerAI
// A map with indices for each row of the chart, pointing to nothing or hold
// drop results.
static map<int, vector<HoldReplayResult>> m_ReplayHoldMap;
// A map with indices for each row of the chart, pointing to nothing or a
// Normal Result. However, note that the rows within are actually calculated
// so that they are adjusted for offsets relative to the actual replay data/notedata.
// This map is only useful for charts with column data.
static map<int, vector<TapReplayResult>> m_ReplayExactTapMap;

static void InitFromDisk();
static TapNoteScore GetTapNoteScore(const PlayerState* pPlayerState);
Expand All @@ -35,6 +40,27 @@ class PlayerAI
const PlayerState* pPlayerState,
float fNoteOffset);
static bool DetermineIfHoldDropped(int noteRow, int col);
// Returns the column that needs to be tapped.
// Returns -1 if no column needs to be tapped.
static int DetermineNextTapColumn(int noteRow, int searchRowDistance, TimingData* timing);
// Literally get the next row in the replay data. Disregard offset calculations.
static int GetNextRowNoOffsets(int currentRow);
// Reset and populate the ReplayExactTapMap.
// This is meant to be run once Gameplay begins.
static void SetUpExactTapMap(TimingData* timing);
// Check the Tap Replay Data to see if a tap is on this row
static bool TapExistsAtThisRow(int noteRow);
static bool TapExistsAtOrBeforeThisRow(int noteRow);
// Build a list of columns/tracks to tap based on the given noterow.
static vector<TapReplayResult> GetTapsToTapForRow(int noteRow);
static int GetReplayType();
// Build a list of columns/tracks that happened at or before the given noterow.
// (if we lag and somehow skip rows)
static vector<TapReplayResult> GetTapsAtOrBeforeRow(int noteRow);
// Given a column and row, retrieve the adjusted row.
static int GetAdjustedRowFromUnadjustedCoordinates(int row, int col);
// Remove a given Tap from the fallback and Full replay data vectors
static void RemoveTapFromVectors(int row, int col);
};

#endif
Expand Down

0 comments on commit f63ea82

Please sign in to comment.