Allow TickcountSegments to have a value of 0.

This allows for more accuracy with simfiles.
This commit is contained in:
Jason Felds
2011-03-01 09:30:47 -05:00
parent 13ec2cc57b
commit fcc42c0e4d
4 changed files with 60 additions and 50 deletions
+5
View File
@@ -13,6 +13,11 @@ _____________________________________________________________________________
sm-ssc v1.2.3 | 2011022? sm-ssc v1.2.3 | 2011022?
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
20110301
--------
* Allow Tickcount Segments to have a value of 0 to better replicate some
charts in the Pump series. [Wolfman2000]
20110228 20110228
-------- --------
* Add Fakes to the RadarCategories. [Wolfman2000] * Add Fakes to the RadarCategories. [Wolfman2000]
+53 -48
View File
@@ -2782,7 +2782,9 @@ void Player::CrossedRows( int iLastRowCrossed, const RageTimer &now )
int iCheckpointFrequencyRows = ROWS_PER_BEAT/2; int iCheckpointFrequencyRows = ROWS_PER_BEAT/2;
if( CHECKPOINTS_USE_TICKCOUNTS ) if( CHECKPOINTS_USE_TICKCOUNTS )
{ {
iCheckpointFrequencyRows = ROWS_PER_BEAT / GAMESTATE->m_pCurSong->m_Timing.GetTickcountAtRow( iLastRowCrossed ); int tickCurrent = GAMESTATE->m_pCurSong->m_Timing.GetTickcountAtRow( iLastRowCrossed );
// There are some charts that don't want tickcounts involved at all.
iCheckpointFrequencyRows = (tickCurrent > 0 ? ROWS_PER_BEAT / tickCurrent : 0);
} }
else if( CHECKPOINTS_USE_TIME_SIGNATURES ) else if( CHECKPOINTS_USE_TIME_SIGNATURES )
{ {
@@ -2792,59 +2794,62 @@ void Player::CrossedRows( int iLastRowCrossed, const RageTimer &now )
iCheckpointFrequencyRows = ROWS_PER_BEAT * tSignature.m_iDenominator / (tSignature.m_iNumerator * 4); iCheckpointFrequencyRows = ROWS_PER_BEAT * tSignature.m_iDenominator / (tSignature.m_iNumerator * 4);
} }
// "the first row after the start of the range that lands on a beat" if( iCheckpointFrequencyRows > 0 )
int iFirstCheckpointInRange = ((m_iFirstUncrossedRow+iCheckpointFrequencyRows-1)/iCheckpointFrequencyRows) * iCheckpointFrequencyRows;
// "the last row or first row earlier that lands on a beat"
int iLastCheckpointInRange = ((iLastRowCrossed)/iCheckpointFrequencyRows) * iCheckpointFrequencyRows;
for( int r = iFirstCheckpointInRange; r <= iLastCheckpointInRange; r += iCheckpointFrequencyRows )
{ {
//LOG->Trace( "%d...", r ); // "the first row after the start of the range that lands on a beat"
vector<int> viColsWithHold; int iFirstCheckpointInRange = ((m_iFirstUncrossedRow+iCheckpointFrequencyRows-1)/iCheckpointFrequencyRows) * iCheckpointFrequencyRows;
int iNumHoldsHeldThisRow = 0;
int iNumHoldsMissedThisRow = 0;
// start at r-1 so that we consider holds whose end rows are equal to the checkpoint row // "the last row or first row earlier that lands on a beat"
NoteData::all_tracks_iterator iter = m_NoteData.GetTapNoteRangeAllTracks( r-1, r, true ); int iLastCheckpointInRange = ((iLastRowCrossed)/iCheckpointFrequencyRows) * iCheckpointFrequencyRows;
for( ; !iter.IsAtEnd(); ++iter )
for( int r = iFirstCheckpointInRange; r <= iLastCheckpointInRange; r += iCheckpointFrequencyRows )
{ {
TapNote &tn = *iter; //LOG->Trace( "%d...", r );
if( tn.type != TapNote::hold_head ) vector<int> viColsWithHold;
continue; int iNumHoldsHeldThisRow = 0;
int iNumHoldsMissedThisRow = 0;
int iStartRow = iter.Row(); // start at r-1 so that we consider holds whose end rows are equal to the checkpoint row
int iEndRow = iStartRow + tn.iDuration; NoteData::all_tracks_iterator iter = m_NoteData.GetTapNoteRangeAllTracks( r-1, r, true );
int iTrack = iter.Track(); for( ; !iter.IsAtEnd(); ++iter )
// "the first row after the hold head that lands on a beat"
int iFirstCheckpointOfHold = ((iStartRow+iCheckpointFrequencyRows)/iCheckpointFrequencyRows) * iCheckpointFrequencyRows;
// "the end row or the first earlier row that lands on a beat"
int iLastCheckpointOfHold = ((iEndRow)/iCheckpointFrequencyRows) * iCheckpointFrequencyRows;
// count the end of the hold as a checkpoint
bool bHoldOverlapsRow = iFirstCheckpointOfHold <= r && r <= iLastCheckpointOfHold;
if( !bHoldOverlapsRow )
continue;
viColsWithHold.push_back( iTrack );
if( tn.HoldResult.fLife > 0 )
{ {
++iNumHoldsHeldThisRow; TapNote &tn = *iter;
++tn.HoldResult.iCheckpointsHit; if( tn.type != TapNote::hold_head )
} continue;
else
{
++iNumHoldsMissedThisRow;
++tn.HoldResult.iCheckpointsMissed;
}
}
// TODO: Find a better way of handling hold checkpoints with other taps. int iStartRow = iter.Row();
if( !viColsWithHold.empty() && ( CHECKPOINTS_TAPS_SEPARATE_JUDGMENT || m_NoteData.GetNumTapNotesInRow( iLastRowCrossed ) == 0 ) ) int iEndRow = iStartRow + tn.iDuration;
{ int iTrack = iter.Track();
HandleHoldCheckpoint( r, iNumHoldsHeldThisRow, iNumHoldsMissedThisRow, viColsWithHold );
// "the first row after the hold head that lands on a beat"
int iFirstCheckpointOfHold = ((iStartRow+iCheckpointFrequencyRows)/iCheckpointFrequencyRows) * iCheckpointFrequencyRows;
// "the end row or the first earlier row that lands on a beat"
int iLastCheckpointOfHold = ((iEndRow)/iCheckpointFrequencyRows) * iCheckpointFrequencyRows;
// count the end of the hold as a checkpoint
bool bHoldOverlapsRow = iFirstCheckpointOfHold <= r && r <= iLastCheckpointOfHold;
if( !bHoldOverlapsRow )
continue;
viColsWithHold.push_back( iTrack );
if( tn.HoldResult.fLife > 0 )
{
++iNumHoldsHeldThisRow;
++tn.HoldResult.iCheckpointsHit;
}
else
{
++iNumHoldsMissedThisRow;
++tn.HoldResult.iCheckpointsMissed;
}
}
// TODO: Find a better way of handling hold checkpoints with other taps.
if( !viColsWithHold.empty() && ( CHECKPOINTS_TAPS_SEPARATE_JUDGMENT || m_NoteData.GetNumTapNotesInRow( iLastRowCrossed ) == 0 ) )
{
HandleHoldCheckpoint( r, iNumHoldsHeldThisRow, iNumHoldsMissedThisRow, viColsWithHold );
}
} }
} }
} }
+1 -1
View File
@@ -2644,7 +2644,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
else if ( SM == SM_BackFromTickcountChange ) else if ( SM == SM_BackFromTickcountChange )
{ {
int iTick = atoi( ScreenTextEntry::s_sLastAnswer ); int iTick = atoi( ScreenTextEntry::s_sLastAnswer );
if ( iTick >= 1 && iTick <= ROWS_PER_BEAT ) if ( iTick >= 0 && iTick <= ROWS_PER_BEAT )
{ {
m_pSong->m_Timing.SetTickcountAtBeat( GAMESTATE->m_fSongBeat, iTick ); m_pSong->m_Timing.SetTickcountAtBeat( GAMESTATE->m_fSongBeat, iTick );
} }
+1 -1
View File
@@ -421,7 +421,7 @@ struct TickcountSegment
* @param s the starting row of this segment. * @param s the starting row of this segment.
* @param t the amount of ticks counted per beat. * @param t the amount of ticks counted per beat.
*/ */
TickcountSegment( int s, int t ){ m_iStartRow = max( 0, s ); m_iTicks = max( 1, t ); } TickcountSegment( int s, int t ){ m_iStartRow = max( 0, s ); m_iTicks = max( 0, t ); }
/** /**
* @brief The row in which the TickcountSegment activates. * @brief The row in which the TickcountSegment activates.
*/ */