sm4svn commits (all code by Glenn Maynard)

1fc3636: "working on routine mode"
fb1edc2: "working on routine"
20b5827: "working on routine"
193363b: "working on routine"
bd042f9: "working on routine"
This commit is contained in:
AJ Kelly
2010-02-13 14:31:58 -06:00
parent 777745b7fb
commit 6879834149
12 changed files with 135 additions and 109 deletions
+6 -8
View File
@@ -33,7 +33,7 @@ int GetNumNWithScore( const NoteData &in, TapNoteScore tns, int MinTaps, int iSt
FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( in, r, iStartRow, iEndRow ) FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( in, r, iStartRow, iEndRow )
{ {
int iNumNotesInRow = in.GetNumTracksWithTapOrHoldHead( r ); int iNumNotesInRow = in.GetNumTracksWithTapOrHoldHead( r );
TapNoteScore tnsRow = NoteDataWithScoring::LastTapNoteWithResult( in, r, PLAYER_INVALID ).result.tns; TapNoteScore tnsRow = NoteDataWithScoring::LastTapNoteWithResult( in, r ).result.tns;
if( iNumNotesInRow >= MinTaps && tnsRow >= tns ) if( iNumNotesInRow >= MinTaps && tnsRow >= tns )
iNumSuccessfulDoubles++; iNumSuccessfulDoubles++;
@@ -200,7 +200,7 @@ int MinTapNoteScoreTrack( const NoteData &in, unsigned iRow, PlayerNumber pn )
} }
const TapNote &NoteDataWithScoring::LastTapNoteWithResult( const NoteData &in, unsigned iRow, PlayerNumber pn ) const TapNote &NoteDataWithScoring::LastTapNoteWithResult( const NoteData &in, unsigned iRow )
{ {
// Allow this to be configurable between LastTapNoteScoreTrack and // Allow this to be configurable between LastTapNoteScoreTrack and
// MinTapNoteScore; this change inspired by PumpMania (Zmey, et al) -aj // MinTapNoteScore; this change inspired by PumpMania (Zmey, et al) -aj
@@ -219,7 +219,7 @@ const TapNote &NoteDataWithScoring::LastTapNoteWithResult( const NoteData &in, u
break; break;
} }
*/ */
int iTrack = LastTapNoteScoreTrack( in, iRow, pn ); int iTrack = LastTapNoteScoreTrack( in, iRow, PLAYER_INVALID );
if( iTrack == -1 ) if( iTrack == -1 )
return TAP_EMPTY; return TAP_EMPTY;
@@ -230,7 +230,7 @@ const TapNote &NoteDataWithScoring::LastTapNoteWithResult( const NoteData &in, u
/* Return the minimum tap score of a row. If the row isn't complete (not all /* Return the minimum tap score of a row. If the row isn't complete (not all
* taps have been hit), return TNS_None or TNS_Miss. */ * taps have been hit), return TNS_None or TNS_Miss. */
TapNoteScore NoteDataWithScoring::MinTapNoteScore( const NoteData &in, unsigned row, PlayerNumber pn ) TapNoteScore NoteDataWithScoring::MinTapNoteScore( const NoteData &in, unsigned row )
{ {
//LOG->Trace("Hey I'm NoteDataWithScoring::MinTapNoteScore"); //LOG->Trace("Hey I'm NoteDataWithScoring::MinTapNoteScore");
TapNoteScore score = TNS_W1; TapNoteScore score = TNS_W1;
@@ -240,8 +240,6 @@ TapNoteScore NoteDataWithScoring::MinTapNoteScore( const NoteData &in, unsigned
const TapNote &tn = in.GetTapNote( t, row ); const TapNote &tn = in.GetTapNote( t, row );
if( tn.type == TapNote::empty || tn.type == TapNote::mine || tn.type == TapNote::fake ) if( tn.type == TapNote::empty || tn.type == TapNote::mine || tn.type == TapNote::fake )
continue; continue;
if( tn.pn != PLAYER_INVALID && tn.pn != pn )
continue;
score = min( score, tn.result.tns ); score = min( score, tn.result.tns );
} }
@@ -249,9 +247,9 @@ TapNoteScore NoteDataWithScoring::MinTapNoteScore( const NoteData &in, unsigned
return score; return score;
} }
bool NoteDataWithScoring::IsRowCompletelyJudged( const NoteData &in, unsigned row, PlayerNumber pn ) bool NoteDataWithScoring::IsRowCompletelyJudged( const NoteData &in, unsigned row )
{ {
return MinTapNoteScore( in, row, pn ) >= TNS_Miss; return MinTapNoteScore( in, row ) >= TNS_Miss;
} }
namespace namespace
+3 -3
View File
@@ -14,9 +14,9 @@ struct TapNote;
namespace NoteDataWithScoring namespace NoteDataWithScoring
{ {
bool IsRowCompletelyJudged( const NoteData &in, unsigned iRow, PlayerNumber pn ); bool IsRowCompletelyJudged( const NoteData &in, unsigned iRow );
TapNoteScore MinTapNoteScore( const NoteData &in, unsigned iRow, PlayerNumber pn ); TapNoteScore MinTapNoteScore( const NoteData &in, unsigned iRow );
const TapNote &LastTapNoteWithResult( const NoteData &in, unsigned iRow, PlayerNumber pn ); const TapNote &LastTapNoteWithResult( const NoteData &in, unsigned iRow );
void GetActualRadarValues( const NoteData &in, const PlayerStageStats &pss, float fSongSeconds, RadarValues& out ); void GetActualRadarValues( const NoteData &in, const PlayerStageStats &pss, float fSongSeconds, RadarValues& out );
}; };
+13 -25
View File
@@ -235,7 +235,7 @@ void Player::Init(
{ {
// Init judgment positions // Init judgment positions
bool bPlayerUsingBothSides = GAMESTATE->GetCurrentStyle()->m_StyleType==StyleType_OnePlayerTwoSides; bool bPlayerUsingBothSides = GAMESTATE->GetCurrentStyle()->GetUsesCenteredArrows();
Actor TempJudgment; Actor TempJudgment;
TempJudgment.SetName( "Judgment" ); TempJudgment.SetName( "Judgment" );
ActorUtil::LoadCommand( TempJudgment, sType, "Transform" ); ActorUtil::LoadCommand( TempJudgment, sType, "Transform" );
@@ -514,7 +514,7 @@ void Player::Load()
m_pNoteField->Load( &m_NoteData, iDrawDistanceAfterTargetsPixels, iDrawDistanceBeforeTargetsPixels ); m_pNoteField->Load( &m_NoteData, iDrawDistanceAfterTargetsPixels, iDrawDistanceBeforeTargetsPixels );
} }
bool bPlayerUsingBothSides = GAMESTATE->GetCurrentStyle()->m_StyleType==StyleType_OnePlayerTwoSides; bool bPlayerUsingBothSides = GAMESTATE->GetCurrentStyle()->GetUsesCenteredArrows();
if( m_pAttackDisplay ) if( m_pAttackDisplay )
m_pAttackDisplay->SetX( ATTACK_DISPLAY_X.GetValue(pn, bPlayerUsingBothSides) - 40 ); m_pAttackDisplay->SetX( ATTACK_DISPLAY_X.GetValue(pn, bPlayerUsingBothSides) - 40 );
// set this in Update //m_pAttackDisplay->SetY( bReverse ? ATTACK_DISPLAY_Y_REVERSE : ATTACK_DISPLAY_Y ); // set this in Update //m_pAttackDisplay->SetY( bReverse ? ATTACK_DISPLAY_Y_REVERSE : ATTACK_DISPLAY_Y );
@@ -1433,7 +1433,7 @@ int Player::GetClosestNonEmptyRowDirectional( int iStartRow, int iEndRow, bool b
while( !iter.IsAtEnd() ) while( !iter.IsAtEnd() )
{ {
if( NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iter.Row(), m_pPlayerState->m_PlayerNumber) ) if( NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iter.Row()) )
{ {
++iter; ++iter;
continue; continue;
@@ -1447,7 +1447,7 @@ int Player::GetClosestNonEmptyRowDirectional( int iStartRow, int iEndRow, bool b
while( !iter.IsAtEnd() ) while( !iter.IsAtEnd() )
{ {
if( NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iter.Row(), m_pPlayerState->m_PlayerNumber) ) if( NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iter.Row()) )
{ {
++iter; ++iter;
continue; continue;
@@ -2064,7 +2064,7 @@ void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, b
goto done_checking_hopo; goto done_checking_hopo;
} }
// con't hopo on the same note 2x in a row // can't hopo on the same note 2x in a row
if( col == m_pPlayerState->m_iLastHopoNoteCol ) if( col == m_pPlayerState->m_iLastHopoNoteCol )
{ {
bDidHopo = false; bDidHopo = false;
@@ -2077,13 +2077,13 @@ void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, b
int iRowsAgoLastNote = 100000; // TODO: find more reasonable value based on HOPO_CHAIN_SECONDS? int iRowsAgoLastNote = 100000; // TODO: find more reasonable value based on HOPO_CHAIN_SECONDS?
NoteData::all_tracks_reverse_iterator iter = m_NoteData.GetTapNoteRangeAllTracksReverse( iRowsAgoLastNote-iRowsAgoLastNote, iRowOfOverlappingNoteOrRow-1 ); NoteData::all_tracks_reverse_iterator iter = m_NoteData.GetTapNoteRangeAllTracksReverse( iRowsAgoLastNote-iRowsAgoLastNote, iRowOfOverlappingNoteOrRow-1 );
ASSERT( !iter.IsAtEnd() ); // there must have been a note that started the hopo ASSERT( !iter.IsAtEnd() ); // there must have been a note that started the hopo
if( !NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iter.Row(), m_pPlayerState->m_PlayerNumber) ) if( !NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iter.Row()) )
{ {
bDidHopo = false; bDidHopo = false;
goto done_checking_hopo; goto done_checking_hopo;
} }
const TapNoteResult &lastTNR = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, iter.Row(), m_pPlayerState->m_PlayerNumber ).result; const TapNoteResult &lastTNR = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, iter.Row() ).result;
if( lastTNR.tns <= TNS_Miss ) if( lastTNR.tns <= TNS_Miss )
{ {
bDidHopo = false; bDidHopo = false;
@@ -2171,8 +2171,6 @@ done_checking_hopo:
} }
} }
// TODO: Remove use of PlayerNumber
PlayerNumber pn = pTN->pn == PLAYER_INVALID ? m_pPlayerState->m_PlayerNumber : pTN->pn;
m_LastTapNoteScore = score; m_LastTapNoteScore = score;
if( GAMESTATE->GetCurrentGame()->m_bCountNotesSeparately ) if( GAMESTATE->GetCurrentGame()->m_bCountNotesSeparately )
{ {
@@ -2187,9 +2185,9 @@ done_checking_hopo:
HideNote( col, iRowOfOverlappingNoteOrRow ); HideNote( col, iRowOfOverlappingNoteOrRow );
} }
} }
else if( NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iRowOfOverlappingNoteOrRow, pn) ) else if( NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iRowOfOverlappingNoteOrRow) )
{ {
FlashGhostRow( iRowOfOverlappingNoteOrRow, pn ); FlashGhostRow( iRowOfOverlappingNoteOrRow );
} }
} }
@@ -2336,8 +2334,6 @@ void Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
if( !NeedsTapJudging(tn) ) if( !NeedsTapJudging(tn) )
continue; continue;
if( tn.pn != PLAYER_INVALID && tn.pn != m_pPlayerState->m_PlayerNumber )
continue;
if( tn.type == TapNote::mine ) if( tn.type == TapNote::mine )
{ {
tn.result.tns = TNS_AvoidMine; tn.result.tns = TNS_AvoidMine;
@@ -2359,7 +2355,6 @@ void Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
void Player::UpdateJudgedRows() void Player::UpdateJudgedRows()
{ {
const int iEndRow = BeatToNoteRow( GAMESTATE->m_fSongBeat ); const int iEndRow = BeatToNoteRow( GAMESTATE->m_fSongBeat );
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
bool bAllJudged = true; bool bAllJudged = true;
const bool bSeparately = GAMESTATE->GetCurrentGame()->m_bCountNotesSeparately; const bool bSeparately = GAMESTATE->GetCurrentGame()->m_bCountNotesSeparately;
@@ -2375,7 +2370,7 @@ void Player::UpdateJudgedRows()
iLastSeenRow = iRow; iLastSeenRow = iRow;
// crossed a nonempty row // crossed a nonempty row
if( !NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iRow, pn) ) if( !NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iRow) )
{ {
bAllJudged = false; bAllJudged = false;
continue; continue;
@@ -2384,7 +2379,7 @@ void Player::UpdateJudgedRows()
*m_pIterUnjudgedRows = iter; *m_pIterUnjudgedRows = iter;
if( m_pJudgedRows->JudgeRow(iRow) ) if( m_pJudgedRows->JudgeRow(iRow) )
continue; continue;
const TapNoteResult &lastTNR = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, iRow, pn ).result; const TapNoteResult &lastTNR = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, iRow ).result;
if( lastTNR.tns < TNS_Miss ) if( lastTNR.tns < TNS_Miss )
continue; continue;
@@ -2394,7 +2389,6 @@ void Player::UpdateJudgedRows()
{ {
const TapNote &tn = m_NoteData.GetTapNote( iTrack, iRow ); const TapNote &tn = m_NoteData.GetTapNote( iTrack, iRow );
if( tn.type == TapNote::empty || tn.type == TapNote::mine ) continue; if( tn.type == TapNote::empty || tn.type == TapNote::mine ) continue;
if( tn.pn != PLAYER_INVALID && tn.pn != pn ) continue;
SetJudgment( tn.result.tns, iTrack, tn.result.fTapNoteOffset ); SetJudgment( tn.result.tns, iTrack, tn.result.fTapNoteOffset );
} }
} }
@@ -2442,8 +2436,6 @@ void Player::UpdateJudgedRows()
if( m_pNoteField ) if( m_pNoteField )
m_pNoteField->DidTapNote( iter.Track(), tn.result.tns, false ); m_pNoteField->DidTapNote( iter.Track(), tn.result.tns, false );
if( tn.pn != PLAYER_INVALID && tn.pn != pn )
continue;
if( tn.iKeysoundIndex >= 0 && tn.iKeysoundIndex < (int) m_vKeysounds.size() ) if( tn.iKeysoundIndex >= 0 && tn.iKeysoundIndex < (int) m_vKeysounds.size() )
setSounds.insert( &m_vKeysounds[tn.iKeysoundIndex] ); setSounds.insert( &m_vKeysounds[tn.iKeysoundIndex] );
else if( g_bEnableMineSoundPlayback ) else if( g_bEnableMineSoundPlayback )
@@ -2489,11 +2481,10 @@ void Player::UpdateJudgedRows()
} }
} }
void Player::FlashGhostRow( int iRow, PlayerNumber pn ) void Player::FlashGhostRow( int iRow )
{ {
TapNoteScore lastTNS = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, iRow, pn ).result.tns; TapNoteScore lastTNS = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, iRow, pn ).result.tns;
const bool bBlind = (m_pPlayerState->m_PlayerOptions.GetCurrent().m_fBlind != 0); const bool bBlind = (m_pPlayerState->m_PlayerOptions.GetCurrent().m_fBlind != 0);
// XXX This is the wrong combo for shared players. STATSMAN->m_CurStageStats.m_Player[pn] might work but could be wrong.
const bool bBright = ( m_pPlayerStageStats && m_pPlayerStageStats->m_iCurCombo > int(BRIGHT_GHOST_COMBO_THRESHOLD) ) || bBlind; const bool bBright = ( m_pPlayerStageStats && m_pPlayerStageStats->m_iCurCombo > int(BRIGHT_GHOST_COMBO_THRESHOLD) ) || bBlind;
for( int iTrack = 0; iTrack < m_NoteData.GetNumTracks(); ++iTrack ) for( int iTrack = 0; iTrack < m_NoteData.GetNumTracks(); ++iTrack )
@@ -2502,8 +2493,6 @@ void Player::FlashGhostRow( int iRow, PlayerNumber pn )
if( tn.type == TapNote::empty || tn.type == TapNote::mine || tn.type == TapNote::fake ) if( tn.type == TapNote::empty || tn.type == TapNote::mine || tn.type == TapNote::fake )
continue; continue;
if( tn.pn != PLAYER_INVALID && tn.pn != pn )
continue;
if( m_pNoteField ) if( m_pNoteField )
m_pNoteField->DidTapNote( iTrack, lastTNS, bBright ); m_pNoteField->DidTapNote( iTrack, lastTNS, bBright );
if( lastTNS >= TNS_W3 || bBlind ) if( lastTNS >= TNS_W3 || bBlind )
@@ -2743,8 +2732,7 @@ void Player::HandleTapRowScore( unsigned row )
if( bNoCheating && m_pPlayerState->m_PlayerController == PC_AUTOPLAY ) if( bNoCheating && m_pPlayerState->m_PlayerController == PC_AUTOPLAY )
return; return;
PlayerNumber pn = m_pPlayerState->m_PlayerNumber; TapNoteScore scoreOfLastTap = NoteDataWithScoring::LastTapNoteWithResult(m_NoteData, row).result.tns;
TapNoteScore scoreOfLastTap = NoteDataWithScoring::LastTapNoteWithResult(m_NoteData, row, pn).result.tns;
const int iOldCombo = m_pPlayerStageStats ? m_pPlayerStageStats->m_iCurCombo : 0; const int iOldCombo = m_pPlayerStageStats ? m_pPlayerStageStats->m_iCurCombo : 0;
const int iOldMissCombo = m_pPlayerStageStats ? m_pPlayerStageStats->m_iCurMissCombo : 0; const int iOldMissCombo = m_pPlayerStageStats ? m_pPlayerStageStats->m_iCurMissCombo : 0;
+1 -1
View File
@@ -112,7 +112,7 @@ public:
protected: protected:
void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ); void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
void UpdateJudgedRows(); void UpdateJudgedRows();
void FlashGhostRow( int iRow, PlayerNumber pn ); void FlashGhostRow( int iRow );
void HandleTapRowScore( unsigned row ); void HandleTapRowScore( unsigned row );
void HandleHoldScore( const TapNote &tn ); void HandleHoldScore( const TapNote &tn );
void HandleHoldCheckpoint( int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow, const vector<int> &viColsWithHold ); void HandleHoldCheckpoint( int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow, const vector<int> &viColsWithHold );
+1 -3
View File
@@ -20,13 +20,11 @@ void ScoreKeeper::GetScoreOfLastTapInRow( const NoteData &nd, int iRow,
{ {
const TapNote &tn = nd.GetTapNote( track, iRow ); const TapNote &tn = nd.GetTapNote( track, iRow );
if( tn.pn != PLAYER_INVALID && tn.pn != pn )
continue;
if( tn.type != TapNote::tap && tn.type != TapNote::hold_head ) if( tn.type != TapNote::tap && tn.type != TapNote::hold_head )
continue; continue;
++iNum; ++iNum;
} }
tnsOut = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow, pn ).result.tns; tnsOut = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow ).result.tns;
iNumTapsInRowOut = iNum; iNumTapsInRowOut = iNum;
} }
+6 -6
View File
@@ -49,15 +49,15 @@ public:
virtual void Update( float fDelta ) { } virtual void Update( float fDelta ) { }
/* Note that pNoteData will include any transformations due to modifiers. */ /* Note that pNoteData will include any transformations due to modifiers. */
virtual void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ) = 0; // before a song plays (called multiple times if course) virtual void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ) { }; // before a song plays (called multiple times if course)
// HandleTap* is called before HandleTapRow* // HandleTap* is called before HandleTapRow*
virtual void HandleTapScore( const TapNote &tn ) = 0; virtual void HandleTapScore( const TapNote &tn ) { }
virtual void HandleTapRowScore( const NoteData &nd, int iRow ) = 0; virtual void HandleTapRowScore( const NoteData &nd, int iRow ) { }
virtual void HandleHoldScore( const TapNote &tn ) = 0; virtual void HandleHoldScore( const TapNote &tn ) { }
virtual void HandleHoldActiveSeconds( float fMusicSecondsHeld ) = 0; virtual void HandleHoldActiveSeconds( float fMusicSecondsHeld ) { }
virtual void HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow ) { } virtual void HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow ) { }
virtual void HandleTapScoreNone() = 0; virtual void HandleTapScoreNone() { }
protected: protected:
void GetScoreOfLastTapInRow( const NoteData &nd, int iRow, TapNoteScore &tnsOut, int &iNumTapsInRowOut ); void GetScoreOfLastTapInRow( const NoteData &nd, int iRow, TapNoteScore &tnsOut, int &iNumTapsInRowOut );
+2 -7
View File
@@ -619,14 +619,11 @@ void ScoreKeeperNormal::GetRowCounts( const NoteData &nd, int iRow,
int &iNumHitContinueCombo, int &iNumHitMaintainCombo, int &iNumHitContinueCombo, int &iNumHitMaintainCombo,
int &iNumBreakCombo ) int &iNumBreakCombo )
{ {
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
iNumHitContinueCombo = iNumHitMaintainCombo = iNumBreakCombo = 0; iNumHitContinueCombo = iNumHitMaintainCombo = iNumBreakCombo = 0;
for( int track = 0; track < nd.GetNumTracks(); ++track ) for( int track = 0; track < nd.GetNumTracks(); ++track )
{ {
const TapNote &tn = nd.GetTapNote( track, iRow ); const TapNote &tn = nd.GetTapNote( track, iRow );
if( tn.pn != PLAYER_INVALID && tn.pn != pn )
continue;
if( tn.type != TapNote::tap && tn.type != TapNote::hold_head && tn.type != TapNote::lift ) if( tn.type != TapNote::tap && tn.type != TapNote::hold_head && tn.type != TapNote::lift )
continue; continue;
TapNoteScore tns = tn.result.tns; TapNoteScore tns = tn.result.tns;
@@ -650,7 +647,7 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow )
m_iNumNotesHitThisRow = iNumTapsInRow; m_iNumNotesHitThisRow = iNumTapsInRow;
TapNoteScore scoreOfLastTap = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow, m_pPlayerState->m_PlayerNumber ).result.tns; TapNoteScore scoreOfLastTap = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow ).result.tns;
HandleTapNoteScoreInternal( scoreOfLastTap, TNS_W1 ); HandleTapNoteScoreInternal( scoreOfLastTap, TNS_W1 );
HandleComboInternal( iNumHitContinueCombo, iNumHitMaintainCombo, iNumBreakCombo ); HandleComboInternal( iNumHitContinueCombo, iNumHitMaintainCombo, iNumBreakCombo );
@@ -672,9 +669,7 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow )
} }
#endif //DEBUG #endif //DEBUG
//
// Toasty combo // Toasty combo
//
switch( scoreOfLastTap ) switch( scoreOfLastTap )
{ {
case TNS_W1: case TNS_W1:
@@ -698,7 +693,7 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow )
// TODO: Remove indexing with PlayerNumber // TODO: Remove indexing with PlayerNumber
PlayerNumber pn = m_pPlayerState->m_PlayerNumber; PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
float offset = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow, pn ).result.fTapNoteOffset; float offset = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow ).result.fTapNoteOffset;
NSMAN->ReportScore( pn, scoreOfLastTap, NSMAN->ReportScore( pn, scoreOfLastTap,
m_pPlayerStageStats->m_iScore, m_pPlayerStageStats->m_iScore,
m_pPlayerStageStats->m_iCurCombo, offset ); m_pPlayerStageStats->m_iCurCombo, offset );
+1 -1
View File
@@ -65,7 +65,6 @@ class ScoreKeeperNormal: public ScoreKeeper
virtual void AddTapScore( TapNoteScore tns ); virtual void AddTapScore( TapNoteScore tns );
virtual void AddHoldScore( HoldNoteScore hns ); virtual void AddHoldScore( HoldNoteScore hns );
virtual void AddTapRowScore( TapNoteScore tns, const NoteData &nd, int iRow ); virtual void AddTapRowScore( TapNoteScore tns, const NoteData &nd, int iRow );
virtual void HandleTapScoreNone();
/* Configuration: */ /* Configuration: */
/* Score after each tap will be rounded to the nearest m_iRoundTo; 1 to do nothing. */ /* Score after each tap will be rounded to the nearest m_iRoundTo; 1 to do nothing. */
@@ -88,6 +87,7 @@ public:
void HandleHoldScore( const TapNote &tn ); void HandleHoldScore( const TapNote &tn );
void HandleHoldActiveSeconds( float fMusicSecondsHeld ) {}; void HandleHoldActiveSeconds( float fMusicSecondsHeld ) {};
void HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow ); void HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow );
void HandleTapScoreNone();
// This must be calculated using only cached radar values so that we can // This must be calculated using only cached radar values so that we can
// do it quickly. // do it quickly.
+74 -11
View File
@@ -1,29 +1,92 @@
#include "global.h" #include "global.h"
#include "ScoreKeeperShared.h" #include "ScoreKeeperShared.h"
#include "RageLog.h"
#include "GameState.h" #include "GameState.h"
#include "StatsManager.h"
#include "NoteDataUtil.h"
#include "NoteData.h"
#include "PlayerState.h" #include "PlayerState.h"
/* In Routine, we have two Players, but the master one handles all of the scoring. The other
* one will just receive misses for everything, and shouldn't do anything. */
ScoreKeeperShared::ScoreKeeperShared( PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ) : ScoreKeeperShared::ScoreKeeperShared( PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ) :
ScoreKeeperNormal( pPlayerState, pPlayerStageStats ) ScoreKeeperNormal( pPlayerState, pPlayerStageStats )
{ {
} }
void ScoreKeeperShared::OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ) void ScoreKeeperShared::Load(
const vector<Song*> &apSongs,
const vector<Steps*> &apSteps,
const vector<AttackArray> &asModifiers )
{ {
vector<NoteData> vParts; if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber )
PlayerNumber pn = m_pPlayerState->m_PlayerNumber; return;
ScoreKeeperNormal::Load( apSongs, apSteps, asModifiers );
NoteDataUtil::SplitCompositeNoteData( *pNoteData, vParts );
ScoreKeeperNormal::OnNextSong( iSongInCourseIndex, pSteps, &vParts[pn] );
} }
#undef CALL // These ScoreKeepers don't get to draw.
void ScoreKeeperShared::DrawPrimitives()
{
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber )
return;
ScoreKeeperNormal::DrawPrimitives();
}
void ScoreKeeperShared::Update( float fDelta )
{
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber )
return;
ScoreKeeperNormal::Update( fDelta );
}
void ScoreKeeperShared::OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData )
{
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber )
return;
ScoreKeeperNormal::OnNextSong( iSongInCourseIndex, pSteps, pNoteData );
}
void ScoreKeeperShared::HandleTapScore( const TapNote &tn )
{
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber )
return;
ScoreKeeperNormal::HandleTapScore( tn );
}
void ScoreKeeperShared::HandleTapRowScore( const NoteData &nd, int iRow )
{
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber )
return;
ScoreKeeperNormal::HandleTapRowScore( nd, iRow );
}
void ScoreKeeperShared::HandleHoldScore( const TapNote &tn )
{
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber )
return;
ScoreKeeperNormal::HandleHoldScore( tn );
}
void ScoreKeeperShared::HandleHoldActiveSeconds( float fMusicSecondsHeld )
{
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber )
return;
ScoreKeeperNormal::HandleHoldActiveSeconds( fMusicSecondsHeld );
}
void ScoreKeeperShared::HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow )
{
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber )
return;
ScoreKeeperNormal::HandleHoldCheckpointScore( nd, iRow, iNumHoldsHeldThisRow, iNumHoldsMissedThisRow );
}
void ScoreKeeperShared::HandleTapScoreNone()
{
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber )
return;
ScoreKeeperNormal::HandleTapScoreNone();
}
/* /*
* (c) 2006 Steve Checkoway * (c) 2006-2010 Steve Checkoway, Glenn Maynard
* All rights reserved. * All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
+15 -1
View File
@@ -9,7 +9,21 @@ class ScoreKeeperShared : public ScoreKeeperNormal
public: public:
ScoreKeeperShared( PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ); ScoreKeeperShared( PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats );
void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); virtual void Load(
const vector<Song*> &apSongs,
const vector<Steps*> &apSteps,
const vector<AttackArray> &asModifiers );
virtual void DrawPrimitives();
virtual void Update( float fDelta );
virtual void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData );
virtual void HandleTapScore( const TapNote &tn );
virtual void HandleTapRowScore( const NoteData &nd, int iRow );
virtual void HandleHoldScore( const TapNote &tn );
virtual void HandleHoldActiveSeconds( float fMusicSecondsHeld );
virtual void HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow );
virtual void HandleTapScoreNone();
}; };
#endif #endif
+9 -38
View File
@@ -4,24 +4,21 @@
#include "Player.h" #include "Player.h"
#include "NoteDataUtil.h" #include "NoteDataUtil.h"
#include "NoteDataWithScoring.h" #include "NoteDataWithScoring.h"
#include "ActiveAttackList.h"
#include "ScoreDisplayNormal.h"
#include "ScoreKeeperShared.h"
#include "Song.h" #include "Song.h"
#include "StatsManager.h"
REGISTER_SCREEN_CLASS( ScreenGameplayShared ); REGISTER_SCREEN_CLASS( ScreenGameplayShared );
void ScreenGameplayShared::FillPlayerInfo( vector<PlayerInfo> &vPlayerInfoOut ) void ScreenGameplayShared::FillPlayerInfo( vector<PlayerInfo> &vPlayerInfoOut )
{ {
PlayerNumber mpn = GAMESTATE->m_MasterPlayerNumber; const PlayerNumber master = GAMESTATE->m_MasterPlayerNumber;
vPlayerInfoOut.resize( NUM_PLAYERS ); const PlayerNumber other = (master == PLAYER_1? PLAYER_2:PLAYER_1);
PlayerInfo &mpi = vPlayerInfoOut[mpn];
FOREACH_PlayerNumber( pn ) /* The master player is where all of the real work takes place. The other player exists
{ * only so we have a place to split stats out into at the end. */
PlayerInfo &pi = vPlayerInfoOut[pn]; vPlayerInfoOut.resize( 2 );
pi.Load( pn, MultiPlayer_Invalid, pn == mpn, Difficulty_Invalid ); vPlayerInfoOut[0].Load( master, MultiPlayer_Invalid, true, Difficulty_Invalid );
pi.m_pPlayer = new Player( mpi.m_NoteData, pn == mpn ); vPlayerInfoOut[1].Load( other, MultiPlayer_Invalid, false, Difficulty_Invalid );
}
} }
PlayerInfo &ScreenGameplayShared::GetPlayerInfoForInput( const InputEventPlus& iep ) PlayerInfo &ScreenGameplayShared::GetPlayerInfoForInput( const InputEventPlus& iep )
@@ -29,32 +26,6 @@ PlayerInfo &ScreenGameplayShared::GetPlayerInfoForInput( const InputEventPlus& i
return m_vPlayerInfo[GAMESTATE->m_MasterPlayerNumber]; return m_vPlayerInfo[GAMESTATE->m_MasterPlayerNumber];
} }
void ScreenGameplayShared::SaveStats()
{
vector<NoteData> vParts;
PlayerNumber mpn = GAMESTATE->m_MasterPlayerNumber;
float fMusicLen = GAMESTATE->m_pCurSong->m_fMusicLengthSeconds;
NoteDataUtil::SplitCompositeNoteData( m_vPlayerInfo[mpn].m_pPlayer->GetNoteData(), vParts );
for( size_t i = 0; i < min(vParts.size(), m_vPlayerInfo.size()); ++i )
{
PlayerInfo &pi = m_vPlayerInfo[i];
if( !pi.IsEnabled() )
continue;
NoteData &nd = vParts[i];
RadarValues rv;
PlayerStageStats &pss = *pi.GetPlayerStageStats();
NoteDataUtil::CalculateRadarValues( nd, fMusicLen, rv );
pss.m_radarPossible += rv;
NoteDataWithScoring::GetActualRadarValues( nd, pss, fMusicLen, rv );
pss.m_radarActual += rv;
}
}
/* /*
* (c) 2006 Steve Checkoway * (c) 2006 Steve Checkoway
* All rights reserved. * All rights reserved.
-1
View File
@@ -8,7 +8,6 @@ class ScreenGameplayShared : public ScreenGameplay
protected: protected:
virtual void FillPlayerInfo( vector<PlayerInfo> &vPlayerInfoOut ); virtual void FillPlayerInfo( vector<PlayerInfo> &vPlayerInfoOut );
virtual PlayerInfo &GetPlayerInfoForInput( const InputEventPlus& iep ); virtual PlayerInfo &GetPlayerInfoForInput( const InputEventPlus& iep );
virtual void SaveStats();
}; };
#endif #endif