Move miss combo calculations into the ScoreKeeper.
This commit is contained in:
+20
-41
@@ -1536,55 +1536,24 @@ void Player::RandomizeNotes( int iNoteRow )
|
|||||||
|
|
||||||
void Player::HandleTapRowScore( unsigned row )
|
void Player::HandleTapRowScore( unsigned row )
|
||||||
{
|
{
|
||||||
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
bool bNoCheating = true;
|
||||||
const TapNote &lastTN = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, row, pn );
|
|
||||||
TapNoteScore scoreOfLastTap = lastTN.result.tns;
|
|
||||||
|
|
||||||
bool NoCheating = true;
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
NoCheating = false;
|
bNoCheating = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( GAMESTATE->m_bDemonstrationOrJukebox )
|
if( GAMESTATE->m_bDemonstrationOrJukebox )
|
||||||
NoCheating = false;
|
bNoCheating = false;
|
||||||
// don't accumulate points if AutoPlay is on.
|
// don't accumulate points if AutoPlay is on.
|
||||||
if( NoCheating && m_pPlayerState->m_PlayerController == PC_AUTOPLAY )
|
if( bNoCheating && m_pPlayerState->m_PlayerController == PC_AUTOPLAY )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Update miss combo, and handle "combo stopped" messages. */
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
/* When is m_pPlayerStageStats NULL? Would it be cleaner to pass Player a dummy
|
TapNoteScore scoreOfLastTap = NoteDataWithScoring::LastTapNoteWithResult(m_NoteData, row, pn).result.tns;
|
||||||
* PlayerStageStats in this case, instead of having to carefully check for NULL
|
const int iOldCombo = m_pPlayerStageStats ? m_pPlayerStageStats->iCurCombo : 0;
|
||||||
* every time we use it? -glenn */
|
|
||||||
int iDummy = 0;
|
|
||||||
int &iCurCombo = m_pPlayerStageStats ? m_pPlayerStageStats->iCurCombo : iDummy;
|
|
||||||
int &iCurMissCombo = m_pPlayerStageStats ? m_pPlayerStageStats->iCurMissCombo : iDummy;
|
|
||||||
switch( scoreOfLastTap )
|
|
||||||
{
|
|
||||||
case TNS_W1:
|
|
||||||
case TNS_W2:
|
|
||||||
case TNS_W3:
|
|
||||||
iCurMissCombo = 0;
|
|
||||||
SCREENMAN->PostMessageToTopScreen( SM_MissComboAborted, 0 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TNS_Miss:
|
if( scoreOfLastTap == TNS_Miss )
|
||||||
++iCurMissCombo;
|
|
||||||
m_LastTapNoteScore = TNS_Miss;
|
m_LastTapNoteScore = TNS_Miss;
|
||||||
|
|
||||||
case TNS_W4:
|
|
||||||
case TNS_W5:
|
|
||||||
if( iCurCombo > 50 )
|
|
||||||
SCREENMAN->PostMessageToTopScreen( SM_ComboStopped, 0 );
|
|
||||||
iCurCombo = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ASSERT( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The score keeper updates the hit combo. Remember the old combo for handling announcers. */
|
|
||||||
const int iOldCombo = iCurCombo;
|
|
||||||
|
|
||||||
for( int track = 0; track < m_NoteData.GetNumTracks(); ++track )
|
for( int track = 0; track < m_NoteData.GetNumTracks(); ++track )
|
||||||
{
|
{
|
||||||
const TapNote &tn = m_NoteData.GetTapNote( track, row );
|
const TapNote &tn = m_NoteData.GetTapNote( track, row );
|
||||||
@@ -1599,10 +1568,20 @@ void Player::HandleTapRowScore( unsigned row )
|
|||||||
m_pSecondaryScoreKeeper->HandleTapScore( tn );
|
m_pSecondaryScoreKeeper->HandleTapScore( tn );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool bComboStopped = false;
|
||||||
|
bool bMissComboStopped = false;
|
||||||
|
|
||||||
if( m_pPrimaryScoreKeeper != NULL )
|
if( m_pPrimaryScoreKeeper != NULL )
|
||||||
m_pPrimaryScoreKeeper->HandleTapRowScore( m_NoteData, row );
|
m_pPrimaryScoreKeeper->HandleTapRowScore( m_NoteData, row, bComboStopped, bMissComboStopped );
|
||||||
|
if( bMissComboStopped )
|
||||||
|
SCREENMAN->PostMessageToTopScreen( SM_MissComboAborted, 0 );
|
||||||
|
if( bComboStopped && iOldCombo > 50 )
|
||||||
|
SCREENMAN->PostMessageToTopScreen( SM_ComboStopped, 0 );
|
||||||
if( m_pSecondaryScoreKeeper != NULL )
|
if( m_pSecondaryScoreKeeper != NULL )
|
||||||
m_pSecondaryScoreKeeper->HandleTapRowScore( m_NoteData, row );
|
m_pSecondaryScoreKeeper->HandleTapRowScore( m_NoteData, row, bComboStopped, bMissComboStopped );
|
||||||
|
|
||||||
|
const int iCurCombo = m_pPlayerStageStats ? m_pPlayerStageStats->iCurCombo : 0;
|
||||||
|
const int iCurMissCombo = m_pPlayerStageStats ? m_pPlayerStageStats->iCurMissCombo : 0;
|
||||||
|
|
||||||
if( m_pPlayerStageStats && m_pCombo )
|
if( m_pPlayerStageStats && m_pCombo )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
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 ) = 0; // before a song plays (called multiple times if course)
|
||||||
|
|
||||||
virtual void HandleTapScore( const TapNote &tn ) = 0;
|
virtual void HandleTapScore( const TapNote &tn ) = 0;
|
||||||
virtual void HandleTapRowScore( const NoteData &nd, int iRow ) = 0;
|
virtual void HandleTapRowScore( const NoteData &nd, int iRow, bool &bComboStopped, bool &bMissComboStopped ) = 0;
|
||||||
virtual void HandleHoldScore( const TapNote &tn ) = 0;
|
virtual void HandleHoldScore( const TapNote &tn ) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -350,10 +350,13 @@ void ScoreKeeperNormal::HandleTapScore( const TapNote &tn )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow )
|
void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow, bool &bComboStopped, bool &bMissComboStopped )
|
||||||
{
|
{
|
||||||
TapNoteScore scoreOfLastTap;
|
TapNoteScore scoreOfLastTap;
|
||||||
int iNumTapsInRow;
|
int iNumTapsInRow;
|
||||||
|
|
||||||
|
bComboStopped = false;
|
||||||
|
bMissComboStopped = false;
|
||||||
GetScoreOfLastTapInRow( nd, iRow, scoreOfLastTap, iNumTapsInRow );
|
GetScoreOfLastTapInRow( nd, iRow, scoreOfLastTap, iNumTapsInRow );
|
||||||
|
|
||||||
if( iNumTapsInRow <= 0 )
|
if( iNumTapsInRow <= 0 )
|
||||||
@@ -373,10 +376,20 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow )
|
|||||||
// Regular combo
|
// Regular combo
|
||||||
//
|
//
|
||||||
const int iComboCountIfHit = m_bComboIsPerRow? 1: iNumTapsInRow;
|
const int iComboCountIfHit = m_bComboIsPerRow? 1: iNumTapsInRow;
|
||||||
if( scoreOfLastTap >= m_MinScoreToContinueCombo )
|
if( scoreOfLastTap >= m_MinScoreToMaintainCombo )
|
||||||
m_pPlayerStageStats->iCurCombo += iComboCountIfHit;
|
{
|
||||||
|
bMissComboStopped = true;
|
||||||
|
m_pPlayerStageStats->iCurMissCombo = 0;
|
||||||
|
if( scoreOfLastTap >= m_MinScoreToContinueCombo )
|
||||||
|
m_pPlayerStageStats->iCurCombo += iComboCountIfHit;
|
||||||
|
}
|
||||||
else if( scoreOfLastTap < m_MinScoreToMaintainCombo )
|
else if( scoreOfLastTap < m_MinScoreToMaintainCombo )
|
||||||
|
{
|
||||||
|
bComboStopped = true;
|
||||||
m_pPlayerStageStats->iCurCombo = 0;
|
m_pPlayerStageStats->iCurCombo = 0;
|
||||||
|
if( scoreOfLastTap == TNS_Miss )
|
||||||
|
++m_pPlayerStageStats->iCurMissCombo;
|
||||||
|
}
|
||||||
|
|
||||||
AddScore( scoreOfLastTap ); // only score once per row
|
AddScore( scoreOfLastTap ); // only score once per row
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData );
|
void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData );
|
||||||
|
|
||||||
void HandleTapScore( const TapNote &tn );
|
void HandleTapScore( const TapNote &tn );
|
||||||
void HandleTapRowScore( const NoteData &nd, int iRow );
|
void HandleTapRowScore( const NoteData &nd, int iRow, bool &bComboStopped, bool &bMissComboStopped );
|
||||||
void HandleHoldScore( const TapNote &tn );
|
void HandleHoldScore( const TapNote &tn );
|
||||||
|
|
||||||
// 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
|
||||||
|
|||||||
@@ -31,12 +31,15 @@ void ScoreKeeperRave::HandleTapScore( const TapNote &tn )
|
|||||||
|
|
||||||
#define CROSSED( val ) (fOld < val && fNew >= val)
|
#define CROSSED( val ) (fOld < val && fNew >= val)
|
||||||
#define CROSSED_ATTACK_LEVEL( level ) CROSSED(1.f/NUM_ATTACK_LEVELS*(level+1))
|
#define CROSSED_ATTACK_LEVEL( level ) CROSSED(1.f/NUM_ATTACK_LEVELS*(level+1))
|
||||||
void ScoreKeeperRave::HandleTapRowScore( const NoteData &nd, int iRow )
|
void ScoreKeeperRave::HandleTapRowScore( const NoteData &nd, int iRow, bool &bComboStopped, bool &bMissComboStopped )
|
||||||
{
|
{
|
||||||
TapNoteScore scoreOfLastTap;
|
TapNoteScore scoreOfLastTap;
|
||||||
int iNumTapsInRow;
|
int iNumTapsInRow;
|
||||||
float fPercentToMove;
|
float fPercentToMove;
|
||||||
|
|
||||||
|
bComboStopped = false;
|
||||||
|
bMissComboStopped = false;
|
||||||
|
|
||||||
GetScoreOfLastTapInRow( nd, iRow, scoreOfLastTap, iNumTapsInRow );
|
GetScoreOfLastTapInRow( nd, iRow, scoreOfLastTap, iNumTapsInRow );
|
||||||
if( iNumTapsInRow <= 0 )
|
if( iNumTapsInRow <= 0 )
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public:
|
|||||||
ScoreKeeperRave( PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats );
|
ScoreKeeperRave( PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats );
|
||||||
void OnNextSong( int iSongInCourseIndex, const Steps *pSteps, const NoteData *pNoteData ) { }
|
void OnNextSong( int iSongInCourseIndex, const Steps *pSteps, const NoteData *pNoteData ) { }
|
||||||
void HandleTapScore( const TapNote &tn );
|
void HandleTapScore( const TapNote &tn );
|
||||||
void HandleTapRowScore( const NoteData &nd, int iRow );
|
void HandleTapRowScore( const NoteData &nd, int iRow, bool &bComboStopped, bool &bMissComboStopped );
|
||||||
void HandleHoldScore( const TapNote &tn );
|
void HandleHoldScore( const TapNote &tn );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user