Skip to content

Commit

Permalink
Fix mine bug
Browse files Browse the repository at this point in the history
This is a bug where you can avoid pressing/holding a mine and then attempt to press a note that comes immediately after a mine. Doing so causes the game to try to score the mine, but gives you a miss because it is either not able to be judged or you are not required to step on mines directly.
This change makes the search used by Step() ignore mines that have been passed and just return the next upcoming tap (or mine)
  • Loading branch information
poco0317 committed Sep 30, 2019
1 parent 11b81cf commit b3c8501
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
17 changes: 15 additions & 2 deletions src/Etterna/Actor/Gameplay/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,8 @@ Player::GetClosestNote(int col,
int iNoteRow,
int iMaxRowsAhead,
int iMaxRowsBehind,
bool bAllowGraded) const
bool bAllowGraded,
bool bAllowOldMines) const
{
// Start at iIndexStartLookingAt and search outward.
int iNextIndex = GetClosestNoteDirectional(
Expand All @@ -1677,6 +1678,18 @@ Player::GetClosestNote(int col,
float fNextTime = m_Timing->WhereUAtBro(iNextIndex);
float fPrevTime = m_Timing->WhereUAtBro(iPrevIndex);

// If we passed a mine, we can't hit it anymore. Literally.
// So forget about them.
// RIP Minebug 20xx - 2019
if (!bAllowOldMines) {
TapNote* pTN = NULL;
NoteData::iterator iter = m_NoteData.FindTapNote(col, iPrevIndex);
DEBUG_ASSERT(iter != m_NoteData.end(col));
pTN = &iter->second;
if (pTN->type == TapNoteType_Mine)
return iNextIndex;
}

/* Figure out which row is closer. */
if (fabsf(fNoteTime - fNextTime) > fabsf(fNoteTime - fPrevTime))
return iPrevIndex;
Expand Down Expand Up @@ -2044,7 +2057,7 @@ Player::Step(int col,
int iRowOfOverlappingNoteOrRow = row;
if (row == -1)
iRowOfOverlappingNoteOrRow = GetClosestNote(
col, iSongRow, iStepSearchRows, iStepSearchRows, false);
col, iSongRow, iStepSearchRows, iStepSearchRows, false, false);

if (iRowOfOverlappingNoteOrRow != -1) {
// compute the score for this hit
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 @@ -221,7 +221,8 @@ class Player : public ActorFrame
int iNoteRow,
int iMaxRowsAhead,
int iMaxRowsBehind,
bool bAllowGraded) const;
bool bAllowGraded,
bool bAllowOldMines = true) const;
int GetClosestNonEmptyRowDirectional(int iStartRow,
int iMaxRowsAhead,
bool bAllowGraded,
Expand Down

0 comments on commit b3c8501

Please sign in to comment.