Change ScoreKeeper's api to take TapNotes instead of the scores.

This commit is contained in:
Steve Checkoway
2006-07-10 05:15:52 +00:00
parent 5a01cb9c3f
commit 1aa51dd1d1
7 changed files with 46 additions and 36 deletions
+18 -15
View File
@@ -689,11 +689,14 @@ void Player::Update( float fDeltaTime )
if( m_pNoteField )
m_pNoteField->DidHoldNote( iTrack, HNS_Held, bBright ); // bright ghost flash
}
tn.HoldResult.fLife = fLife;
tn.HoldResult.hns = hns;
if( hns != HNS_None )
{
/* this note has been judged */
HandleHoldScore( hns, tns );
HandleHoldScore( tn );
if( m_pPlayerStageStats != NULL )
m_pPlayerStageStats->hnsLast = hns;
@@ -702,9 +705,6 @@ void Player::Update( float fDeltaTime )
m_vHoldJudgment[iTrack]->SetHoldJudgment( hns );
}
tn.HoldResult.fLife = fLife;
tn.HoldResult.hns = hns;
}
}
@@ -1277,9 +1277,9 @@ void Player::HandleStep( int col, const RageTimer &tm, bool bHeld )
NSMAN->ReportTiming( fNoteOffset,pn );
if( m_pPrimaryScoreKeeper )
m_pPrimaryScoreKeeper->HandleTapScore( score );
m_pPrimaryScoreKeeper->HandleTapScore( tn );
if( m_pSecondaryScoreKeeper )
m_pSecondaryScoreKeeper->HandleTapScore( score );
m_pSecondaryScoreKeeper->HandleTapScore( tn );
switch( tn.type )
{
@@ -1569,7 +1569,8 @@ void Player::RandomizeNotes( int iNoteRow )
void Player::HandleTapRowScore( unsigned row )
{
TapNoteScore scoreOfLastTap = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, row ).result.tns;
const TapNote &lastTN = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, row );
TapNoteScore scoreOfLastTap = lastTN.result.tns;
int iNumTapsInRow = m_NoteData.GetNumTracksWithTapOrHoldHead(row);
ASSERT_M( iNumTapsInRow > 0, ssprintf("%d, %u",iNumTapsInRow,row) );
@@ -1619,9 +1620,9 @@ void Player::HandleTapRowScore( unsigned row )
const int iOldCombo = iCurCombo;
if( m_pPrimaryScoreKeeper != NULL )
m_pPrimaryScoreKeeper->HandleTapRowScore( scoreOfLastTap, iNumTapsInRow );
m_pPrimaryScoreKeeper->HandleTapRowScore( lastTN, iNumTapsInRow );
if( m_pSecondaryScoreKeeper != NULL )
m_pSecondaryScoreKeeper->HandleTapRowScore( scoreOfLastTap, iNumTapsInRow );
m_pSecondaryScoreKeeper->HandleTapRowScore( lastTN, iNumTapsInRow );
if( m_pPlayerStageStats )
{
@@ -1713,8 +1714,10 @@ void Player::HandleTapRowScore( unsigned row )
}
void Player::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
void Player::HandleHoldScore( const TapNote &tn )
{
HoldNoteScore holdScore = tn.HoldResult.hns;
TapNoteScore tapScore = tn.result.tns;
bool NoCheating = true;
#ifdef DEBUG
NoCheating = false;
@@ -1726,10 +1729,10 @@ void Player::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
if( NoCheating && m_pPlayerState->m_PlayerController == PC_AUTOPLAY )
return;
if(m_pPrimaryScoreKeeper)
m_pPrimaryScoreKeeper->HandleHoldScore(holdScore, tapScore );
if(m_pSecondaryScoreKeeper)
m_pSecondaryScoreKeeper->HandleHoldScore(holdScore, tapScore );
if( m_pPrimaryScoreKeeper )
m_pPrimaryScoreKeeper->HandleHoldScore( tn );
if( m_pSecondaryScoreKeeper )
m_pSecondaryScoreKeeper->HandleHoldScore( tn );
// TODO: Remove use of PlayerNumber.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
+1 -1
View File
@@ -82,7 +82,7 @@ protected:
void DisplayJudgedRow( int iIndexThatWasSteppedOn, TapNoteScore score, int iTrack );
void OnRowCompletelyJudged( int iStepIndex );
void HandleTapRowScore( unsigned row );
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
void HandleHoldScore( const TapNote &tn );
void DrawTapJudgments();
void DrawHoldJudgments();
+5 -6
View File
@@ -11,15 +11,14 @@
* Results are injected directly into GameState.
*/
#include "Attack.h"
#include "GameConstantsAndTypes.h" // for TapNoteScore and HoldNoteScore
class NoteData;
class Inventory;
class Song;
class Steps;
class PlayerState;
class PlayerStageStats;
struct TapNote;
struct AttackArray;
class ScoreKeeper
{
@@ -47,9 +46,9 @@ public:
/* 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 HandleTapScore( TapNoteScore score ) = 0;
virtual void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow ) = 0;
virtual void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ) = 0;
virtual void HandleTapScore( const TapNote &tn ) = 0;
virtual void HandleTapRowScore( const TapNote &lastTN, int iNumTapsInRow ) = 0;
virtual void HandleHoldScore( const TapNote &tn ) = 0;
};
#endif
+8 -3
View File
@@ -332,8 +332,10 @@ void ScoreKeeperNormal::AddScore( TapNoteScore score )
// LOG->Trace( "score: %i", iScore );
}
void ScoreKeeperNormal::HandleTapScore( TapNoteScore score )
void ScoreKeeperNormal::HandleTapScore( const TapNote &tn )
{
TapNoteScore score = tn.result.tns;
if( score == TNS_HitMine )
{
if( !m_pPlayerStageStats->bFailed )
@@ -346,9 +348,10 @@ void ScoreKeeperNormal::HandleTapScore( TapNoteScore score )
}
}
void ScoreKeeperNormal::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow )
void ScoreKeeperNormal::HandleTapRowScore( const TapNote &lastTN, int iNumTapsInRow )
{
ASSERT( iNumTapsInRow >= 1 );
TapNoteScore scoreOfLastTap = lastTN.result.tns;
// Update dance points.
if( !m_pPlayerStageStats->bFailed )
@@ -417,8 +420,10 @@ void ScoreKeeperNormal::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNum
}
void ScoreKeeperNormal::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
void ScoreKeeperNormal::HandleHoldScore( const TapNote &tn )
{
HoldNoteScore holdScore = tn.HoldResult.hns;
// update dance points totals
if( !m_pPlayerStageStats->bFailed )
m_pPlayerStageStats->iActualDancePoints += HoldNoteScoreToDancePoints( holdScore );
+3 -3
View File
@@ -52,9 +52,9 @@ public:
// before a song plays (called multiple times if course)
void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData );
void HandleTapScore( TapNoteScore score );
void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow );
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
void HandleTapScore( const TapNote &tn );
void HandleTapRowScore( const TapNote &lastTN, int iNumTapsInRow );
void HandleHoldScore( const TapNote &tn );
// This must be calculated using only cached radar values so that we can
// do it quickly.
+8 -5
View File
@@ -8,7 +8,7 @@
#include "PrefsManager.h"
#include "ThemeMetric.h"
#include "PlayerState.h"
#include "NoteTypes.h"
ThemeMetric<float> ATTACK_DURATION_SECONDS ("ScoreKeeperRave","AttackDurationSeconds");
@@ -23,8 +23,9 @@ void ScoreKeeperRave::OnNextSong( int iSongInCourseIndex, const Steps* pSteps, c
}
void ScoreKeeperRave::HandleTapScore( TapNoteScore score )
void ScoreKeeperRave::HandleTapScore( const TapNote &tn )
{
TapNoteScore score = tn.result.tns;
float fPercentToMove = 0;
switch( score )
{
@@ -36,12 +37,13 @@ void ScoreKeeperRave::HandleTapScore( TapNoteScore score )
#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 )
void ScoreKeeperRave::HandleTapRowScore( const TapNote &lastTN, int iNumTapsInRow )
{
TapNoteScore scoreOfLastTap = lastTN.result.tns;
float fPercentToMove;
switch( scoreOfLastTap )
{
default: ASSERT(0);
DEFAULT_FAIL( scoreOfLastTap );
case TNS_W1: fPercentToMove = PREFSMAN->m_fSuperMeterPercentChange[SE_W1]; break;
case TNS_W2: fPercentToMove = PREFSMAN->m_fSuperMeterPercentChange[SE_W2]; break;
case TNS_W3: fPercentToMove = PREFSMAN->m_fSuperMeterPercentChange[SE_W3]; break;
@@ -52,8 +54,9 @@ void ScoreKeeperRave::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
AddSuperMeterDelta( fPercentToMove );
}
void ScoreKeeperRave::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
void ScoreKeeperRave::HandleHoldScore( const TapNote &tn )
{
TapNoteScore tapScore = tn.result.tns;
float fPercentToMove = 0;
switch( tapScore )
{
+3 -3
View File
@@ -13,9 +13,9 @@ public:
ScoreKeeperRave( PlayerState* pPlayerState, PlayerStageStats* pPlayerStageStats );
virtual ~ScoreKeeperRave() { }
void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); // before a song plays (called multiple times if course)
void HandleTapScore( TapNoteScore score );
void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow );
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
void HandleTapScore( const TapNote &tn );
void HandleTapRowScore( const TapNote &lastTN, int iNumTapsInRow );
void HandleHoldScore( const TapNote &tn );
protected:
void LaunchAttack( AttackLevel al );