fix crash on step if NULL life meter

This commit is contained in:
Chris Danford
2003-07-08 20:56:25 +00:00
parent 332c2b318c
commit 19d8a3de4c
6 changed files with 25 additions and 20 deletions
+4 -4
View File
@@ -665,10 +665,10 @@ void Player::HandleTapRowScore( unsigned row )
return;
if(m_pPrimaryScoreKeeper)
m_pPrimaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow, m_pLifeMeter->FailedEarlier() );
m_pPrimaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow );
if(m_pSecondaryScoreKeeper)
m_pSecondaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow, m_pLifeMeter->FailedEarlier() );
m_pSecondaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow );
if (m_pScore)
m_pScore->SetScore(GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber]);
@@ -698,9 +698,9 @@ void Player::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
return;
if(m_pPrimaryScoreKeeper)
m_pPrimaryScoreKeeper->HandleHoldScore(holdScore, tapScore, m_pLifeMeter->FailedEarlier());
m_pPrimaryScoreKeeper->HandleHoldScore(holdScore, tapScore );
if(m_pSecondaryScoreKeeper)
m_pSecondaryScoreKeeper->HandleHoldScore(holdScore, tapScore, m_pLifeMeter->FailedEarlier());
m_pSecondaryScoreKeeper->HandleHoldScore(holdScore, tapScore );
if (m_pScore)
m_pScore->SetScore(GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber]);
+2 -2
View File
@@ -44,8 +44,8 @@ public:
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 HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore, bool failed ) = 0;
virtual void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow ) = 0;
virtual void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ) = 0;
virtual int TapNoteScoreToDancePoints( TapNoteScore tns ) = 0;
virtual int HoldNoteScoreToDancePoints( HoldNoteScore hns ) = 0;
+12 -7
View File
@@ -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
@@ -198,7 +198,11 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score, bool failed)
int iScoreMultiplier = (m_iMaxPossiblePoints / (10*sum));
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 )
{
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 (!failed) m_iScore += m_iPointBonus;
if (!GAMESTATE->m_CurStageStats.bFailed[m_PlayerNumber])
m_iScore += m_iPointBonus;
if ( m_bIsLastSongInCourse )
{
m_iScore += 100000000 - m_iMaxScoreSoFar;
@@ -231,7 +236,7 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score, bool failed)
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 );
@@ -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
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
GAMESTATE->m_CurStageStats.iHoldNoteScores[m_PlayerNumber][holdScore] ++;
GAMESTATE->m_CurStageStats.iActualDancePoints[m_PlayerNumber] += HoldNoteScoreToDancePoints( holdScore );
if( holdScore == HNS_OK )
AddScore( TNS_MARVELOUS , failed);
AddScore( TNS_MARVELOUS );
}
+3 -3
View File
@@ -30,15 +30,15 @@ class ScoreKeeperMAX2: public ScoreKeeper
const vector<Notes*>& apNotes;
void AddScore( TapNoteScore score, bool failed);
void AddScore( TapNoteScore score );
public:
ScoreKeeperMAX2( const vector<Notes*>& apNotes, PlayerNumber pn);
void OnNextSong( int iSongInCourseIndex, Notes* pNotes ); // before a song plays (called multiple times if course)
void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow, bool failed );
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore, bool failed );
void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow );
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
int TapNoteScoreToDancePoints( TapNoteScore tns );
int HoldNoteScoreToDancePoints( HoldNoteScore hns );
+2 -2
View File
@@ -36,7 +36,7 @@ void ScoreKeeperRave::OnNextSong( int iSongInCourseIndex, Notes* pNotes )
#define CROSSED( val ) (fOld < val && fNew >= val)
#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];
@@ -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 )
{
}
+2 -2
View File
@@ -23,8 +23,8 @@ public:
ScoreKeeperRave(PlayerNumber pn);
virtual void Update( float fDelta );
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 HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore, bool failed );
virtual void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow );
virtual void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
virtual int TapNoteScoreToDancePoints( TapNoteScore tns ) { return 0; };
virtual int HoldNoteScoreToDancePoints( HoldNoteScore hns ) { return 0; };
virtual int GetPossibleDancePoints( const NoteData* pNoteData ) { return 0; };