have gameplay objects access PlayerStageStats though a member pointer and not directly access g_CurStageStats.

This commit is contained in:
Chris Danford
2004-12-22 07:31:27 +00:00
parent 7d285a5731
commit a1340dd1c0
10 changed files with 141 additions and 94 deletions
+53 -30
View File
@@ -61,6 +61,7 @@ static const float StepSearchDistance = 1.0f;
PlayerMinus::PlayerMinus() PlayerMinus::PlayerMinus()
{ {
m_pPlayerState = NULL; m_pPlayerState = NULL;
m_pPlayerStageStats = NULL;
m_fNoteFieldHeight = 0; m_fNoteFieldHeight = 0;
m_pLifeMeter = NULL; m_pLifeMeter = NULL;
@@ -92,6 +93,7 @@ PlayerMinus::~PlayerMinus()
void PlayerMinus::Load( void PlayerMinus::Load(
PlayerState* pPlayerState, PlayerState* pPlayerState,
const NoteData& noteData, const NoteData& noteData,
PlayerStageStats* pPlayerStageStats,
LifeMeter* pLM, LifeMeter* pLM,
CombinedLifeMeter* pCombinedLM, CombinedLifeMeter* pCombinedLM,
ScoreDisplay* pScoreDisplay, ScoreDisplay* pScoreDisplay,
@@ -104,6 +106,7 @@ void PlayerMinus::Load(
m_iDCState = AS2D_IDLE; m_iDCState = AS2D_IDLE;
m_pPlayerState = pPlayerState; m_pPlayerState = pPlayerState;
m_pPlayerStageStats = pPlayerStageStats;
m_pLifeMeter = pLM; m_pLifeMeter = pLM;
m_pCombinedLifeMeter = pCombinedLM; m_pCombinedLifeMeter = pCombinedLM;
m_pScoreDisplay = pScoreDisplay; m_pScoreDisplay = pScoreDisplay;
@@ -127,7 +130,8 @@ void PlayerMinus::Load(
// init steps // init steps
m_NoteData.Init(); m_NoteData.Init();
bool bOniDead = GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && g_CurStageStats.m_player[pn].bFailed; bool bOniDead = GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY &&
(m_pPlayerStageStats == NULL || m_pPlayerStageStats->bFailed);
if( !bOniDead ) if( !bOniDead )
m_NoteData.CopyAll( noteData ); m_NoteData.CopyAll( noteData );
@@ -137,7 +141,8 @@ void PlayerMinus::Load(
m_Judgment.StopTweening(); m_Judgment.StopTweening();
// m_Combo.Reset(); // don't reset combos between songs in a course! // m_Combo.Reset(); // don't reset combos between songs in a course!
m_Combo.Init( pn ); m_Combo.Init( pn );
m_Combo.SetCombo( g_CurStageStats.m_player[pn].iCurCombo, g_CurStageStats.m_player[pn].iCurMissCombo ); // combo can persist between songs and games if( m_pPlayerStageStats )
m_Combo.SetCombo( m_pPlayerStageStats->iCurCombo, m_pPlayerStageStats->iCurMissCombo ); // combo can persist between songs and games
m_AttackDisplay.Init( m_pPlayerState ); m_AttackDisplay.Init( m_pPlayerState );
m_Judgment.Reset(); m_Judgment.Reset();
@@ -452,10 +457,8 @@ void PlayerMinus::Update( float fDeltaTime )
int ms_error = (hns == HNS_OK)? 0:MAX_PRO_TIMING_ERROR; int ms_error = (hns == HNS_OK)? 0:MAX_PRO_TIMING_ERROR;
// TODO: Remove use of PlayerNumber. if( m_pPlayerStageStats )
PlayerNumber pn = m_pPlayerState->m_PlayerNumber; m_pPlayerStageStats->iTotalError += ms_error;
g_CurStageStats.m_player[pn].iTotalError += ms_error;
if( hns == HNS_NG ) /* don't show a 0 for an OK */ if( hns == HNS_NG ) /* don't show a 0 for an OK */
m_ProTimingDisplay.SetJudgment( ms_error, TNS_MISS ); m_ProTimingDisplay.SetJudgment( ms_error, TNS_MISS );
} }
@@ -697,15 +700,17 @@ int PlayerMinus::GetClosestNote( int col, float fBeat, float fMaxBeatsAhead, flo
void PlayerMinus::Step( int col, RageTimer tm ) void PlayerMinus::Step( int col, RageTimer tm )
{ {
// TODO: Remove use of PlayerNumber. bool bOniDead =
PlayerNumber pn = m_pPlayerState->m_PlayerNumber; GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY &&
m_pPlayerStageStats &&
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && g_CurStageStats.m_player[pn].bFailed ) // Oni dead m_pPlayerStageStats->bFailed;
if( bOniDead )
return; // do nothing return; // do nothing
//LOG->Trace( "PlayerMinus::HandlePlayerStep()" ); //LOG->Trace( "PlayerMinus::HandlePlayerStep()" );
ASSERT( col >= 0 && col <= m_NoteData.GetNumTracks() ); ASSERT_M( col >= 0 && col <= m_NoteData.GetNumTracks(), ssprintf("%i, %i", col, m_NoteData.GetNumTracks()) );
float fPositionSeconds = GAMESTATE->m_fMusicSeconds; float fPositionSeconds = GAMESTATE->m_fMusicSeconds;
fPositionSeconds -= tm.Ago(); fPositionSeconds -= tm.Ago();
@@ -947,7 +952,8 @@ void PlayerMinus::Step( int col, RageTimer tm )
// TODO: Remove use of PlayerNumber. // TODO: Remove use of PlayerNumber.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber; PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
g_CurStageStats.m_player[pn].iTotalError += ms_error; if( m_pPlayerStageStats )
m_pPlayerStageStats->iTotalError += ms_error;
if (!m_pPlayerState->m_PlayerOptions.m_fBlind) if (!m_pPlayerState->m_PlayerOptions.m_fBlind)
m_ProTimingDisplay.SetJudgment( ms_error, score ); m_ProTimingDisplay.SetJudgment( ms_error, score );
} }
@@ -1097,7 +1103,7 @@ void PlayerMinus::OnRowCompletelyJudged( int iIndexThatWasSteppedOn )
// TODO: Remove use of PlayerNumber. // TODO: Remove use of PlayerNumber.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber; PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
bool bBright = g_CurStageStats.m_player[pn].iCurCombo>(int)BRIGHT_GHOST_COMBO_THRESHOLD; bool bBright = m_pPlayerStageStats && m_pPlayerStageStats->iCurCombo>(int)BRIGHT_GHOST_COMBO_THRESHOLD;
if( m_pNoteField ) if( m_pNoteField )
m_pNoteField->DidTapNote( c, score, bBright ); m_pNoteField->DidTapNote( c, score, bBright );
} }
@@ -1160,10 +1166,13 @@ void PlayerMinus::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
// TODO: Remove use of PlayerNumber. // TODO: Remove use of PlayerNumber.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber; PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
g_CurStageStats.m_player[pn].iTotalError += MAX_PRO_TIMING_ERROR; if( m_pPlayerStageStats )
{
m_pPlayerStageStats->iTotalError += MAX_PRO_TIMING_ERROR;
m_ProTimingDisplay.SetJudgment( MAX_PRO_TIMING_ERROR, TNS_MISS ); m_ProTimingDisplay.SetJudgment( MAX_PRO_TIMING_ERROR, TNS_MISS );
} }
} }
}
if( MissedNoteOnThisRow ) if( MissedNoteOnThisRow )
{ {
@@ -1288,43 +1297,45 @@ void PlayerMinus::HandleTapRowScore( unsigned row )
if( NoCheating && m_pPlayerState->m_PlayerController == PC_AUTOPLAY ) if( NoCheating && m_pPlayerState->m_PlayerController == PC_AUTOPLAY )
return; return;
// TODO: Remove use of PlayerNumber.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
/* Update miss combo, and handle "combo stopped" messages. */ /* Update miss combo, and handle "combo stopped" messages. */
int &iCurCombo = g_CurStageStats.m_player[pn].iCurCombo; int iDummy = 0;
int &iCurCombo = m_pPlayerStageStats ? m_pPlayerStageStats->iCurCombo : iDummy;
switch( scoreOfLastTap ) switch( scoreOfLastTap )
{ {
case TNS_MARVELOUS: case TNS_MARVELOUS:
case TNS_PERFECT: case TNS_PERFECT:
case TNS_GREAT: case TNS_GREAT:
g_CurStageStats.m_player[pn].iCurMissCombo = 0; iCurCombo = 0;
SCREENMAN->PostMessageToTopScreen( SM_MissComboAborted, 0 ); SCREENMAN->PostMessageToTopScreen( SM_MissComboAborted, 0 );
break; break;
case TNS_MISS: case TNS_MISS:
++g_CurStageStats.m_player[pn].iCurMissCombo; ++iCurCombo;
m_iDCState = AS2D_MISS; // update dancing 2d characters that may have missed a note m_iDCState = AS2D_MISS; // update dancing 2d characters that may have missed a note
case TNS_GOOD: case TNS_GOOD:
case TNS_BOO: case TNS_BOO:
if( iCurCombo > 50 ) if( iCurCombo > 50 )
SCREENMAN->PostMessageToTopScreen( SM_ComboStopped, 0 ); SCREENMAN->PostMessageToTopScreen( SM_ComboStopped, 0 );
iCurCombo = 0; iCurCombo = 0;
break; break;
default: default:
ASSERT( 0 ); ASSERT( 0 );
} }
/* The score keeper updates the hit combo. Remember the old combo for handling announcers. */ /* The score keeper updates the hit combo. Remember the old combo for handling announcers. */
const int iOldCombo = g_CurStageStats.m_player[pn].iCurCombo; const int iOldCombo = 0;
if( m_pPlayerStageStats )
m_pPlayerStageStats->iCurCombo;
if(m_pPrimaryScoreKeeper) if(m_pPrimaryScoreKeeper)
m_pPrimaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow ); m_pPrimaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow );
if(m_pSecondaryScoreKeeper) if(m_pSecondaryScoreKeeper)
m_pSecondaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow ); m_pSecondaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow );
m_Combo.SetCombo( g_CurStageStats.m_player[pn].iCurCombo, g_CurStageStats.m_player[pn].iCurMissCombo ); if( m_pPlayerStageStats )
m_Combo.SetCombo( m_pPlayerStageStats->iCurCombo, m_pPlayerStageStats->iCurMissCombo );
#define CROSSED( x ) (iOldCombo<x && iCurCombo>=x) #define CROSSED( x ) (iOldCombo<x && iCurCombo>=x)
if ( CROSSED(100) ) if ( CROSSED(100) )
@@ -1352,12 +1363,17 @@ void PlayerMinus::HandleTapRowScore( unsigned row )
#undef CROSSED #undef CROSSED
// new max combo // new max combo
g_CurStageStats.m_player[pn].iMaxCombo = max(g_CurStageStats.m_player[pn].iMaxCombo, iCurCombo); if( m_pPlayerStageStats )
m_pPlayerStageStats->iMaxCombo = max(m_pPlayerStageStats->iMaxCombo, iCurCombo);
/* Use the real current beat, not the beat we've been passed. That's because we /* Use the real current beat, not the beat we've been passed. That's because we
* want to record the current life/combo to the current time; eg. if it's a MISS, * want to record the current life/combo to the current time; eg. if it's a MISS,
* the beat we're registering is in the past, but the life is changing now. */ * the beat we're registering is in the past, but the life is changing now. */
g_CurStageStats.m_player[pn].UpdateComboList( g_CurStageStats.m_player[pn].fAliveSeconds, false ); if( m_pPlayerStageStats )
m_pPlayerStageStats->UpdateComboList( m_pPlayerStageStats->fAliveSeconds, false );
// TODO: Remove use of PlayerNumber.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
float life = -1; float life = -1;
if( m_pLifeMeter ) if( m_pLifeMeter )
@@ -1371,12 +1387,15 @@ void PlayerMinus::HandleTapRowScore( unsigned row )
life = 1.0f - life; life = 1.0f - life;
} }
if( life != -1 ) if( life != -1 )
g_CurStageStats.m_player[pn].SetLifeRecordAt( life, g_CurStageStats.m_player[pn].fAliveSeconds ); if( m_pPlayerStageStats )
m_pPlayerStageStats->SetLifeRecordAt( life, m_pPlayerStageStats->fAliveSeconds );
if (m_pScoreDisplay) if (m_pScoreDisplay)
m_pScoreDisplay->SetScore(g_CurStageStats.m_player[pn].iScore); if( m_pPlayerStageStats )
m_pScoreDisplay->SetScore(m_pPlayerStageStats->iScore);
if (m_pSecondaryScoreDisplay) if (m_pSecondaryScoreDisplay)
m_pSecondaryScoreDisplay->SetScore(g_CurStageStats.m_player[pn].iScore); if( m_pPlayerStageStats )
m_pSecondaryScoreDisplay->SetScore(m_pPlayerStageStats->iScore);
if( m_pLifeMeter ) { if( m_pLifeMeter ) {
m_pLifeMeter->ChangeLife( scoreOfLastTap ); m_pLifeMeter->ChangeLife( scoreOfLastTap );
@@ -1411,9 +1430,11 @@ void PlayerMinus::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScor
PlayerNumber pn = m_pPlayerState->m_PlayerNumber; PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
if (m_pScoreDisplay) if (m_pScoreDisplay)
m_pScoreDisplay->SetScore(g_CurStageStats.m_player[pn].iScore); if( m_pPlayerStageStats )
m_pScoreDisplay->SetScore(m_pPlayerStageStats->iScore);
if (m_pSecondaryScoreDisplay) if (m_pSecondaryScoreDisplay)
m_pSecondaryScoreDisplay->SetScore(g_CurStageStats.m_player[pn].iScore); if( m_pPlayerStageStats )
m_pSecondaryScoreDisplay->SetScore(m_pPlayerStageStats->iScore);
if( m_pLifeMeter ) if( m_pLifeMeter )
{ {
@@ -1443,6 +1464,7 @@ void PlayerMinus::FadeToFail()
void Player::Load( void Player::Load(
PlayerState* pPlayerState, PlayerState* pPlayerState,
const NoteData& noteData, const NoteData& noteData,
PlayerStageStats* pPlayerStageStats,
LifeMeter* pLM, LifeMeter* pLM,
CombinedLifeMeter* pCombinedLM, CombinedLifeMeter* pCombinedLM,
ScoreDisplay* pScoreDisplay, ScoreDisplay* pScoreDisplay,
@@ -1454,6 +1476,7 @@ void Player::Load(
PlayerMinus::Load( PlayerMinus::Load(
pPlayerState, pPlayerState,
noteData, noteData,
pPlayerStageStats,
pLM, pLM,
pCombinedLM, pCombinedLM,
pScoreDisplay, pScoreDisplay,
+4 -6
View File
@@ -3,12 +3,7 @@
#ifndef PLAYER_H #ifndef PLAYER_H
#define PLAYER_H #define PLAYER_H
#include "PrefsManager.h" // for GameplayStatistics
#include "Sprite.h"
#include "BitmapText.h"
#include "ActorFrame.h" #include "ActorFrame.h"
#include "RandomSample.h"
#include "Judgment.h" #include "Judgment.h"
#include "HoldJudgment.h" #include "HoldJudgment.h"
#include "Combo.h" #include "Combo.h"
@@ -25,10 +20,10 @@ class LifeMeter;
class CombinedLifeMeter; class CombinedLifeMeter;
class ScoreKeeper; class ScoreKeeper;
class Inventory; class Inventory;
struct PlayerStageStats;
#define SAMPLE_COUNT 16 #define SAMPLE_COUNT 16
class PlayerMinus : public ActorFrame class PlayerMinus : public ActorFrame
{ {
public: public:
@@ -41,6 +36,7 @@ public:
void Load( void Load(
PlayerState* pPlayerState, PlayerState* pPlayerState,
const NoteData& noteData, const NoteData& noteData,
PlayerStageStats* pPlayerStageStats,
LifeMeter* pLM, LifeMeter* pLM,
CombinedLifeMeter* pCombinedLM, CombinedLifeMeter* pCombinedLM,
ScoreDisplay* pScoreDisplay, ScoreDisplay* pScoreDisplay,
@@ -75,6 +71,7 @@ protected:
int GetClosestNote( int col, float fBeat, float fMaxBeatsAhead, float fMaxBeatsBehind, bool bAllowGraded ) const; int GetClosestNote( int col, float fBeat, float fMaxBeatsAhead, float fMaxBeatsBehind, bool bAllowGraded ) const;
PlayerState* m_pPlayerState; PlayerState* m_pPlayerState;
PlayerStageStats* m_pPlayerStageStats;
float m_fNoteFieldHeight; float m_fNoteFieldHeight;
float m_fOffset[SAMPLE_COUNT]; // for AutoSync float m_fOffset[SAMPLE_COUNT]; // for AutoSync
@@ -117,6 +114,7 @@ public:
void Load( void Load(
PlayerState* pPlayerState, PlayerState* pPlayerState,
const NoteData& noteData, const NoteData& noteData,
PlayerStageStats* pPlayerStageStats,
LifeMeter* pLM, LifeMeter* pLM,
CombinedLifeMeter* pCombinedLM, CombinedLifeMeter* pCombinedLM,
ScoreDisplay* pScoreDisplay, ScoreDisplay* pScoreDisplay,
+3 -1
View File
@@ -17,12 +17,14 @@ class NoteData;
class Inventory; class Inventory;
class Steps; class Steps;
struct PlayerState; struct PlayerState;
struct PlayerStageStats;
class ScoreKeeper: public Actor class ScoreKeeper: public Actor
{ {
protected: protected:
PlayerState* m_pPlayerState; PlayerState* m_pPlayerState;
PlayerStageStats* m_pPlayerStageStats;
/* Common toggles that this class handles directly: */ /* Common toggles that this class handles directly: */
@@ -31,7 +33,7 @@ protected:
// bool Stats_DoublesCount; // bool Stats_DoublesCount;
public: public:
ScoreKeeper(PlayerState* pPlayerState) { m_pPlayerState=pPlayerState; } ScoreKeeper(PlayerState* pPlayerState,PlayerStageStats* pPlayerStageStats) { m_pPlayerState=pPlayerState; m_pPlayerStageStats=pPlayerStageStats; }
virtual void DrawPrimitives() { } virtual void DrawPrimitives() { }
virtual void Update( float fDelta ) { } virtual void Update( float fDelta ) { }
+27 -37
View File
@@ -17,8 +17,13 @@
#include "PlayerState.h" #include "PlayerState.h"
#include "Style.h" #include "Style.h"
ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Steps*>& apSteps_, const vector<AttackArray> &asModifiers, PlayerState* pPlayerState ): ScoreKeeperMAX2::ScoreKeeperMAX2(
ScoreKeeper(pPlayerState), apSteps(apSteps_) const vector<Song*>& apSongs,
const vector<Steps*>& apSteps_,
const vector<AttackArray> &asModifiers,
PlayerState* pPlayerState,
PlayerStageStats* pPlayerStageStats ):
ScoreKeeper(pPlayerState,pPlayerStageStats), apSteps(apSteps_)
{ {
ASSERT( apSongs.size() == apSteps_.size() ); ASSERT( apSongs.size() == apSteps_.size() );
ASSERT( apSongs.size() == asModifiers.size() ); ASSERT( apSongs.size() == asModifiers.size() );
@@ -63,12 +68,7 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Ste
iTotalPossibleDancePoints += this->GetPossibleDancePoints( rvPre, rvPost ); iTotalPossibleDancePoints += this->GetPossibleDancePoints( rvPre, rvPost );
} }
// TODO: Move StageStats numbers into PlayerState. m_pPlayerStageStats->iPossibleDancePoints = iTotalPossibleDancePoints;
{
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
g_CurStageStats.m_player[pn].iPossibleDancePoints = iTotalPossibleDancePoints;
}
m_iScoreRemainder = 0; m_iScoreRemainder = 0;
m_iCurToastyCombo = 0; m_iCurToastyCombo = 0;
@@ -204,9 +204,7 @@ static int GetScore(int p, int B, int S, int n)
void ScoreKeeperMAX2::AddScore( TapNoteScore score ) void ScoreKeeperMAX2::AddScore( TapNoteScore score )
{ {
// TODO: Move StageStats numbers into PlayerState. int &iScore = m_pPlayerStageStats->iScore;
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
int &iScore = g_CurStageStats.m_player[pn].iScore;
/* /*
http://www.aaroninjapan.com/ddr2.html http://www.aaroninjapan.com/ddr2.html
@@ -266,7 +264,7 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
const int B = m_iMaxPossiblePoints/10; const int B = m_iMaxPossiblePoints/10;
// Don't use a multiplier if the player has failed // Don't use a multiplier if the player has failed
if( g_CurStageStats.m_player[pn].bFailedEarlier ) if( m_pPlayerStageStats->bFailedEarlier )
{ {
iScore += p; iScore += p;
// make score evenly divisible by 5 // make score evenly divisible by 5
@@ -279,8 +277,8 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
else else
{ {
iScore += GetScore(p, B, sum, m_iTapNotesHit); iScore += GetScore(p, B, sum, m_iTapNotesHit);
const int &iCurrentCombo = g_CurStageStats.m_player[pn].iCurCombo; const int &iCurrentCombo = m_pPlayerStageStats->iCurCombo;
g_CurStageStats.m_player[pn].iBonus += m_ComboBonusFactor[score] * iCurrentCombo; m_pPlayerStageStats->iBonus += m_ComboBonusFactor[score] * iCurrentCombo;
} }
/* Subtract the maximum this step could have been worth from the bonus. */ /* Subtract the maximum this step could have been worth from the bonus. */
@@ -288,7 +286,7 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
if ( m_iTapNotesHit == m_iNumTapsAndHolds && score >= TNS_PERFECT ) if ( m_iTapNotesHit == m_iNumTapsAndHolds && score >= TNS_PERFECT )
{ {
if (!g_CurStageStats.m_player[pn].bFailedEarlier) if (!m_pPlayerStageStats->bFailedEarlier)
iScore += m_iPointBonus; iScore += m_iPointBonus;
if ( m_bIsLastSongInCourse ) if ( m_bIsLastSongInCourse )
{ {
@@ -314,14 +312,11 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
void ScoreKeeperMAX2::HandleTapScore( TapNoteScore score ) void ScoreKeeperMAX2::HandleTapScore( TapNoteScore score )
{ {
// TODO: Move StageStats numbers into PlayerState.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
if( score == TNS_HIT_MINE ) if( score == TNS_HIT_MINE )
{ {
if( m_pPlayerState->m_HealthState != PlayerState::DEAD ) if( m_pPlayerState->m_HealthState != PlayerState::DEAD )
g_CurStageStats.m_player[pn].iActualDancePoints += TapNoteScoreToDancePoints( TNS_HIT_MINE ); m_pPlayerStageStats->iActualDancePoints += TapNoteScoreToDancePoints( TNS_HIT_MINE );
g_CurStageStats.m_player[pn].iTapNoteScores[TNS_HIT_MINE] += 1; m_pPlayerStageStats->iTapNoteScores[TNS_HIT_MINE] += 1;
} }
} }
@@ -329,14 +324,11 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
{ {
ASSERT( iNumTapsInRow >= 1 ); ASSERT( iNumTapsInRow >= 1 );
// TODO: Move StageStats numbers into PlayerState.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
// Update dance points. // Update dance points.
if( m_pPlayerState->m_HealthState != PlayerState::DEAD ) if( m_pPlayerState->m_HealthState != PlayerState::DEAD )
g_CurStageStats.m_player[pn].iActualDancePoints += TapNoteScoreToDancePoints( scoreOfLastTap ); m_pPlayerStageStats->iActualDancePoints += TapNoteScoreToDancePoints( scoreOfLastTap );
// update judged row totals // update judged row totals
g_CurStageStats.m_player[pn].iTapNoteScores[scoreOfLastTap] += 1; m_pPlayerStageStats->iTapNoteScores[scoreOfLastTap] += 1;
// //
// Regular combo // Regular combo
@@ -367,7 +359,7 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
TapNoteScore MinScoreToContinueCombo = GAMESTATE->m_PlayMode == PLAY_MODE_ONI? TNS_PERFECT:TNS_GREAT; TapNoteScore MinScoreToContinueCombo = GAMESTATE->m_PlayMode == PLAY_MODE_ONI? TNS_PERFECT:TNS_GREAT;
if( scoreOfLastTap >= MinScoreToContinueCombo ) if( scoreOfLastTap >= MinScoreToContinueCombo )
g_CurStageStats.m_player[pn].iCurCombo += ComboCountIfHit; m_pPlayerStageStats->iCurCombo += ComboCountIfHit;
AddScore( scoreOfLastTap ); // only score once per row AddScore( scoreOfLastTap ); // only score once per row
@@ -408,32 +400,30 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
// TODO: Remove indexing with PlayerNumber // TODO: Remove indexing with PlayerNumber
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
NSMAN->ReportScore(pn, scoreOfLastTap, NSMAN->ReportScore(pn, scoreOfLastTap,
g_CurStageStats.m_player[pn].iScore, m_pPlayerStageStats->iScore,
g_CurStageStats.m_player[pn].iCurCombo); m_pPlayerStageStats->iCurCombo);
} }
void ScoreKeeperMAX2::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ) void ScoreKeeperMAX2::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
{ {
// TODO: Move StageStats numbers into PlayerState.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
// update dance points totals // update dance points totals
if( m_pPlayerState->m_HealthState != PlayerState::DEAD ) if( m_pPlayerState->m_HealthState != PlayerState::DEAD )
g_CurStageStats.m_player[pn].iActualDancePoints += HoldNoteScoreToDancePoints( holdScore ); m_pPlayerStageStats->iActualDancePoints += HoldNoteScoreToDancePoints( holdScore );
g_CurStageStats.m_player[pn].iHoldNoteScores[holdScore] ++; m_pPlayerStageStats->iHoldNoteScores[holdScore] ++;
if( holdScore == HNS_OK ) if( holdScore == HNS_OK )
AddScore( TNS_MARVELOUS ); AddScore( TNS_MARVELOUS );
// TODO: Remove indexing with PlayerNumber
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
NSMAN->ReportScore( NSMAN->ReportScore(
pn, pn,
holdScore+7, holdScore+7,
g_CurStageStats.m_player[pn].iScore, m_pPlayerStageStats->iScore,
g_CurStageStats.m_player[pn].iCurCombo ); m_pPlayerStageStats->iCurCombo );
} }
+6 -1
View File
@@ -29,7 +29,12 @@ class ScoreKeeperMAX2: public ScoreKeeper
int m_ComboBonusFactor[NUM_TAP_NOTE_SCORES]; int m_ComboBonusFactor[NUM_TAP_NOTE_SCORES];
public: public:
ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Steps*>& apSteps, const vector<AttackArray> &asModifiers, PlayerState* pPlayerState); ScoreKeeperMAX2(
const vector<Song*>& apSongs,
const vector<Steps*>& apSteps,
const vector<AttackArray> &asModifiers,
PlayerState* pPlayerState,
PlayerStageStats* pPlayerStageStats );
// before a song plays (called multiple times if course) // before a song plays (called multiple times if course)
void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData );
+2 -1
View File
@@ -13,7 +13,8 @@
ThemeMetric<float> ATTACK_DURATION_SECONDS ("ScoreKeeperRave","AttackDurationSeconds"); ThemeMetric<float> ATTACK_DURATION_SECONDS ("ScoreKeeperRave","AttackDurationSeconds");
ScoreKeeperRave::ScoreKeeperRave( PlayerState* pPlayerState ) : ScoreKeeper(pPlayerState) ScoreKeeperRave::ScoreKeeperRave( PlayerState* pPlayerState, PlayerStageStats* pPlayerStageStats ) :
ScoreKeeper(pPlayerState,pPlayerStageStats)
{ {
} }
+1 -1
View File
@@ -11,7 +11,7 @@ class ScoreKeeperRave : public ScoreKeeper
{ {
public: public:
// Overrides // Overrides
ScoreKeeperRave( PlayerState* pPlayerState ); ScoreKeeperRave( PlayerState* pPlayerState, PlayerStageStats* pPlayerStageStats );
void Update( float fDelta ); void Update( float fDelta );
void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); // before a song plays (called multiple times if course) void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); // before a song plays (called multiple times if course)
void HandleTapScore( TapNoteScore score ); void HandleTapScore( TapNoteScore score );
+12 -2
View File
@@ -443,7 +443,17 @@ ScreenEdit::ScreenEdit( CString sName ) : Screen( sName )
/* XXX: Do we actually have to send real note data here, and to m_NoteFieldRecord? /* XXX: Do we actually have to send real note data here, and to m_NoteFieldRecord?
* (We load again on play/record.) */ * (We load again on play/record.) */
m_Player.Load( GAMESTATE->m_pPlayerState[PLAYER_1], noteData, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); m_Player.Load(
GAMESTATE->m_pPlayerState[PLAYER_1],
noteData,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL );
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_HUMAN; GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_HUMAN;
m_Player.SetXY( PLAYER_X, PLAYER_Y ); m_Player.SetXY( PLAYER_X, PLAYER_Y );
@@ -2095,7 +2105,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
SetupCourseAttacks(); SetupCourseAttacks();
m_Player.Load( GAMESTATE->m_pPlayerState[PLAYER_1], m_NoteFieldEdit, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); m_Player.Load( GAMESTATE->m_pPlayerState[PLAYER_1], m_NoteFieldEdit, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL );
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN; GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN;
m_rectRecordBack.StopTweening(); m_rectRecordBack.StopTweening();
+11 -3
View File
@@ -253,7 +253,12 @@ void ScreenGameplay::Init()
{ {
case PrefsManager::SCORING_MAX2: case PrefsManager::SCORING_MAX2:
case PrefsManager::SCORING_5TH: case PrefsManager::SCORING_5TH:
m_pPrimaryScoreKeeper[p] = new ScoreKeeperMAX2( m_apSongsQueue, m_vpStepsQueue[p], m_asModifiersQueue[p], GAMESTATE->m_pPlayerState[p] ); m_pPrimaryScoreKeeper[p] = new ScoreKeeperMAX2(
m_apSongsQueue,
m_vpStepsQueue[p],
m_asModifiersQueue[p],
GAMESTATE->m_pPlayerState[p],
&g_CurStageStats.m_player[p] );
break; break;
default: ASSERT(0); default: ASSERT(0);
} }
@@ -261,7 +266,9 @@ void ScreenGameplay::Init()
switch( GAMESTATE->m_PlayMode ) switch( GAMESTATE->m_PlayMode )
{ {
case PLAY_MODE_RAVE: case PLAY_MODE_RAVE:
m_pSecondaryScoreKeeper[p] = new ScoreKeeperRave( GAMESTATE->m_pPlayerState[p] ); m_pSecondaryScoreKeeper[p] = new ScoreKeeperRave(
GAMESTATE->m_pPlayerState[p],
&g_CurStageStats.m_player[p] );
break; break;
} }
} }
@@ -820,6 +827,7 @@ void ScreenGameplay::SetupSong( PlayerNumber p, int iSongIndex )
m_Player[p].Load( m_Player[p].Load(
GAMESTATE->m_pPlayerState[p], GAMESTATE->m_pPlayerState[p],
nd, nd,
&g_CurStageStats.m_player[p],
m_pLifeMeter[p], m_pLifeMeter[p],
m_pCombinedLifeMeter, m_pCombinedLifeMeter,
m_pPrimaryScoreDisplay[p], m_pPrimaryScoreDisplay[p],
@@ -1755,7 +1763,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
} }
} }
/* Nothing else cares about releases. */ /* Nothing below cares about releases. */
if(type == IET_RELEASE) return; if(type == IET_RELEASE) return;
// Handle special keys to adjust the offset // Handle special keys to adjust the offset
+11 -1
View File
@@ -151,7 +151,17 @@ ScreenHowToPlay::ScreenHowToPlay( CString sName ) : ScreenAttract( sName )
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_AUTOPLAY; GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_AUTOPLAY;
m_pPlayer = new Player; m_pPlayer = new Player;
m_pPlayer->Load( GAMESTATE->m_pPlayerState[PLAYER_1], m_NoteData, m_pLifeMeterBar, NULL, NULL, NULL, NULL, NULL, NULL ); m_pPlayer->Load(
GAMESTATE->m_pPlayerState[PLAYER_1],
m_NoteData,
NULL,
m_pLifeMeterBar,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL );
m_pPlayer->SetName( "Player" ); m_pPlayer->SetName( "Player" );
this->AddChild( m_pPlayer ); this->AddChild( m_pPlayer );
SET_XY_AND_ON_COMMAND( m_pPlayer ); SET_XY_AND_ON_COMMAND( m_pPlayer );