Simplify checks for unjudgable rows.

This way, we can add more segments later
and now have to change the logic in many places.
This commit is contained in:
Jason Felds
2011-06-08 13:03:07 -04:00
parent 4b11968abc
commit 5216d6be45
3 changed files with 22 additions and 8 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ void GameplayAssist::PlayTicks( const NoteData &nd, const PlayerState *ps )
if( nd.IsThereATapOrHoldHeadAtRow( r ) ) if( nd.IsThereATapOrHoldHeadAtRow( r ) )
iClapRow = r; iClapRow = r;
if( iClapRow != -1 && !timing.IsWarpAtRow( iClapRow ) && !timing.IsFakeAtRow( iClapRow ) ) if( iClapRow != -1 && timing.IsJudgableAtRow(iClapRow))
{ {
const float fTickBeat = NoteRowToBeat( iClapRow ); const float fTickBeat = NoteRowToBeat( iClapRow );
const float fTickSecond = timing.GetElapsedTimeFromBeatNoOffset( fTickBeat ); const float fTickSecond = timing.GetElapsedTimeFromBeatNoOffset( fTickBeat );
+7 -7
View File
@@ -1538,7 +1538,7 @@ int Player::GetClosestNoteDirectional( int col, int iStartRow, int iEndRow, bool
// Is this the row we want? // Is this the row we want?
do { do {
const TapNote &tn = begin->second; const TapNote &tn = begin->second;
if( m_Timing->IsWarpAtRow( begin->first ) || m_Timing->IsFakeAtRow( begin->first ) ) if (!m_Timing->IsJudgableAtRow( begin->first ))
break; break;
if( tn.type == TapNote::empty ) if( tn.type == TapNote::empty )
break; break;
@@ -1594,7 +1594,7 @@ int Player::GetClosestNonEmptyRowDirectional( int iStartRow, int iEndRow, bool b
++iter; ++iter;
continue; continue;
} }
if( m_Timing->IsWarpAtRow( iter.Row() ) || m_Timing->IsFakeAtRow( iter.Row() ) ) if (!m_Timing->IsJudgableAtRow(iter.Row()))
{ {
++iter; ++iter;
continue; continue;
@@ -2118,7 +2118,7 @@ void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, b
// Stepped too close to mine? // Stepped too close to mine?
if( !bRelease && ( REQUIRE_STEP_ON_MINES == !bHeld ) && if( !bRelease && ( REQUIRE_STEP_ON_MINES == !bHeld ) &&
fSecondsFromExact <= GetWindowSeconds(TW_Mine) && fSecondsFromExact <= GetWindowSeconds(TW_Mine) &&
!m_Timing->IsWarpAtRow(iSongRow) && !m_Timing->IsFakeAtRow(iSongRow)) m_Timing->IsJudgableAtRow(iSongRow))
score = TNS_HitMine; score = TNS_HitMine;
break; break;
@@ -2616,7 +2616,7 @@ void Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
continue; continue;
// Ignore all notes in WarpSegments or FakeSegments. // Ignore all notes in WarpSegments or FakeSegments.
if( m_Timing->IsWarpAtRow( iter.Row() ) || m_Timing->IsFakeAtRow( iter.Row() ) ) if (!m_Timing->IsJudgableAtRow(iter.Row()))
continue; continue;
if( tn.type == TapNote::mine ) if( tn.type == TapNote::mine )
@@ -2651,7 +2651,7 @@ void Player::UpdateJudgedRows()
int iRow = iter.Row(); int iRow = iter.Row();
// Do not judge arrows in WarpSegments or FakeSegments // Do not judge arrows in WarpSegments or FakeSegments
if( m_Timing->IsWarpAtRow(iRow) || m_Timing->IsFakeAtRow(iRow) ) if (!m_Timing->IsJudgableAtRow(iRow))
continue; continue;
if( iLastSeenRow != iRow ) if( iLastSeenRow != iRow )
@@ -2990,7 +2990,7 @@ void Player::HandleTapRowScore( unsigned row )
#endif #endif
// Do not score rows in WarpSegments or FakeSegments // Do not score rows in WarpSegments or FakeSegments
if( m_Timing->IsWarpAtRow( row ) || m_Timing->IsFakeAtRow( row ) ) if (!m_Timing->IsJudgableAtRow(row))
return; return;
if( GAMESTATE->m_bDemonstrationOrJukebox ) if( GAMESTATE->m_bDemonstrationOrJukebox )
@@ -3094,7 +3094,7 @@ void Player::HandleHoldCheckpoint( int iRow, int iNumHoldsHeldThisRow, int iNumH
#endif #endif
// WarpSegments and FakeSegments aren't judged in any way. // WarpSegments and FakeSegments aren't judged in any way.
if( m_Timing->IsWarpAtRow( iRow ) || m_Timing->IsFakeAtRow( iRow ) ) if (!m_Timing->IsJudgableAtRow(iRow))
return; return;
// don't accumulate combo if AutoPlay is on. // don't accumulate combo if AutoPlay is on.
+14
View File
@@ -845,6 +845,20 @@ public:
*/ */
void AddFakeSegment( const FakeSegment &seg ); void AddFakeSegment( const FakeSegment &seg );
/**
* @brief Determine if this notes on this row can be judged.
* @param row the row to focus on.
* @return true if the row can be judged, false otherwise. */
bool IsJudgableAtRow( int row ) const
{
return !(IsWarpAtRow(row) && IsFakeAtRow(row));
}
/**
* @brief Determine if this notes on this beat can be judged.
* @param beat the beat to focus on.
* @return true if the row can be judged, false otherwise. */
bool IsJudgableAtBeat( float beat ) const { return IsJudgableAtRow( BeatToNoteRow( beat ) ); }
void MultiplyBPMInBeatRange( int iStartIndex, int iEndIndex, float fFactor ); void MultiplyBPMInBeatRange( int iStartIndex, int iEndIndex, float fFactor );