fix TapNotes being given TNS_Miss after they were already judged (also caused non-checkpoint HoldNotes to LetGo)

fix HoldNotes never receive judgment because out of range ones were not being passed to UpdateHoldNotes.
This commit is contained in:
Chris Danford
2007-09-17 00:03:43 +00:00
parent ab240c3fbc
commit 215fd9f2ad
4 changed files with 56 additions and 65 deletions
-15
View File
@@ -1014,21 +1014,6 @@ NoteData::_all_tracks_iterator<ND, iter, TN>::_all_tracks_iterator( const _all_t
{ {
} }
template<typename ND, typename iter, typename TN>
NoteData::_all_tracks_iterator<ND, iter, TN> &NoteData::_all_tracks_iterator<ND, iter, TN>::operator=( const _all_tracks_iterator &other )
{
#define COPY_OTHER( x ) x = other.x
COPY_OTHER( m_pNoteData );
COPY_OTHER( m_iTrack );
COPY_OTHER( m_bReverse );
COPY_OTHER( m_Cond );
COPY_OTHER( m_vBeginIters );
COPY_OTHER( m_vEndIters );
COPY_OTHER( m_vCurrentIters );
#undef COPY_OTHER
return *this;
}
template<typename ND, typename iter, typename TN> template<typename ND, typename iter, typename TN>
NoteData::_all_tracks_iterator<ND, iter, TN> &NoteData::_all_tracks_iterator<ND, iter, TN>::operator++() // preincrement NoteData::_all_tracks_iterator<ND, iter, TN> &NoteData::_all_tracks_iterator<ND, iter, TN>::operator++() // preincrement
{ {
-1
View File
@@ -64,7 +64,6 @@ public:
public: public:
_all_tracks_iterator( ND &nd, int iStartRow, int iEndRow, bool bReverse, IteratorCond cond, bool bInclusive ); _all_tracks_iterator( ND &nd, int iStartRow, int iEndRow, bool bReverse, IteratorCond cond, bool bInclusive );
_all_tracks_iterator( const _all_tracks_iterator &other ); _all_tracks_iterator( const _all_tracks_iterator &other );
_all_tracks_iterator &operator=( const _all_tracks_iterator &other );
_all_tracks_iterator &operator++(); // preincrement _all_tracks_iterator &operator++(); // preincrement
_all_tracks_iterator operator++( int dummy ); // postincrement _all_tracks_iterator operator++( int dummy ); // postincrement
//_all_tracks_iterator &operator--(); // predecrement //_all_tracks_iterator &operator--(); // predecrement
+52 -45
View File
@@ -157,8 +157,8 @@ Player::Player( NoteData &nd, bool bVisibleParts ) : m_NoteData(nd)
m_pPrimaryScoreKeeper = NULL; m_pPrimaryScoreKeeper = NULL;
m_pSecondaryScoreKeeper = NULL; m_pSecondaryScoreKeeper = NULL;
m_pInventory = NULL; m_pInventory = NULL;
m_pIterNotJudged = NULL; m_pIterNeedsTapJudging = NULL;
m_pIterCurrentOrUpcoming = NULL; m_pIterNeedsHoldJudging = NULL;
m_pIterUncrossedRows = NULL; m_pIterUncrossedRows = NULL;
m_pIterUnjudgedRows = NULL; m_pIterUnjudgedRows = NULL;
m_pIterUnjudgedMineRows = NULL; m_pIterUnjudgedMineRows = NULL;
@@ -190,8 +190,8 @@ Player::~Player()
for( unsigned i = 0; i < m_vpHoldJudgment.size(); ++i ) for( unsigned i = 0; i < m_vpHoldJudgment.size(); ++i )
SAFE_DELETE( m_vpHoldJudgment[i] ); SAFE_DELETE( m_vpHoldJudgment[i] );
SAFE_DELETE( m_pJudgedRows ); SAFE_DELETE( m_pJudgedRows );
SAFE_DELETE( m_pIterNotJudged ); SAFE_DELETE( m_pIterNeedsTapJudging );
SAFE_DELETE( m_pIterCurrentOrUpcoming ); SAFE_DELETE( m_pIterNeedsHoldJudging );
SAFE_DELETE( m_pIterUncrossedRows ); SAFE_DELETE( m_pIterUncrossedRows );
SAFE_DELETE( m_pIterUnjudgedRows ); SAFE_DELETE( m_pIterUnjudgedRows );
SAFE_DELETE( m_pIterUnjudgedMineRows ); SAFE_DELETE( m_pIterUnjudgedMineRows );
@@ -381,19 +381,42 @@ void Player::Init(
*b = false; *b = false;
} }
static bool NotJudged( const TapNote &tn ) static bool NeedsTapJudging( const TapNote &tn )
{ {
if( tn.result.tns != TNS_None )
return false;
switch( tn.type ) switch( tn.type )
{ {
DEFAULT_FAIL( tn.type );
case TapNote::tap: case TapNote::tap:
case TapNote::hold_head: case TapNote::hold_head:
case TapNote::mine: case TapNote::mine:
case TapNote::lift: case TapNote::lift:
if( tn.result.tns == TNS_None )
return true; return true;
} else
return false; return false;
case TapNote::hold_tail:
case TapNote::attack:
return false;
}
}
static bool NeedsHoldJudging( const TapNote &tn )
{
switch( tn.type )
{
DEFAULT_FAIL( tn.type );
case TapNote::hold_head:
if( tn.HoldResult.hns == HNS_None )
return true;
else
return false;
case TapNote::tap:
case TapNote::hold_tail:
case TapNote::mine:
case TapNote::lift:
case TapNote::attack:
return false;
}
} }
void Player::Load() void Player::Load()
@@ -516,11 +539,11 @@ void Player::Load()
if( m_pPlayerStageStats ) if( m_pPlayerStageStats )
SendComboMessages( m_pPlayerStageStats->m_iCurCombo, m_pPlayerStageStats->m_iCurMissCombo ); SendComboMessages( m_pPlayerStageStats->m_iCurCombo, m_pPlayerStageStats->m_iCurMissCombo );
SAFE_DELETE( m_pIterNotJudged ); SAFE_DELETE( m_pIterNeedsTapJudging );
m_pIterNotJudged = new NoteData::all_tracks_iterator( m_NoteData.GetTapNoteRangeAllTracks(iNoteRow, MAX_NOTE_ROW, NotJudged) ); m_pIterNeedsTapJudging = new NoteData::all_tracks_iterator( m_NoteData.GetTapNoteRangeAllTracks(iNoteRow, MAX_NOTE_ROW) );
SAFE_DELETE( m_pIterCurrentOrUpcoming ); SAFE_DELETE( m_pIterNeedsHoldJudging );
m_pIterCurrentOrUpcoming = new NoteData::all_tracks_iterator( m_NoteData.GetTapNoteRangeAllTracks(iNoteRow, MAX_NOTE_ROW ) ); m_pIterNeedsHoldJudging = new NoteData::all_tracks_iterator( m_NoteData.GetTapNoteRangeAllTracks(iNoteRow, MAX_NOTE_ROW ) );
SAFE_DELETE( m_pIterUncrossedRows ); SAFE_DELETE( m_pIterUncrossedRows );
m_pIterUncrossedRows = new NoteData::all_tracks_iterator( m_NoteData.GetTapNoteRangeAllTracks(iNoteRow, MAX_NOTE_ROW ) ); m_pIterUncrossedRows = new NoteData::all_tracks_iterator( m_NoteData.GetTapNoteRangeAllTracks(iNoteRow, MAX_NOTE_ROW ) );
@@ -713,45 +736,27 @@ void Player::Update( float fDeltaTime )
// update HoldNotes logic // update HoldNotes logic
// //
{ {
// Update CurrentOrUpcomingNote pointers to point to the note
// at or after iSongRow. // Fast forward to the first that needs hold judging.
NoteData::all_tracks_iterator &iter = *m_pIterCurrentOrUpcoming;
while( !iter.IsAtEnd() && iter.Row() < iSongRow )
{ {
NoteData::all_tracks_iterator &iter = *m_pIterNeedsHoldJudging;
while( !iter.IsAtEnd() && iter.Row() <= iSongRow && !NeedsHoldJudging(*iter) )
++iter; ++iter;
} }
multimap<int,TrackRowTapNote> mapRowToTap;
for( int t=0; t<m_NoteData.GetNumTracks(); t++ ) vector<TrackRowTapNote> vHoldNotesToGradeTogether;
int iRowOfLastHoldNote = -1;
NoteData::all_tracks_iterator iter = *m_pIterNeedsHoldJudging; // copy
for( ; !iter.IsAtEnd() && iter.Row() <= iSongRow; ++iter )
{ {
// If there is a hold on this track that overlaps the current row TapNote &tn = *iter;
// (overlaps because head has passed the current row),
// it will be the the TapNote one before the TapNote pointed to
// by CurrentOrUpcoming.
NoteData::iterator iter = m_pIterCurrentOrUpcoming->GetIter(t);
if( iter == m_NoteData.begin(t) )
continue; // no previous note available
--iter;
TapNote &tn = iter->second;
int iRow = iter->first;
ASSERT( iRow < iSongRow );
if( tn.type != TapNote::hold_head ) if( tn.type != TapNote::hold_head )
continue; continue;
bool bInRange = iSongRow < iRow + tn.iDuration;
if( !bInRange )
continue;
TrackRowTapNote trtn = { t, iRow, &tn };
mapRowToTap.insert( make_pair(iRow,trtn) );
}
// mapRowToTap now contains all overlapping holds sored by row int iTrack = iter.Track();
int iRowOfLastHoldNote = -1; int iRow = iter.Row();
vector<TrackRowTapNote> vHoldNotesToGradeTogether; TrackRowTapNote trtn = { iTrack, iRow, &tn };
FOREACHMM( int, TrackRowTapNote, mapRowToTap, iter )
{
TrackRowTapNote &trtn = iter->second;
TapNote &tn = *trtn.pTN;
int iRow = iter->first;
/* All holds must be of the same subType because fLife is handled /* All holds must be of the same subType because fLife is handled
* in different ways depending on the SubType. Handle Rolls one at a time * in different ways depending on the SubType. Handle Rolls one at a time
@@ -789,7 +794,6 @@ void Player::Update( float fDeltaTime )
} }
} }
{ {
// Why was this originally "BeatToNoteRowNotRounded"? It should be rounded. -Chris // Why was this originally "BeatToNoteRowNotRounded"? It should be rounded. -Chris
/* We want to send the crossed row message exactly when we cross the row--not /* We want to send the crossed row message exactly when we cross the row--not
@@ -2142,12 +2146,15 @@ void Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
} }
} }
NoteData::all_tracks_iterator &iter = *m_pIterNotJudged; NoteData::all_tracks_iterator &iter = *m_pIterNeedsTapJudging;
for( ; !iter.IsAtEnd() && iter.Row() < iMissIfOlderThanThisRow; ++iter ) for( ; !iter.IsAtEnd() && iter.Row() < iMissIfOlderThanThisRow; ++iter )
{ {
TapNote &tn = *iter; TapNote &tn = *iter;
if( !NeedsTapJudging(tn) )
continue;
if( tn.pn != PLAYER_INVALID && tn.pn != m_pPlayerState->m_PlayerNumber ) if( tn.pn != PLAYER_INVALID && tn.pn != m_pPlayerState->m_PlayerNumber )
continue; continue;
if( tn.type == TapNote::mine ) if( tn.type == TapNote::mine )
+2 -2
View File
@@ -167,8 +167,8 @@ protected:
Inventory *m_pInventory; Inventory *m_pInventory;
int m_iFirstUncrossedRow; // used by hold checkpoints logic int m_iFirstUncrossedRow; // used by hold checkpoints logic
NoteData::all_tracks_iterator *m_pIterNotJudged; NoteData::all_tracks_iterator *m_pIterNeedsTapJudging;
NoteData::all_tracks_iterator *m_pIterCurrentOrUpcoming; NoteData::all_tracks_iterator *m_pIterNeedsHoldJudging;
NoteData::all_tracks_iterator *m_pIterUncrossedRows; NoteData::all_tracks_iterator *m_pIterUncrossedRows;
NoteData::all_tracks_iterator *m_pIterUnjudgedRows; NoteData::all_tracks_iterator *m_pIterUnjudgedRows;
NoteData::all_tracks_iterator *m_pIterUnjudgedMineRows; NoteData::all_tracks_iterator *m_pIterUnjudgedMineRows;