Skip to content

Commit

Permalink
replay rewrite wip - supports v1, v2, input data (exceptions)
Browse files Browse the repository at this point in the history
not finished - note types and holds not yet factored in.
online replays not supported.
v0 scuffed replays not supported.
fixed an issue where backing out of replays resets all player options.
  • Loading branch information
poco0317 committed Sep 3, 2022
1 parent ad59f11 commit 480b5fd
Show file tree
Hide file tree
Showing 14 changed files with 480 additions and 225 deletions.
9 changes: 6 additions & 3 deletions src/Etterna/Actor/Gameplay/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1611,13 +1611,14 @@ Player::GetClosestNoteDirectional(int col,
return -1;
}

// Find the closest note to fBeat.
// Find the closest note to a row or the song position.
auto
Player::GetClosestNote(int col,
int iNoteRow,
int iMaxRowsAhead,
int iMaxRowsBehind,
bool bAllowGraded,
bool bUseSongTiming,
bool bAllowOldMines) const -> int
{
// Start at iIndexStartLookingAt and search outward.
Expand All @@ -1637,7 +1638,9 @@ Player::GetClosestNote(int col,
}

// Get the current time, previous time, and next time.
const auto fNoteTime = GAMESTATE->m_Position.m_fMusicSeconds;
const auto fNoteTime = bUseSongTiming
? GAMESTATE->m_Position.m_fMusicSeconds
: m_Timing->WhereUAtBro(iNoteRow);
const auto fNextTime = m_Timing->WhereUAtBro(iNextIndex);
const auto fPrevTime = m_Timing->WhereUAtBro(iPrevIndex);

Expand Down Expand Up @@ -2035,7 +2038,7 @@ Player::Step(int col,
auto iRowOfOverlappingNoteOrRow = row;
if (row == -1 && col != -1) {
iRowOfOverlappingNoteOrRow = GetClosestNote(
col, iSongRow, iStepSearchRows, iStepSearchRows, false, false);
col, iSongRow, iStepSearchRows, iStepSearchRows, false, true, false);
}

if (iRowOfOverlappingNoteOrRow != -1 && col != -1) {
Expand Down
3 changes: 2 additions & 1 deletion src/Etterna/Actor/Gameplay/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class Player : public ActorFrame
void UpdateVisibleParts();
// Updates the pressed flags depending on input
// Tells the NoteField to do stuff basically
void UpdatePressedFlags();
virtual void UpdatePressedFlags();
// Updates Holds and Rolls
// For Rolls, just tells Autoplay to restep them
// For Holds, tells their life to decay
Expand Down Expand Up @@ -227,6 +227,7 @@ class Player : public ActorFrame
int iMaxRowsAhead,
int iMaxRowsBehind,
bool bAllowGraded,
bool bUseSongTiming = true,
bool bAllowOldMines = true) const -> int;
auto GetClosestNonEmptyRowDirectional(int iStartRow,
int iEndRow,
Expand Down
Loading

0 comments on commit 480b5fd

Please sign in to comment.