fix crash on step if NULL life meter
This commit is contained in:
@@ -665,10 +665,10 @@ void Player::HandleTapRowScore( unsigned row )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(m_pPrimaryScoreKeeper)
|
if(m_pPrimaryScoreKeeper)
|
||||||
m_pPrimaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow, m_pLifeMeter->FailedEarlier() );
|
m_pPrimaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow );
|
||||||
|
|
||||||
if(m_pSecondaryScoreKeeper)
|
if(m_pSecondaryScoreKeeper)
|
||||||
m_pSecondaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow, m_pLifeMeter->FailedEarlier() );
|
m_pSecondaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow );
|
||||||
|
|
||||||
if (m_pScore)
|
if (m_pScore)
|
||||||
m_pScore->SetScore(GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber]);
|
m_pScore->SetScore(GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber]);
|
||||||
@@ -698,9 +698,9 @@ void Player::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(m_pPrimaryScoreKeeper)
|
if(m_pPrimaryScoreKeeper)
|
||||||
m_pPrimaryScoreKeeper->HandleHoldScore(holdScore, tapScore, m_pLifeMeter->FailedEarlier());
|
m_pPrimaryScoreKeeper->HandleHoldScore(holdScore, tapScore );
|
||||||
if(m_pSecondaryScoreKeeper)
|
if(m_pSecondaryScoreKeeper)
|
||||||
m_pSecondaryScoreKeeper->HandleHoldScore(holdScore, tapScore, m_pLifeMeter->FailedEarlier());
|
m_pSecondaryScoreKeeper->HandleHoldScore(holdScore, tapScore );
|
||||||
|
|
||||||
if (m_pScore)
|
if (m_pScore)
|
||||||
m_pScore->SetScore(GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber]);
|
m_pScore->SetScore(GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber]);
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ public:
|
|||||||
|
|
||||||
virtual void OnNextSong( int iSongInCourseIndex, Notes* pNotes ) = 0; // before a song plays (called multiple times if course)
|
virtual void OnNextSong( int iSongInCourseIndex, Notes* pNotes ) = 0; // before a song plays (called multiple times if course)
|
||||||
|
|
||||||
virtual void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow, bool failed) = 0;
|
virtual void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow ) = 0;
|
||||||
virtual void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore, bool failed ) = 0;
|
virtual void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ) = 0;
|
||||||
|
|
||||||
virtual int TapNoteScoreToDancePoints( TapNoteScore tns ) = 0;
|
virtual int TapNoteScoreToDancePoints( TapNoteScore tns ) = 0;
|
||||||
virtual int HoldNoteScoreToDancePoints( HoldNoteScore hns ) = 0;
|
virtual int HoldNoteScoreToDancePoints( HoldNoteScore hns ) = 0;
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ static int GetScore(int p, int B, int S, int n)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreKeeperMAX2::AddScore( TapNoteScore score, bool failed)
|
void ScoreKeeperMAX2::AddScore( TapNoteScore score )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
http://www.aaroninjapan.com/ddr2.html
|
http://www.aaroninjapan.com/ddr2.html
|
||||||
@@ -198,7 +198,11 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score, bool failed)
|
|||||||
int iScoreMultiplier = (m_iMaxPossiblePoints / (10*sum));
|
int iScoreMultiplier = (m_iMaxPossiblePoints / (10*sum));
|
||||||
ASSERT( iScoreMultiplier >= 0 );
|
ASSERT( iScoreMultiplier >= 0 );
|
||||||
|
|
||||||
if (failed)
|
// What does this do? "Don't use a multiplier if
|
||||||
|
// the player has failed"?
|
||||||
|
// Also, why does this switch on score again instead
|
||||||
|
// of just adding p? -Chris
|
||||||
|
if( GAMESTATE->m_CurStageStats.bFailed[m_PlayerNumber] )
|
||||||
switch( score )
|
switch( score )
|
||||||
{
|
{
|
||||||
case TNS_MARVELOUS: m_iScore += 10; break;
|
case TNS_MARVELOUS: m_iScore += 10; break;
|
||||||
@@ -213,7 +217,8 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score, bool failed)
|
|||||||
|
|
||||||
if ( m_iTapNotesHit == m_iNumTapsAndHolds && score >= TNS_PERFECT )
|
if ( m_iTapNotesHit == m_iNumTapsAndHolds && score >= TNS_PERFECT )
|
||||||
{
|
{
|
||||||
if (!failed) m_iScore += m_iPointBonus;
|
if (!GAMESTATE->m_CurStageStats.bFailed[m_PlayerNumber])
|
||||||
|
m_iScore += m_iPointBonus;
|
||||||
if ( m_bIsLastSongInCourse )
|
if ( m_bIsLastSongInCourse )
|
||||||
{
|
{
|
||||||
m_iScore += 100000000 - m_iMaxScoreSoFar;
|
m_iScore += 100000000 - m_iMaxScoreSoFar;
|
||||||
@@ -231,7 +236,7 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score, bool failed)
|
|||||||
GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber] = m_iScore;
|
GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber] = m_iScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow, bool failed )
|
void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow )
|
||||||
{
|
{
|
||||||
ASSERT( iNumTapsInRow >= 1 );
|
ASSERT( iNumTapsInRow >= 1 );
|
||||||
|
|
||||||
@@ -276,7 +281,7 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
|
|||||||
Note: if you got all Perfect on this song, you would get (p=10)*B, which is 80,000,000. In fact, the maximum possible
|
Note: if you got all Perfect on this song, you would get (p=10)*B, which is 80,000,000. In fact, the maximum possible
|
||||||
score for any song is the number of feet difficulty X 10,000,000.
|
score for any song is the number of feet difficulty X 10,000,000.
|
||||||
*/
|
*/
|
||||||
AddScore( scoreOfLastTap, failed ); // only score once per row
|
AddScore( scoreOfLastTap ); // only score once per row
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -394,14 +399,14 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ScoreKeeperMAX2::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore, bool failed)
|
void ScoreKeeperMAX2::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
|
||||||
{
|
{
|
||||||
// update dance points totals
|
// update dance points totals
|
||||||
GAMESTATE->m_CurStageStats.iHoldNoteScores[m_PlayerNumber][holdScore] ++;
|
GAMESTATE->m_CurStageStats.iHoldNoteScores[m_PlayerNumber][holdScore] ++;
|
||||||
GAMESTATE->m_CurStageStats.iActualDancePoints[m_PlayerNumber] += HoldNoteScoreToDancePoints( holdScore );
|
GAMESTATE->m_CurStageStats.iActualDancePoints[m_PlayerNumber] += HoldNoteScoreToDancePoints( holdScore );
|
||||||
|
|
||||||
if( holdScore == HNS_OK )
|
if( holdScore == HNS_OK )
|
||||||
AddScore( TNS_MARVELOUS , failed);
|
AddScore( TNS_MARVELOUS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,15 +30,15 @@ class ScoreKeeperMAX2: public ScoreKeeper
|
|||||||
|
|
||||||
const vector<Notes*>& apNotes;
|
const vector<Notes*>& apNotes;
|
||||||
|
|
||||||
void AddScore( TapNoteScore score, bool failed);
|
void AddScore( TapNoteScore score );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScoreKeeperMAX2( const vector<Notes*>& apNotes, PlayerNumber pn);
|
ScoreKeeperMAX2( const vector<Notes*>& apNotes, PlayerNumber pn);
|
||||||
|
|
||||||
void OnNextSong( int iSongInCourseIndex, Notes* pNotes ); // before a song plays (called multiple times if course)
|
void OnNextSong( int iSongInCourseIndex, Notes* pNotes ); // before a song plays (called multiple times if course)
|
||||||
|
|
||||||
void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow, bool failed );
|
void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow );
|
||||||
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore, bool failed );
|
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
|
||||||
|
|
||||||
int TapNoteScoreToDancePoints( TapNoteScore tns );
|
int TapNoteScoreToDancePoints( TapNoteScore tns );
|
||||||
int HoldNoteScoreToDancePoints( HoldNoteScore hns );
|
int HoldNoteScoreToDancePoints( HoldNoteScore hns );
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ void ScoreKeeperRave::OnNextSong( int iSongInCourseIndex, Notes* pNotes )
|
|||||||
|
|
||||||
#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( TapNoteScore scoreOfLastTap, int iNumTapsInRow, bool failed)
|
void ScoreKeeperRave::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow )
|
||||||
{
|
{
|
||||||
AttackLevel oldAL = (AttackLevel)(int)GAMESTATE->m_fSuperMeter[m_PlayerNumber];
|
AttackLevel oldAL = (AttackLevel)(int)GAMESTATE->m_fSuperMeter[m_PlayerNumber];
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ void ScoreKeeperRave::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreKeeperRave::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore, bool failed )
|
void ScoreKeeperRave::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ public:
|
|||||||
ScoreKeeperRave(PlayerNumber pn);
|
ScoreKeeperRave(PlayerNumber pn);
|
||||||
virtual void Update( float fDelta );
|
virtual void Update( float fDelta );
|
||||||
virtual void OnNextSong( int iSongInCourseIndex, Notes* pNotes ); // before a song plays (called multiple times if course)
|
virtual void OnNextSong( int iSongInCourseIndex, Notes* pNotes ); // before a song plays (called multiple times if course)
|
||||||
virtual void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow, bool failed);
|
virtual void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow );
|
||||||
virtual void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore, bool failed );
|
virtual void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
|
||||||
virtual int TapNoteScoreToDancePoints( TapNoteScore tns ) { return 0; };
|
virtual int TapNoteScoreToDancePoints( TapNoteScore tns ) { return 0; };
|
||||||
virtual int HoldNoteScoreToDancePoints( HoldNoteScore hns ) { return 0; };
|
virtual int HoldNoteScoreToDancePoints( HoldNoteScore hns ) { return 0; };
|
||||||
virtual int GetPossibleDancePoints( const NoteData* pNoteData ) { return 0; };
|
virtual int GetPossibleDancePoints( const NoteData* pNoteData ) { return 0; };
|
||||||
|
|||||||
Reference in New Issue
Block a user