Move CurStageStats and vPlayedStageState out of GAMESTATE. Having

GameState.h depend on StageStats.h is too inconvenient.
This commit is contained in:
Glenn Maynard
2003-12-23 00:26:00 +00:00
parent ecd5fa36e0
commit 9170e91bcc
19 changed files with 165 additions and 140 deletions
+2 -1
View File
@@ -18,6 +18,7 @@
#include "GameState.h"
#include "song.h"
#include "Character.h"
#include "StageStats.h"
#define DC_X( choice ) THEME->GetMetricF("DancingCharacters",ssprintf("2DCharacterXP%d",choice+1))
#define DC_Y( choice ) THEME->GetMetricF("DancingCharacters",ssprintf("2DCharacterYP%d",choice+1))
@@ -332,7 +333,7 @@ void DancingCharacters::DrawPrimitives()
{
if( GAMESTATE->IsPlayerEnabled(p) )
{
bool bFailed = GAMESTATE->m_CurStageStats.bFailed[p];
bool bFailed = g_CurStageStats.bFailed[p];
bool bDanger = m_bDrawDangerLight;
DISPLAY->SetLighting( true );
+23 -22
View File
@@ -36,6 +36,7 @@
#include "Bookkeeper.h"
#include <time.h>
#include "MemoryCardManager.h"
#include "StageStats.h"
#define DEFAULT_MODIFIERS THEME->GetMetric( "Common","DefaultModifiers" )
@@ -65,7 +66,7 @@ GameState::~GameState()
void GameState::Reset()
{
if( m_timeGameStarted != 0 && m_vPlayedStageStats.size() ) // we were in the middle of a game and played at least one song
if( m_timeGameStarted != 0 && g_vPlayedStageStats.size() ) // we were in the middle of a game and played at least one song
EndGame();
@@ -113,7 +114,7 @@ void GameState::Reset()
ResetStageStatistics();
SONGMAN->UpdateBest();
m_vPlayedStageStats.clear();
g_vPlayedStageStats.clear();
for( p=0; p<NUM_PLAYERS; p++ )
{
@@ -172,8 +173,8 @@ void GameState::EndGame()
Profile* pMachineProfile = PROFILEMAN->GetMachineProfile();
int iGameplaySeconds = 0;
for( unsigned i=0; i<m_vPlayedStageStats.size(); i++ )
iGameplaySeconds += (int) roundf(m_vPlayedStageStats[i].fGameplaySeconds);
for( unsigned i=0; i<g_vPlayedStageStats.size(); i++ )
iGameplaySeconds += (int) roundf(g_vPlayedStageStats[i].fGameplaySeconds);
pMachineProfile->m_iTotalPlaySeconds += iPlaySeconds;
pMachineProfile->m_iTotalGameplaySeconds += iGameplaySeconds;
@@ -186,9 +187,9 @@ void GameState::EndGame()
continue;
unsigned i;
for( i=0; i<m_vPlayedStageStats.size(); i++ )
for( i=0; i<g_vPlayedStageStats.size(); i++ )
{
const StageStats& ss = m_vPlayedStageStats[i];
const StageStats& ss = g_vPlayedStageStats[i];
pMachineProfile->m_iNumSongsPlayedByPlayMode[ss.playMode]++;
pMachineProfile->m_iNumSongsPlayedByStyle[ss.style]++;
pMachineProfile->m_iNumSongsPlayedByDifficulty[ss.pSteps[p]->GetDifficulty()]++;
@@ -203,12 +204,12 @@ void GameState::EndGame()
pPlayerProfile->m_iTotalPlays++;
pPlayerProfile->m_iCurrentCombo =
PREFSMAN->m_bComboContinuesBetweenSongs ?
GAMESTATE->m_CurStageStats.iCurCombo[p] :
g_CurStageStats.iCurCombo[p] :
0;
for( i=0; i<m_vPlayedStageStats.size(); i++ )
for( i=0; i<g_vPlayedStageStats.size(); i++ )
{
const StageStats& ss = m_vPlayedStageStats[i];
const StageStats& ss = g_vPlayedStageStats[i];
pPlayerProfile->m_iNumSongsPlayedByPlayMode[ss.playMode]++;
pPlayerProfile->m_iNumSongsPlayedByStyle[ss.style]++;
pPlayerProfile->m_iNumSongsPlayedByDifficulty[ss.pSteps[p]->GetDifficulty()]++;
@@ -327,8 +328,8 @@ void GameState::ResetMusicStatistics()
void GameState::ResetStageStatistics()
{
StageStats OldStats = GAMESTATE->m_CurStageStats;
m_CurStageStats = StageStats();
StageStats OldStats = g_CurStageStats;
g_CurStageStats = StageStats();
if( PREFSMAN->m_bComboContinuesBetweenSongs )
{
if( GetStageIndex() == 0 )
@@ -337,12 +338,12 @@ void GameState::ResetStageStatistics()
{
Profile* pProfile = PROFILEMAN->GetProfile((PlayerNumber)p);
if( pProfile )
GAMESTATE->m_CurStageStats.iCurCombo[p] = pProfile->m_iCurrentCombo;
g_CurStageStats.iCurCombo[p] = pProfile->m_iCurrentCombo;
}
}
else // GetStageIndex() > 0
{
memcpy( GAMESTATE->m_CurStageStats.iCurCombo, OldStats.iCurCombo, sizeof(OldStats.iCurCombo) );
memcpy( g_CurStageStats.iCurCombo, OldStats.iCurCombo, sizeof(OldStats.iCurCombo) );
}
}
@@ -443,7 +444,7 @@ int GameState::GetCourseSongIndex()
/* iSongsPlayed includes the current song, so it's 1-based; subtract one. */
for( int p=0; p<NUM_PLAYERS; p++ )
if( IsPlayerEnabled(p) )
iSongIndex = max( iSongIndex, m_CurStageStats.iSongsPlayed[p]-1 );
iSongIndex = max( iSongIndex, g_CurStageStats.iSongsPlayed[p]-1 );
return iSongIndex;
}
@@ -575,7 +576,7 @@ bool GameState::HasEarnedExtraStage()
if( PREFSMAN->m_bPickExtraStage && GAMESTATE->IsExtraStage() && !GAMESTATE->m_bAllow2ndExtraStage )
continue;
if( m_CurStageStats.GetGrade((PlayerNumber)p) >= GRADE_AA )
if( g_CurStageStats.GetGrade((PlayerNumber)p) >= GRADE_AA )
return true;
}
}
@@ -613,11 +614,11 @@ StageResult GameState::GetStageResult( PlayerNumber pn )
continue;
/* If anyone did just as well, at best it's a draw. */
if( GAMESTATE->m_CurStageStats.iActualDancePoints[p] == GAMESTATE->m_CurStageStats.iActualDancePoints[pn] )
if( g_CurStageStats.iActualDancePoints[p] == g_CurStageStats.iActualDancePoints[pn] )
win = RESULT_DRAW;
/* If anyone did better, we lost. */
if( GAMESTATE->m_CurStageStats.iActualDancePoints[p] > GAMESTATE->m_CurStageStats.iActualDancePoints[pn] )
if( g_CurStageStats.iActualDancePoints[p] > g_CurStageStats.iActualDancePoints[pn] )
return RESULT_LOSE;
}
return win;
@@ -629,9 +630,9 @@ void GameState::GetFinalEvalStatsAndSongs( StageStats& statsOut, vector<Song*>&
// Show stats only for the latest 3 normal songs + passed extra stages
int PassedRegularSongsLeft = 3;
for( int i = (int)GAMESTATE->m_vPlayedStageStats.size()-1; i >= 0; --i )
for( int i = (int)g_vPlayedStageStats.size()-1; i >= 0; --i )
{
const StageStats &s = GAMESTATE->m_vPlayedStageStats[i];
const StageStats &s = g_vPlayedStageStats[i];
if( !s.OnePassed() )
continue;
@@ -970,12 +971,12 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
//
vector<SongAndSteps> vSongAndSteps;
for( i=0; i<m_vPlayedStageStats.size(); i++ )
for( i=0; i<g_vPlayedStageStats.size(); i++ )
{
SongAndSteps sas;
sas.pSong = m_vPlayedStageStats[i].pSong;
sas.pSong = g_vPlayedStageStats[i].pSong;
ASSERT( sas.pSong );
sas.pSteps = m_vPlayedStageStats[i].pSteps[pn];
sas.pSteps = g_vPlayedStageStats[i].pSteps[pn];
ASSERT( sas.pSteps );
vSongAndSteps.push_back( sas );
}
+1 -9
View File
@@ -17,7 +17,6 @@
#include "Game.h"
#include "Style.h"
#include "Grade.h"
#include "StageStats.h"
#include "Attack.h"
#include <map>
@@ -31,6 +30,7 @@ class NoteFieldPositioning;
class Character;
class UnlockSystem;
class TimingData;
struct StageStats;
class GameState
{
@@ -159,14 +159,6 @@ public:
void UpdateSongPosition( float fPositionSeconds, const TimingData &timing );
float GetSongPercent( float beat ) const;
//
// Stage Statistics:
// Arcade: for the current stage (one song).
// Nonstop/Oni/Endless: for current course (which usually contains multiple songs)
//
StageStats m_CurStageStats; // current stage (not necessarily passed if Extra Stage)
vector<StageStats> m_vPlayedStageStats;
enum HealthState { HOT, ALIVE, DANGER, DEAD };
HealthState m_HealthState[NUM_PLAYERS];
bool AllAreInDangerOrWorse() const;
+3 -2
View File
@@ -19,6 +19,7 @@
#include "song.h"
#include "ScreenManager.h"
#include "ScreenGameplay.h"
#include "StageStats.h"
#define NUM_ITEM_TYPES THEME->GetMetricF("Inventory","NumItemTypes")
@@ -104,10 +105,10 @@ void Inventory::Update( float fDelta )
PlayerNumber pn = m_PlayerNumber;
// check to see if they deserve a new item
if( GAMESTATE->m_CurStageStats.iCurCombo[pn] != m_iLastSeenCombo )
if( g_CurStageStats.iCurCombo[pn] != m_iLastSeenCombo )
{
int iOldCombo = m_iLastSeenCombo;
m_iLastSeenCombo = GAMESTATE->m_CurStageStats.iCurCombo[pn];
m_iLastSeenCombo = g_CurStageStats.iCurCombo[pn];
int iNewCombo = m_iLastSeenCombo;
#define CROSSED(i) (iOldCombo<i)&&(iNewCombo>=i)
+3 -2
View File
@@ -19,6 +19,7 @@
#include "RageMath.h"
#include "ThemeManager.h"
#include "song.h"
#include "StageStats.h"
//
@@ -407,7 +408,7 @@ void LifeMeterBar::ChangeLife( float fDeltaLife )
}
/* If we've already failed, there's no point in letting them fill up the bar again. */
if( GAMESTATE->m_CurStageStats.bFailed[m_PlayerNumber] )
if( g_CurStageStats.bFailed[m_PlayerNumber] )
fDeltaLife = 0;
switch( GAMESTATE->m_SongOptions.m_DrainType )
@@ -436,7 +437,7 @@ void LifeMeterBar::ChangeLife( float fDeltaLife )
CLAMP( m_fLifePercentage, 0, 1 );
if( m_fLifePercentage <= FAIL_THRESHOLD )
GAMESTATE->m_CurStageStats.bFailedEarlier[m_PlayerNumber] = true;
g_CurStageStats.bFailedEarlier[m_PlayerNumber] = true;
m_fLifeVelocity += fDeltaLife;
}
+5 -4
View File
@@ -14,6 +14,7 @@
#include "GameState.h"
#include "ThemeManager.h"
#include "Steps.h"
#include "StageStats.h"
const float BATTERY_X[NUM_PLAYERS] = { -92, +92 };
@@ -74,7 +75,7 @@ void LifeMeterBattery::Load( PlayerNumber pn )
void LifeMeterBattery::OnSongEnded()
{
if( GAMESTATE->m_CurStageStats.bFailedEarlier[m_PlayerNumber] )
if( g_CurStageStats.bFailedEarlier[m_PlayerNumber] )
return;
if( m_iLivesLeft < GAMESTATE->m_SongOptions.m_iBatteryLives )
@@ -91,7 +92,7 @@ void LifeMeterBattery::OnSongEnded()
void LifeMeterBattery::ChangeLife( TapNoteScore score )
{
if( GAMESTATE->m_CurStageStats.bFailedEarlier[m_PlayerNumber] )
if( g_CurStageStats.bFailedEarlier[m_PlayerNumber] )
return;
switch( score )
@@ -118,7 +119,7 @@ void LifeMeterBattery::ChangeLife( TapNoteScore score )
ASSERT(0);
}
if( m_iLivesLeft == 0 )
GAMESTATE->m_CurStageStats.bFailedEarlier[m_PlayerNumber] = true;
g_CurStageStats.bFailedEarlier[m_PlayerNumber] = true;
}
void LifeMeterBattery::ChangeLife( HoldNoteScore score, TapNoteScore tscore )
@@ -161,7 +162,7 @@ bool LifeMeterBattery::IsHot() const
bool LifeMeterBattery::IsFailing() const
{
return GAMESTATE->m_CurStageStats.bFailedEarlier[m_PlayerNumber];
return g_CurStageStats.bFailedEarlier[m_PlayerNumber];
}
float LifeMeterBattery::GetLife() const
+5 -4
View File
@@ -14,6 +14,7 @@
#include "NoteDataWithScoring.h"
#include "GameState.h"
#include "RageUtil.h"
#include "StageStats.h"
NoteDataWithScoring::NoteDataWithScoring()
{
@@ -280,11 +281,11 @@ float NoteDataWithScoring::GetActualStreamRadarValue( float fSongSeconds, Player
float NoteDataWithScoring::GetActualVoltageRadarValue( float fSongSeconds, PlayerNumber pn ) const
{
/* m_CurStageStats.iMaxCombo is unrelated to GetNumTapNotes: m_bComboContinuesBetweenSongs
/* g_CurStageStats.iMaxCombo is unrelated to GetNumTapNotes: m_bComboContinuesBetweenSongs
* might be on, and the way combo is counted varies depending on the mode and score
* keeper. Instead, let's use the length of the longest recorded combo. This is
* only subtly different: it's the percent of the song the longest combo took to get. */
const StageStats::Combo_t MaxCombo = GAMESTATE->m_CurStageStats.GetMaxCombo( pn );
const StageStats::Combo_t MaxCombo = g_CurStageStats.GetMaxCombo( pn );
return clamp( MaxCombo.size, 0.0f, 1.0f );
}
@@ -301,11 +302,11 @@ float NoteDataWithScoring::GetActualAirRadarValue( float fSongSeconds, PlayerNum
float NoteDataWithScoring::GetActualChaosRadarValue( float fSongSeconds, PlayerNumber pn ) const
{
const int PossibleDP = GAMESTATE->m_CurStageStats.iPossibleDancePoints[pn];
const int PossibleDP = g_CurStageStats.iPossibleDancePoints[pn];
if ( PossibleDP == 0 )
return 1;
const int ActualDP = GAMESTATE->m_CurStageStats.iActualDancePoints[pn];
const int ActualDP = g_CurStageStats.iActualDancePoints[pn];
return clamp( float(ActualDP)/PossibleDP, 0.0f, 1.0f );
}
+4 -3
View File
@@ -5,8 +5,9 @@
#include "ThemeManager.h"
#include "PrefsManager.h"
#include "ActorUtil.h"
#include "RageLog.h"
#include "StageStats.h"
#define DANCE_POINT_DIGITS THEME->GetMetricI(m_sName,"DancePointsDigits")
#define PERCENT_DECIMAL_PLACES THEME->GetMetricI(m_sName,"PercentDecimalPlaces")
#define PERCENT_TOTAL_SIZE THEME->GetMetricI(m_sName,"PercentTotalSize")
@@ -59,7 +60,7 @@ void PercentageDisplay::Update( float fDeltaTime )
void PercentageDisplay::Refresh()
{
const int iActualDancePoints = GAMESTATE->m_CurStageStats.iActualDancePoints[m_PlayerNumber];
const int iActualDancePoints = g_CurStageStats.iActualDancePoints[m_PlayerNumber];
if( iActualDancePoints == m_Last )
return;
@@ -68,7 +69,7 @@ void PercentageDisplay::Refresh()
CString sNumToDisplay;
if( !PREFSMAN->m_bDancePointsForOni )
{
float fPercentDancePoints = GAMESTATE->m_CurStageStats.GetPercentDancePoints( m_PlayerNumber );
float fPercentDancePoints = g_CurStageStats.GetPercentDancePoints( m_PlayerNumber );
if( PERCENT_USE_REMAINDER )
{
int iPercentWhole = int(fPercentDancePoints*100);
+20 -19
View File
@@ -34,6 +34,7 @@
#include "NoteDataUtil.h"
#include "ScreenGameplay.h" /* for SM_ComboStopped */
#include "ScreenManager.h"
#include "StageStats.h"
CachedThemeMetricF GRAY_ARROWS_Y_STANDARD ("Player","ReceptorArrowsYStandard");
CachedThemeMetricF GRAY_ARROWS_Y_REVERSE ("Player","ReceptorArrowsYReverse");
@@ -129,7 +130,7 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p
// copy note data
this->CopyAll( pNoteData );
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && GAMESTATE->m_CurStageStats.bFailed[pn] ) // Oni dead
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && g_CurStageStats.bFailed[pn] ) // Oni dead
this->ClearAll();
/* The editor reuses Players ... so we really need to make sure everything
@@ -138,7 +139,7 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p
m_Judgment.StopTweening();
// m_Combo.Reset(); // don't reset combos between songs in a course!
m_Combo.Init( pn );
m_Combo.SetCombo( GAMESTATE->m_CurStageStats.iCurCombo[m_PlayerNumber] ); // combo can persist between songs and games
m_Combo.SetCombo( g_CurStageStats.iCurCombo[m_PlayerNumber] ); // combo can persist between songs and games
m_AttackDisplay.Init( pn );
m_Judgment.Reset();
@@ -366,7 +367,7 @@ void PlayerMinus::Update( float fDeltaTime )
int ms_error = (hns == HNS_OK)? 0:MAX_PRO_TIMING_ERROR;
GAMESTATE->m_CurStageStats.iTotalError[m_PlayerNumber] += ms_error;
g_CurStageStats.iTotalError[m_PlayerNumber] += ms_error;
if( hns == HNS_NG ) /* don't show a 0 for an OK */
m_ProTimingDisplay.SetJudgment( ms_error, TNS_MISS );
}
@@ -554,7 +555,7 @@ int PlayerMinus::GetClosestNote( int col, float fBeat, float fMaxBeatsAhead, flo
void PlayerMinus::Step( int col, RageTimer tm )
{
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && GAMESTATE->m_CurStageStats.bFailed[m_PlayerNumber] ) // Oni dead
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && g_CurStageStats.bFailed[m_PlayerNumber] ) // Oni dead
return; // do nothing
//LOG->Trace( "PlayerMinus::HandlePlayerStep()" );
@@ -811,7 +812,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
int ms_error = (int) roundf( fSecondsFromPerfect * 1000 );
ms_error = min( ms_error, MAX_PRO_TIMING_ERROR );
GAMESTATE->m_CurStageStats.iTotalError[m_PlayerNumber] += ms_error;
g_CurStageStats.iTotalError[m_PlayerNumber] += ms_error;
if (!GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fBlind)
m_ProTimingDisplay.SetJudgment( ms_error, score );
}
@@ -926,7 +927,7 @@ void PlayerMinus::OnRowCompletelyJudged( int iIndexThatWasSteppedOn )
case TNS_PERFECT:
case TNS_MARVELOUS:
{
bool bBright = GAMESTATE->m_CurStageStats.iCurCombo[m_PlayerNumber]>(int)BRIGHT_GHOST_COMBO_THRESHOLD;
bool bBright = g_CurStageStats.iCurCombo[m_PlayerNumber]>(int)BRIGHT_GHOST_COMBO_THRESHOLD;
m_pNoteField->DidTapNote( c, score, bBright );
}
break;
@@ -981,7 +982,7 @@ void PlayerMinus::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
// A normal note. Penalize for not stepping on it.
MissedNoteOnThisRow = true;
SetTapNoteScore(t, r, TNS_MISS);
GAMESTATE->m_CurStageStats.iTotalError[m_PlayerNumber] += MAX_PRO_TIMING_ERROR;
g_CurStageStats.iTotalError[m_PlayerNumber] += MAX_PRO_TIMING_ERROR;
m_ProTimingDisplay.SetJudgment( MAX_PRO_TIMING_ERROR, TNS_MISS );
}
}
@@ -1081,18 +1082,18 @@ void PlayerMinus::HandleTapRowScore( unsigned row )
return;
/* Update miss combo, and handle "combo stopped" messages. */
int &iCurCombo = GAMESTATE->m_CurStageStats.iCurCombo[m_PlayerNumber];
int &iCurCombo = g_CurStageStats.iCurCombo[m_PlayerNumber];
switch( scoreOfLastTap )
{
case TNS_MARVELOUS:
case TNS_PERFECT:
case TNS_GREAT:
GAMESTATE->m_CurStageStats.iCurMissCombo[m_PlayerNumber] = 0;
g_CurStageStats.iCurMissCombo[m_PlayerNumber] = 0;
SCREENMAN->PostMessageToTopScreen( SM_MissComboAborted, 0 );
break;
case TNS_MISS:
++GAMESTATE->m_CurStageStats.iCurMissCombo[m_PlayerNumber];
++g_CurStageStats.iCurMissCombo[m_PlayerNumber];
m_iDCState = AS2D_MISS; // update dancing 2d characters that may have missed a note
case TNS_GOOD:
case TNS_BOO:
@@ -1104,7 +1105,7 @@ void PlayerMinus::HandleTapRowScore( unsigned row )
}
/* The score keeper updates the hit combo. Remember the old combo for handling announcers. */
const int iOldCombo = GAMESTATE->m_CurStageStats.iCurCombo[m_PlayerNumber];
const int iOldCombo = g_CurStageStats.iCurCombo[m_PlayerNumber];
if(m_pPrimaryScoreKeeper)
m_pPrimaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow, iNumAdditions );
@@ -1112,7 +1113,7 @@ void PlayerMinus::HandleTapRowScore( unsigned row )
if(m_pSecondaryScoreKeeper)
m_pSecondaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow, iNumAdditions );
m_Combo.SetCombo( GAMESTATE->m_CurStageStats.iCurCombo[m_PlayerNumber] );
m_Combo.SetCombo( g_CurStageStats.iCurCombo[m_PlayerNumber] );
#define CROSSED( x ) (iOldCombo<x && iCurCombo>=x)
if ( CROSSED(100) )
@@ -1140,12 +1141,12 @@ void PlayerMinus::HandleTapRowScore( unsigned row )
#undef CROSSED
// new max combo
GAMESTATE->m_CurStageStats.iMaxCombo[m_PlayerNumber] = max(GAMESTATE->m_CurStageStats.iMaxCombo[m_PlayerNumber], iCurCombo);
g_CurStageStats.iMaxCombo[m_PlayerNumber] = max(g_CurStageStats.iMaxCombo[m_PlayerNumber], iCurCombo);
/* 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,
* the beat we're registering is in the past, but the life is changing now. */
GAMESTATE->m_CurStageStats.UpdateComboList( m_PlayerNumber, GAMESTATE->m_fSongBeat );
g_CurStageStats.UpdateComboList( m_PlayerNumber, GAMESTATE->m_fSongBeat );
float life = -1;
if( m_pLifeMeter )
@@ -1157,12 +1158,12 @@ void PlayerMinus::HandleTapRowScore( unsigned row )
life = 1.0f - life;
}
if( life != -1 )
GAMESTATE->m_CurStageStats.SetLifeRecord( m_PlayerNumber, life, GAMESTATE->m_fSongBeat );
g_CurStageStats.SetLifeRecord( m_PlayerNumber, life, GAMESTATE->m_fSongBeat );
if (m_pScoreDisplay)
m_pScoreDisplay->SetScore(GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber]);
m_pScoreDisplay->SetScore(g_CurStageStats.iScore[m_PlayerNumber]);
if (m_pSecondaryScoreDisplay)
m_pSecondaryScoreDisplay->SetScore(GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber]);
m_pSecondaryScoreDisplay->SetScore(g_CurStageStats.iScore[m_PlayerNumber]);
if( m_pLifeMeter ) {
m_pLifeMeter->ChangeLife( scoreOfLastTap );
@@ -1194,9 +1195,9 @@ void PlayerMinus::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScor
m_pSecondaryScoreKeeper->HandleHoldScore(holdScore, tapScore );
if (m_pScoreDisplay)
m_pScoreDisplay->SetScore(GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber]);
m_pScoreDisplay->SetScore(g_CurStageStats.iScore[m_PlayerNumber]);
if (m_pSecondaryScoreDisplay)
m_pSecondaryScoreDisplay->SetScore(GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber]);
m_pSecondaryScoreDisplay->SetScore(g_CurStageStats.iScore[m_PlayerNumber]);
if( m_pLifeMeter ) {
m_pLifeMeter->ChangeLife( holdScore, tapScore );
+6 -2
View File
@@ -105,8 +105,12 @@ bool TryToStartQueuedMusic( float fOldSeconds, float fNewSeconds )
if( g_UpdatingTimer )
{
fOldSeconds += SOUND->GetPlayLatency();
fNewSeconds += SOUND->GetPlayLatency();
/* GetPlayLatency returns the minimum time until a sound starts. That's
* common when starting a precached sound, but our sound isn't, so it'll
* probably take a little longer. Nudge the latency up. */
float Latency = SOUND->GetPlayLatency() + 0.040f;
fOldSeconds += Latency;
fNewSeconds += Latency;
const float fOldBeat = g_Timing.GetBeatFromElapsedTime( fOldSeconds );
const float fNewBeat = g_Timing.GetBeatFromElapsedTime( fNewSeconds );
+2 -1
View File
@@ -17,6 +17,7 @@
#include "RageLog.h"
#include "GameState.h"
#include "ThemeManager.h"
#include "StageStats.h"
ScoreDisplayOni::ScoreDisplayOni()
@@ -45,7 +46,7 @@ void ScoreDisplayOni::Update( float fDelta )
float fSecsIntoPlay = 0;
if( GAMESTATE->IsPlayerEnabled(m_PlayerNumber) )
fSecsIntoPlay = GAMESTATE->m_CurStageStats.fAliveSeconds[m_PlayerNumber];
fSecsIntoPlay = g_CurStageStats.fAliveSeconds[m_PlayerNumber];
m_text.SetText( SecondsToTime(fSecsIntoPlay) );
}
+13 -12
View File
@@ -23,6 +23,7 @@
#include "SongManager.h"
#include "NoteDataUtil.h"
#include "RageLog.h"
#include "StageStats.h"
ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Steps*>& apNotes_, const vector<AttackArray> &asModifiers, PlayerNumber pn_ ):
@@ -31,7 +32,7 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Ste
ASSERT( apSongs.size() == apNotes_.size() );
ASSERT( apSongs.size() == asModifiers.size() );
//
// Fill in m_CurStageStats, calculate multiplier
// Fill in g_CurStageStats, calculate multiplier
//
int iTotalPossibleDancePoints = 0;
for( unsigned i=0; i<apNotes.size(); i++ )
@@ -71,7 +72,7 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector<Song*>& apSongs, const vector<Ste
iTotalPossibleDancePoints += this->GetPossibleDancePoints( playerNoteData, playerNoteDataPostModifiers );
}
GAMESTATE->m_CurStageStats.iPossibleDancePoints[pn_] = iTotalPossibleDancePoints;
g_CurStageStats.iPossibleDancePoints[pn_] = iTotalPossibleDancePoints;
m_iScoreRemainder = 0;
@@ -208,7 +209,7 @@ static int GetScore(int p, int B, int S, int n)
void ScoreKeeperMAX2::AddScore( TapNoteScore score )
{
int &iScore = GAMESTATE->m_CurStageStats.iScore[m_PlayerNumber];
int &iScore = g_CurStageStats.iScore[m_PlayerNumber];
/*
http://www.aaroninjapan.com/ddr2.html
@@ -239,7 +240,7 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
// What does this do? "Don't use a multiplier if
// the player has failed"?
if( GAMESTATE->m_CurStageStats.bFailedEarlier[m_PlayerNumber] )
if( g_CurStageStats.bFailedEarlier[m_PlayerNumber] )
{
iScore += p;
// make score evenly divisible by 5
@@ -252,8 +253,8 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
else
{
iScore += GetScore(p, B, sum, m_iTapNotesHit);
const int &iCurrentCombo = GAMESTATE->m_CurStageStats.iCurCombo[m_PlayerNumber];
GAMESTATE->m_CurStageStats.iBonus[m_PlayerNumber] += m_ComboBonusFactor[score] * iCurrentCombo;
const int &iCurrentCombo = g_CurStageStats.iCurCombo[m_PlayerNumber];
g_CurStageStats.iBonus[m_PlayerNumber] += m_ComboBonusFactor[score] * iCurrentCombo;
}
/* Subtract the maximum this step could have been worth from the bonus. */
@@ -261,7 +262,7 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
if ( m_iTapNotesHit == m_iNumTapsAndHolds && score >= TNS_PERFECT )
{
if (!GAMESTATE->m_CurStageStats.bFailedEarlier[m_PlayerNumber])
if (!g_CurStageStats.bFailedEarlier[m_PlayerNumber])
iScore += m_iPointBonus;
if ( m_bIsLastSongInCourse )
{
@@ -294,11 +295,11 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
// (yes they do)
if( iNumTapsToScore > 0 )
{
GAMESTATE->m_CurStageStats.iActualDancePoints[m_PlayerNumber] += TapNoteScoreToDancePoints( scoreOfLastTap );
g_CurStageStats.iActualDancePoints[m_PlayerNumber] += TapNoteScoreToDancePoints( scoreOfLastTap );
}
// Do count additions in judge totals.
GAMESTATE->m_CurStageStats.iTapNoteScores[m_PlayerNumber][scoreOfLastTap] += 1;
g_CurStageStats.iTapNoteScores[m_PlayerNumber][scoreOfLastTap] += 1;
//
// Regular combo
@@ -329,7 +330,7 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
TapNoteScore MinScoreToContinueCombo = GAMESTATE->m_PlayMode == PLAY_MODE_ONI? TNS_PERFECT:TNS_GREAT;
if( scoreOfLastTap >= MinScoreToContinueCombo )
GAMESTATE->m_CurStageStats.iCurCombo[m_PlayerNumber] += ComboCountIfHit;
g_CurStageStats.iCurCombo[m_PlayerNumber] += ComboCountIfHit;
/*
http://www.aaroninjapan.com/ddr2.html
@@ -407,8 +408,8 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
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 );
g_CurStageStats.iHoldNoteScores[m_PlayerNumber][holdScore] ++;
g_CurStageStats.iActualDancePoints[m_PlayerNumber] += HoldNoteScoreToDancePoints( holdScore );
if( holdScore == HNS_OK )
AddScore( TNS_MARVELOUS );
+21 -20
View File
@@ -31,6 +31,7 @@
#include "LightsManager.h"
#include "ProfileManager.h"
#include "song.h"
#include "StageStats.h"
const int NUM_SCORE_DIGITS = 9;
@@ -109,18 +110,18 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName)
for( float f = 0; f < 100.0f; f += 1.0f )
{
float fP1 = fmodf(f/100*4+.3f,1);
GAMESTATE->m_CurStageStats.SetLifeRecord( PLAYER_1, fP1, f );
GAMESTATE->m_CurStageStats.SetLifeRecord( PLAYER_2, 1-fP1, f );
g_CurStageStats.SetLifeRecord( PLAYER_1, fP1, f );
g_CurStageStats.SetLifeRecord( PLAYER_2, 1-fP1, f );
}
GAMESTATE->m_CurStageStats.iCurCombo[PLAYER_1] = 0;
GAMESTATE->m_CurStageStats.UpdateComboList( PLAYER_1, 0 );
GAMESTATE->m_CurStageStats.iCurCombo[PLAYER_1] = 1;
GAMESTATE->m_CurStageStats.UpdateComboList( PLAYER_1, 1 );
GAMESTATE->m_CurStageStats.iCurCombo[PLAYER_1] = 50;
GAMESTATE->m_CurStageStats.UpdateComboList( PLAYER_1, 25 );
GAMESTATE->m_CurStageStats.iCurCombo[PLAYER_1] = 250;
GAMESTATE->m_CurStageStats.UpdateComboList( PLAYER_1, 100 );
g_CurStageStats.iCurCombo[PLAYER_1] = 0;
g_CurStageStats.UpdateComboList( PLAYER_1, 0 );
g_CurStageStats.iCurCombo[PLAYER_1] = 1;
g_CurStageStats.UpdateComboList( PLAYER_1, 1 );
g_CurStageStats.iCurCombo[PLAYER_1] = 50;
g_CurStageStats.UpdateComboList( PLAYER_1, 25 );
g_CurStageStats.iCurCombo[PLAYER_1] = 250;
g_CurStageStats.UpdateComboList( PLAYER_1, 100 );
}
LOG->Trace( "ScreenEvaluation::ScreenEvaluation()" );
@@ -158,7 +159,7 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName)
break;
case stage:
case course:
stageStats = GAMESTATE->m_CurStageStats;
stageStats = g_CurStageStats;
break;
default:
ASSERT(0);
@@ -194,7 +195,7 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName)
if (PREFSMAN->m_iScoringType == PrefsManager::SCORING_5TH)
{
int ScoreBonuses[9] = {0, 0, 100, 1000, 10000, 100000, 1000000, 10000000, 10000000};
GAMESTATE->m_CurStageStats.iBonus[p] += ScoreBonuses[(int)grade[p] ];
g_CurStageStats.iBonus[p] += ScoreBonuses[(int)grade[p] ];
stageStats.iBonus[p] += ScoreBonuses[(int)grade[p] ];
}
}
@@ -685,8 +686,8 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName)
continue; // skip
int iTotalScore=0;
for( unsigned i=0; i<GAMESTATE->m_vPlayedStageStats.size(); i++ )
iTotalScore += GAMESTATE->m_vPlayedStageStats[i].iScore[p];
for( unsigned i=0; i<g_vPlayedStageStats.size(); i++ )
iTotalScore += g_vPlayedStageStats[i].iScore[p];
iTotalScore += stageStats.iScore[p];
@@ -1193,7 +1194,7 @@ void ScreenEvaluation::Update( float fDeltaTime )
for( int p=0; p<NUM_PLAYERS; p++)
{
if (GAMESTATE->m_CurStageStats.iBonus[p] == 0)
if (g_CurStageStats.iBonus[p] == 0)
continue;
if (GAMESTATE->IsCourseMode())
@@ -1203,15 +1204,15 @@ void ScreenEvaluation::Update( float fDeltaTime )
if ( RageTimer::GetTimeSinceStart() - m_fScreenCreateTime < 1.5f)
continue;
int increment = GAMESTATE->m_CurStageStats.iBonus[p]/10;
int increment = g_CurStageStats.iBonus[p]/10;
if (increment < 1)
increment = min(1024, GAMESTATE->m_CurStageStats.iBonus[p]);
increment = min(1024, g_CurStageStats.iBonus[p]);
GAMESTATE->m_CurStageStats.iBonus[p] -= increment;
GAMESTATE->m_CurStageStats.iScore[p] += increment;
g_CurStageStats.iBonus[p] -= increment;
g_CurStageStats.iScore[p] += increment;
if( SHOW_SCORE_AREA )
m_textScore[p].SetText( ssprintf("%*.0i", NUM_SCORE_DIGITS, GAMESTATE->m_CurStageStats.iScore[p]) );
m_textScore[p].SetText( ssprintf("%*.0i", NUM_SCORE_DIGITS, g_CurStageStats.iScore[p]) );
}
}
+35 -34
View File
@@ -47,6 +47,7 @@
#include "UnlockSystem.h"
#include "LightsManager.h"
#include "ProfileManager.h"
#include "StageStats.h"
//
// Defines
@@ -201,9 +202,9 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S
}
GAMESTATE->m_CurStageStats.pSong = NULL; // set in LoadNextSong
GAMESTATE->m_CurStageStats.playMode = GAMESTATE->m_PlayMode;
GAMESTATE->m_CurStageStats.style = GAMESTATE->m_CurStyle;
g_CurStageStats.pSong = NULL; // set in LoadNextSong
g_CurStageStats.playMode = GAMESTATE->m_PlayMode;
g_CurStageStats.style = GAMESTATE->m_CurStyle;
for( p=0; p<NUM_PLAYERS; p++ )
{
@@ -211,16 +212,16 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S
continue; // skip
ASSERT( !m_apNotesQueue[p].empty() );
GAMESTATE->m_CurStageStats.pSteps[p] = m_apNotesQueue[p][0];
GAMESTATE->m_CurStageStats.iMeter[p] = m_apNotesQueue[p][0]->GetMeter();
g_CurStageStats.pSteps[p] = m_apNotesQueue[p][0];
g_CurStageStats.iMeter[p] = m_apNotesQueue[p][0]->GetMeter();
}
if( GAMESTATE->IsExtraStage() )
GAMESTATE->m_CurStageStats.StageType = StageStats::STAGE_EXTRA;
g_CurStageStats.StageType = StageStats::STAGE_EXTRA;
else if( GAMESTATE->IsExtraStage2() )
GAMESTATE->m_CurStageStats.StageType = StageStats::STAGE_EXTRA2;
g_CurStageStats.StageType = StageStats::STAGE_EXTRA2;
else
GAMESTATE->m_CurStageStats.StageType = StageStats::STAGE_NORMAL;
g_CurStageStats.StageType = StageStats::STAGE_NORMAL;
//
// Init ScoreKeepers
@@ -410,7 +411,7 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S
m_MaxCombo.LoadFromNumbers( THEME->GetPathToN("ScreenGameplay max combo") );
m_MaxCombo.SetName( "MaxCombo" );
SET_XY( m_MaxCombo );
m_MaxCombo.SetText( ssprintf("%d", GAMESTATE->m_CurStageStats.iMaxCombo[GAMESTATE->m_MasterPlayerNumber]) ); // TODO: Make this work for both players
m_MaxCombo.SetText( ssprintf("%d", g_CurStageStats.iMaxCombo[GAMESTATE->m_MasterPlayerNumber]) ); // TODO: Make this work for both players
this->AddChild( &m_MaxCombo );
for( p=0; p<NUM_PLAYERS; p++ )
@@ -743,8 +744,8 @@ void ScreenGameplay::LoadNextSong()
for( p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) )
{
GAMESTATE->m_CurStageStats.iSongsPlayed[p]++;
m_textCourseSongNumber[p].SetText( ssprintf("%d", GAMESTATE->m_CurStageStats.iSongsPlayed[p]) );
g_CurStageStats.iSongsPlayed[p]++;
m_textCourseSongNumber[p].SetText( ssprintf("%d", g_CurStageStats.iSongsPlayed[p]) );
}
if( GAMESTATE->IsCourseMode() )
@@ -752,7 +753,7 @@ void ScreenGameplay::LoadNextSong()
int SongNumber = 0;
for( p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) )
SongNumber = max( SongNumber, GAMESTATE->m_CurStageStats.iSongsPlayed[p] );
SongNumber = max( SongNumber, g_CurStageStats.iSongsPlayed[p] );
CString path = THEME->GetPathToG( ssprintf("ScreenGameplay course song %i", SongNumber), true );
if( path != "" )
m_sprCourseSongNumber.Load( path );
@@ -764,7 +765,7 @@ void ScreenGameplay::LoadNextSong()
iPlaySongIndex %= m_apSongsQueue.size();
GAMESTATE->m_pCurSong = m_apSongsQueue[iPlaySongIndex];
GAMESTATE->m_CurStageStats.pSong = GAMESTATE->m_pCurSong;
g_CurStageStats.pSong = GAMESTATE->m_pCurSong;
// Restore the player's originally selected options.
GAMESTATE->RemoveAllActiveAttacks();
@@ -813,7 +814,7 @@ void ScreenGameplay::LoadNextSong()
m_sprOniGameOver[p].SetY( SCREEN_TOP - m_sprOniGameOver[p].GetZoomedHeight()/2 );
m_sprOniGameOver[p].SetDiffuse( RageColor(1,1,1,0) ); // 0 alpha so we don't waste time drawing while not visible
if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BATTERY && GAMESTATE->m_CurStageStats.bFailed[p] ) // already failed
if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BATTERY && g_CurStageStats.bFailed[p] ) // already failed
ShowOniGameOver((PlayerNumber)p);
if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BAR && GAMESTATE->m_PlayMode == PLAY_MODE_ARCADE && !PREFSMAN->m_bEventMode && !m_bDemonstration)
@@ -994,7 +995,7 @@ float ScreenGameplay::StartPlayingSong(float MinTimeToNotes, float MinTimeToMusi
bool ScreenGameplay::AllFailedEarlier() const
{
for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) && !GAMESTATE->m_CurStageStats.bFailedEarlier[p] )
if( GAMESTATE->IsPlayerEnabled(p) && !g_CurStageStats.bFailedEarlier[p] )
return false;
return true;
}
@@ -1102,7 +1103,7 @@ void ScreenGameplay::Update( float fDeltaTime )
return;
if( GAMESTATE->m_MasterPlayerNumber != PLAYER_INVALID )
m_MaxCombo.SetText( ssprintf("%d", GAMESTATE->m_CurStageStats.iMaxCombo[GAMESTATE->m_MasterPlayerNumber]) ); /* MAKE THIS WORK FOR BOTH PLAYERS! */
m_MaxCombo.SetText( ssprintf("%d", g_CurStageStats.iMaxCombo[GAMESTATE->m_MasterPlayerNumber]) ); /* MAKE THIS WORK FOR BOTH PLAYERS! */
//LOG->Trace( "m_fOffsetInBeats = %f, m_fBeatsPerSecond = %f, m_Music.GetPositionSeconds = %f", m_fOffsetInBeats, m_fBeatsPerSecond, m_Music.GetPositionSeconds() );
@@ -1149,11 +1150,11 @@ void ScreenGameplay::Update( float fDeltaTime )
// Update living players' alive time
//
for( pn=0; pn<NUM_PLAYERS; pn++ )
if( GAMESTATE->IsPlayerEnabled(pn) && !GAMESTATE->m_CurStageStats.bFailed[pn])
GAMESTATE->m_CurStageStats.fAliveSeconds [pn] += fDeltaTime * GAMESTATE->m_SongOptions.m_fMusicRate;
if( GAMESTATE->IsPlayerEnabled(pn) && !g_CurStageStats.bFailed[pn])
g_CurStageStats.fAliveSeconds [pn] += fDeltaTime * GAMESTATE->m_SongOptions.m_fMusicRate;
// update fGameplaySeconds
GAMESTATE->m_CurStageStats.fGameplaySeconds += fDeltaTime;
g_CurStageStats.fGameplaySeconds += fDeltaTime;
//
// Check for end of song
@@ -1276,7 +1277,7 @@ void ScreenGameplay::Update( float fDeltaTime )
case SongOptions::FAIL_ARCADE:
case SongOptions::FAIL_END_OF_SONG:
for ( pn=0; pn<NUM_PLAYERS; pn++ )
GAMESTATE->m_CurStageStats.bFailed[pn] = true; // fail
g_CurStageStats.bFailed[pn] = true; // fail
}
this->PostScreenMessage( SM_NotesEnded, 0 );
@@ -1308,7 +1309,7 @@ void ScreenGameplay::Update( float fDeltaTime )
LIGHTSMAN->SetAllUpperLights( false );
}
/* Set m_CurStageStats.bFailed for failed players. In, FAIL_ARCADE, send
/* Set g_CurStageStats.bFailed for failed players. In, FAIL_ARCADE, send
* SM_BeginFailed if all players failed, and kill dead Oni players. */
void ScreenGameplay::UpdateCheckFail()
{
@@ -1323,7 +1324,7 @@ void ScreenGameplay::UpdateCheckFail()
if( (m_pLifeMeter[pn] && !m_pLifeMeter[pn]->IsFailing()) ||
(m_pCombinedLifeMeter && !m_pCombinedLifeMeter->IsFailing((PlayerNumber)pn)) )
continue; /* isn't failing */
if( GAMESTATE->m_CurStageStats.bFailed[pn] )
if( g_CurStageStats.bFailed[pn] )
continue; /* failed and is already dead */
/* If recovery is enabled, only set fail if both are failing.
@@ -1333,7 +1334,7 @@ void ScreenGameplay::UpdateCheckFail()
continue;
LOG->Trace("Player %d failed", (int)pn);
GAMESTATE->m_CurStageStats.bFailed[pn] = true; // fail
g_CurStageStats.bFailed[pn] = true; // fail
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY &&
GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_ARCADE )
@@ -1681,14 +1682,14 @@ void ScreenGameplay::SongFinished()
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
{
RadarCategory rc = (RadarCategory)r;
GAMESTATE->m_CurStageStats.fRadarPossible[p][r] = NoteDataUtil::GetRadarValue( m_Player[p], rc, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds );
GAMESTATE->m_CurStageStats.fRadarActual[p][r] = m_Player[p].GetActualRadarValue( rc, (PlayerNumber)p, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds );
g_CurStageStats.fRadarPossible[p][r] = NoteDataUtil::GetRadarValue( m_Player[p], rc, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds );
g_CurStageStats.fRadarActual[p][r] = m_Player[p].GetActualRadarValue( rc, (PlayerNumber)p, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds );
}
}
// save current stage stats
GAMESTATE->m_vPlayedStageStats.push_back( GAMESTATE->m_CurStageStats );
g_vPlayedStageStats.push_back( g_CurStageStats );
}
void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
@@ -1729,28 +1730,28 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
{
LOG->Trace("Player %i failed: life %f is under %f",
p+1, m_pLifeMeter[p]->GetLife(), GAMESTATE->m_PlayerOptions[p].m_fPassmark );
GAMESTATE->m_CurStageStats.bFailed[p] = true;
g_CurStageStats.bFailed[p] = true;
}
/* Mark failure. This hasn't been done yet if m_bTwoPlayerRecovery is set. */
if( GAMESTATE->m_SongOptions.m_FailType != SongOptions::FAIL_OFF &&
(m_pLifeMeter[p] && m_pLifeMeter[p]->IsFailing()) ||
(m_pCombinedLifeMeter && m_pCombinedLifeMeter->IsFailing((PlayerNumber)p)) )
GAMESTATE->m_CurStageStats.bFailed[p] = true;
g_CurStageStats.bFailed[p] = true;
if( !GAMESTATE->m_CurStageStats.bFailed[p] )
GAMESTATE->m_CurStageStats.iSongsPassed[p]++;
if( !g_CurStageStats.bFailed[p] )
g_CurStageStats.iSongsPassed[p]++;
}
/* If all players have *really* failed (bFailed, not the life meter or
* bFailedEarlier): */
const bool bAllReallyFailed = GAMESTATE->m_CurStageStats.AllFailed();
const bool bAllReallyFailed = g_CurStageStats.AllFailed();
if( !bAllReallyFailed && !IsLastSong() )
{
/* Next song. */
for( p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) && !GAMESTATE->m_CurStageStats.bFailed[p] )
if( GAMESTATE->IsPlayerEnabled(p) && !g_CurStageStats.bFailed[p] )
{
// give a little life back between stages
if( m_pLifeMeter[p] )
@@ -1783,7 +1784,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
continue;
/* XXX: In battle modes, switch( GAMESTATE->GetStageResult(p) ). */
if( GAMESTATE->m_CurStageStats.bFailed[p] )
if( g_CurStageStats.bFailed[p] )
Dancers->Change2DAnimState( p, AS2D_FAIL ); // fail anim
else if( m_pLifeMeter[p] && m_pLifeMeter[p]->GetLife() == 1.0f ) // full life
Dancers->Change2DAnimState( p, AS2D_WINFEVER ); // full life pass anim
@@ -2045,7 +2046,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
float fMaxSurviveSeconds = 0;
for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) )
fMaxSurviveSeconds = max( fMaxSurviveSeconds, GAMESTATE->m_CurStageStats.fAliveSeconds[p] );
fMaxSurviveSeconds = max( fMaxSurviveSeconds, g_CurStageStats.fAliveSeconds[p] );
ASSERT( fMaxSurviveSeconds > 0 );
m_textSurviveTime.SetText( "TIME: " + SecondsToTime(fMaxSurviveSeconds) );
SET_XY_AND_ON_COMMAND( m_textSurviveTime );
+1
View File
@@ -27,6 +27,7 @@
#include <math.h>
#include "ProfileManager.h"
#include "NoteFieldPositioning.h"
#include "StageStats.h"
//
+2 -1
View File
@@ -31,6 +31,7 @@
#include "Steps.h"
#include <math.h>
#include "ProfileManager.h"
#include "StageStats.h"
//
@@ -95,7 +96,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
}
}
GAMESTATE->m_vPlayedStageStats.push_back( st );
g_vPlayedStageStats.push_back( st );
}
}
+4 -3
View File
@@ -36,6 +36,7 @@
#include "ProfileManager.h"
#include "MenuTimer.h"
#include "LightsManager.h"
#include "StageStats.h"
const int NUM_SCORE_DIGITS = 9;
@@ -896,9 +897,9 @@ void ScreenSelectMusic::MenuStart( PlayerNumber pn )
bool bIsRepeat = false;
int i = 0;
if( PREFSMAN->m_bEventMode )
i = max( 0, int(GAMESTATE->m_vPlayedStageStats.size())-5 );
for( ; i < (int)GAMESTATE->m_vPlayedStageStats.size(); ++i )
if( GAMESTATE->m_vPlayedStageStats[i].pSong == m_MusicWheel.GetSelectedSong() )
i = max( 0, int(g_vPlayedStageStats.size())-5 );
for( ; i < (int)g_vPlayedStageStats.size(); ++i )
if( g_vPlayedStageStats[i].pSong == m_MusicWheel.GetSelectedSong() )
bIsRepeat = true;
/* Don't complain about repeats if the user didn't get to pick. */
+4 -1
View File
@@ -17,6 +17,9 @@
#include "SongManager.h"
#include "RageUtil.h"
StageStats g_CurStageStats;
vector<StageStats> g_vPlayedStageStats;
StageStats::StageStats()
{
playMode = PLAY_MODE_INVALID;
@@ -216,7 +219,7 @@ bool StageStats::AllFailed() const
{
for( int pn=0; pn<NUM_PLAYERS; pn++ )
if( GAMESTATE->IsPlayerEnabled(PlayerNumber(pn)) )
if( !GAMESTATE->m_CurStageStats.bFailed[pn] )
if( !bFailed[pn] )
return false;
return true;
}
+11
View File
@@ -98,5 +98,16 @@ struct StageStats
Combo_t GetMaxCombo( PlayerNumber pn ) const;
};
/*
* This was in GameState, but GameState.h is used by tons of files, and this object
* is only used by 20 or so.
*
* Stage Statistics:
* Arcade: for the current stage (one song).
* Nonstop/Oni/Endless: for current course (which usually contains multiple songs)
*/
extern StageStats g_CurStageStats; // current stage (not necessarily passed if Extra Stage)
extern vector<StageStats> g_vPlayedStageStats;
#endif