move global StageStats into a singleton

This commit is contained in:
Chris Danford
2005-02-16 03:25:45 +00:00
parent 6cb8d3fe64
commit bb712884bb
30 changed files with 421 additions and 300 deletions
+2 -2
View File
@@ -13,7 +13,7 @@
#include "DancingCharacters.h" #include "DancingCharacters.h"
#include "arch/arch.h" #include "arch/arch.h"
#include "BeginnerHelper.h" #include "BeginnerHelper.h"
#include "StageStats.h" #include "StatsManager.h"
#include "ScreenDimensions.h" #include "ScreenDimensions.h"
#include "ThemeMetric.h" #include "ThemeMetric.h"
#include "PlayerState.h" #include "PlayerState.h"
@@ -652,7 +652,7 @@ bool Background::IsDangerAllVisible()
/* Don't show it if everyone is already failing: it's already too late and it's /* Don't show it if everyone is already failing: it's already too late and it's
* annoying for it to show for the entire duration of a song. */ * annoying for it to show for the entire duration of a song. */
if( g_CurStageStats.AllFailedEarlier() ) if( STATSMAN->m_CurStageStats.AllFailedEarlier() )
return false; return false;
if( !GAMESTATE->AllAreInDangerOrWorse() ) if( !GAMESTATE->AllAreInDangerOrWorse() )
+4 -4
View File
@@ -1,7 +1,7 @@
#include "global.h" #include "global.h"
#include "Combo.h" #include "Combo.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "StageStats.h" #include "StatsManager.h"
#include "GameState.h" #include "GameState.h"
#include "song.h" #include "song.h"
#include "ThemeMetric.h" #include "ThemeMetric.h"
@@ -101,17 +101,17 @@ void Combo::SetCombo( int iCombo, int iMisses )
if( bPastMidpoint ) if( bPastMidpoint )
{ {
if( g_CurStageStats.m_player[m_PlayerNumber].FullComboOfScore(TNS_MARVELOUS) ) if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].FullComboOfScore(TNS_MARVELOUS) )
{ {
sprLabel.RunCommands( FULL_COMBO_MARVELOUSES_COMMAND ); sprLabel.RunCommands( FULL_COMBO_MARVELOUSES_COMMAND );
m_textNumber.RunCommands( FULL_COMBO_MARVELOUSES_COMMAND ); m_textNumber.RunCommands( FULL_COMBO_MARVELOUSES_COMMAND );
} }
else if( bPastMidpoint && g_CurStageStats.m_player[m_PlayerNumber].FullComboOfScore(TNS_PERFECT) ) else if( bPastMidpoint && STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].FullComboOfScore(TNS_PERFECT) )
{ {
sprLabel.RunCommands( FULL_COMBO_PERFECTS_COMMAND ); sprLabel.RunCommands( FULL_COMBO_PERFECTS_COMMAND );
m_textNumber.RunCommands( FULL_COMBO_PERFECTS_COMMAND ); m_textNumber.RunCommands( FULL_COMBO_PERFECTS_COMMAND );
} }
else if( bPastMidpoint && g_CurStageStats.m_player[m_PlayerNumber].FullComboOfScore(TNS_GREAT) ) else if( bPastMidpoint && STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].FullComboOfScore(TNS_GREAT) )
{ {
sprLabel.RunCommands( FULL_COMBO_GREATS_COMMAND ); sprLabel.RunCommands( FULL_COMBO_GREATS_COMMAND );
m_textNumber.RunCommands( FULL_COMBO_GREATS_COMMAND ); m_textNumber.RunCommands( FULL_COMBO_GREATS_COMMAND );
+11 -11
View File
@@ -12,7 +12,7 @@
#include "ThemeManager.h" #include "ThemeManager.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "RageFile.h" #include "RageFile.h"
#include "StageStats.h" #include "StatsManager.h"
#include "Steps.h" #include "Steps.h"
#include "PlayerState.h" #include "PlayerState.h"
@@ -503,7 +503,7 @@ void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info)
bool foundaplayerwithgrade = false; bool foundaplayerwithgrade = false;
FOREACH_EnabledPlayer( pn ) FOREACH_EnabledPlayer( pn )
{ {
if(g_CurStageStats.m_player[pn].GetGrade() == info.grades[0]) if(STATSMAN->m_CurStageStats.m_player[pn].GetGrade() == info.grades[0])
{ {
LOG->Info("Found Valid Grade"); LOG->Info("Found Valid Grade");
foundaplayerwithgrade = true; foundaplayerwithgrade = true;
@@ -511,7 +511,7 @@ void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info)
} }
foundmatchinggrades = foundaplayerwithgrade; foundmatchinggrades = foundaplayerwithgrade;
} }
else if(g_vPlayedStageStats.size() < info.grades.size()) // we've not played enough stages to achieve a grade history condition else if(STATSMAN->m_vPlayedStageStats.size() < info.grades.size()) // we've not played enough stages to achieve a grade history condition
{ {
LOG->Info("Not Enough Stages Played To Compare Grade History"); LOG->Info("Not Enough Stages Played To Compare Grade History");
foundmatchinggrades = false; foundmatchinggrades = false;
@@ -520,16 +520,16 @@ void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info)
{ {
LOG->Info("Checking Grade History"); LOG->Info("Checking Grade History");
LOG->Info("Stage Stats Size: %u NumConditionalGrades: %u", LOG->Info("Stage Stats Size: %u NumConditionalGrades: %u",
unsigned(g_vPlayedStageStats.size()), unsigned(info.grades.size())); unsigned(STATSMAN->m_vPlayedStageStats.size()), unsigned(info.grades.size()));
bool foundavalidgradeforstage = false; bool foundavalidgradeforstage = false;
for(unsigned d=info.grades.size()-1,g=g_vPlayedStageStats.size()-1;d>0;d--,g--) for(unsigned d=info.grades.size()-1,g=STATSMAN->m_vPlayedStageStats.size()-1;d>0;d--,g--)
{ {
if(d>g) ASSERT(0); // this should never happen. if(d>g) ASSERT(0); // this should never happen.
FOREACH_EnabledPlayer( pn ) FOREACH_EnabledPlayer( pn )
{ {
LOG->Info("Player%d Grade: %d :: Expected Grade: %d",pn,g_vPlayedStageStats[g].m_player[pn].GetGrade(),info.grades[d]); LOG->Info("Player%d Grade: %d :: Expected Grade: %d",pn,STATSMAN->m_vPlayedStageStats[g].m_player[pn].GetGrade(),info.grades[d]);
if(g_vPlayedStageStats[g].m_player[pn].GetGrade() == info.grades[d]) if(STATSMAN->m_vPlayedStageStats[g].m_player[pn].GetGrade() == info.grades[d])
{ {
LOG->Info("One Valid Grade"); LOG->Info("One Valid Grade");
foundavalidgradeforstage = true; foundavalidgradeforstage = true;
@@ -592,7 +592,7 @@ void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info)
bool foundclearcond = false; bool foundclearcond = false;
if(info.cleared == CBGA_CSFAILED) if(info.cleared == CBGA_CSFAILED)
{ {
if(GAMESTATE->AllAreDead() || g_CurStageStats.AllFailed()) // they met the fail condition if(GAMESTATE->AllAreDead() || STATSMAN->m_CurStageStats.AllFailed()) // they met the fail condition
{ {
LOG->Info("Failed Condition"); LOG->Info("Failed Condition");
foundclearcond = true; foundclearcond = true;
@@ -600,7 +600,7 @@ void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info)
} }
else if(info.cleared == CBGA_CSCLEARED) else if(info.cleared == CBGA_CSCLEARED)
{ {
if(!g_CurStageStats.AllFailed() || !GAMESTATE->AllAreDead() ) // stage was cleared if(!STATSMAN->m_CurStageStats.AllFailed() || !GAMESTATE->AllAreDead() ) // stage was cleared
{ {
LOG->Info("Cleared Condition"); LOG->Info("Cleared Condition");
foundclearcond = true; foundclearcond = true;
@@ -610,7 +610,7 @@ void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info)
{ {
FOREACH_EnabledPlayer( pn ) FOREACH_EnabledPlayer( pn )
{ {
if(g_CurStageStats.m_player[pn].FullCombo()) if(STATSMAN->m_CurStageStats.m_player[pn].FullCombo())
{ {
foundclearcond = true; foundclearcond = true;
LOG->Info("MaxCombo Condition"); LOG->Info("MaxCombo Condition");
@@ -621,7 +621,7 @@ void ConditionalBGA::CheckBgaRequirements(BgaCondInfo info)
{ {
FOREACH_EnabledPlayer( pn ) FOREACH_EnabledPlayer( pn )
{ {
if(!g_CurStageStats.m_player[pn].FullCombo()) if(!STATSMAN->m_CurStageStats.m_player[pn].FullCombo())
{ {
LOG->Info("BrokenCombo Condition"); LOG->Info("BrokenCombo Condition");
foundclearcond = true; foundclearcond = true;
+2 -2
View File
@@ -7,7 +7,7 @@
#include "GameState.h" #include "GameState.h"
#include "song.h" #include "song.h"
#include "Character.h" #include "Character.h"
#include "StageStats.h" #include "StatsManager.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "Model.h" #include "Model.h"
@@ -343,7 +343,7 @@ void DancingCharacters::DrawPrimitives()
continue; continue;
} }
bool bFailed = g_CurStageStats.m_player[p].bFailed; bool bFailed = STATSMAN->m_CurStageStats.m_player[p].bFailed;
bool bDanger = m_bDrawDangerLight; bool bDanger = m_bDrawDangerLight;
DISPLAY->SetLighting( true ); DISPLAY->SetLighting( true );
+27 -27
View File
@@ -23,7 +23,7 @@
#include "RageFile.h" #include "RageFile.h"
#include "Bookkeeper.h" #include "Bookkeeper.h"
#include "MemoryCardManager.h" #include "MemoryCardManager.h"
#include "StageStats.h" #include "StatsManager.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "StepMania.h" #include "StepMania.h"
#include "CommonMetrics.h" #include "CommonMetrics.h"
@@ -167,7 +167,7 @@ void GameState::Reset()
* SongManager::UpdateBest could be called). Erase the cache. */ * SongManager::UpdateBest could be called). Erase the cache. */
SONGMAN->RegenerateNonFixedCourses(); SONGMAN->RegenerateNonFixedCourses();
g_vPlayedStageStats.clear(); STATSMAN->m_vPlayedStageStats.clear();
m_SongOptions.Init(); m_SongOptions.Init();
@@ -326,7 +326,7 @@ void GameState::EndGame()
if( m_bDemonstrationOrJukebox ) if( m_bDemonstrationOrJukebox )
return; return;
if( m_timeGameStarted.IsZero() || !g_vPlayedStageStats.size() ) // we were in the middle of a game and played at least one song if( m_timeGameStarted.IsZero() || !STATSMAN->m_vPlayedStageStats.size() ) // we were in the middle of a game and played at least one song
return; return;
/* Finish the final stage. */ /* Finish the final stage. */
@@ -504,8 +504,8 @@ void GameState::ResetMusicStatistics()
void GameState::ResetStageStatistics() void GameState::ResetStageStatistics()
{ {
StageStats OldStats = g_CurStageStats; StageStats OldStats = STATSMAN->m_CurStageStats;
g_CurStageStats = StageStats(); STATSMAN->m_CurStageStats = StageStats();
if( PREFSMAN->m_bComboContinuesBetweenSongs ) if( PREFSMAN->m_bComboContinuesBetweenSongs )
{ {
if( GetStageIndex() == 0 ) if( GetStageIndex() == 0 )
@@ -514,14 +514,14 @@ void GameState::ResetStageStatistics()
{ {
Profile* pProfile = PROFILEMAN->GetProfile(p); Profile* pProfile = PROFILEMAN->GetProfile(p);
if( pProfile ) if( pProfile )
g_CurStageStats.m_player[p].iCurCombo = pProfile->m_iCurrentCombo; STATSMAN->m_CurStageStats.m_player[p].iCurCombo = pProfile->m_iCurrentCombo;
} }
} }
else // GetStageIndex() > 0 else // GetStageIndex() > 0
{ {
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
{ {
g_CurStageStats.m_player[p].iCurCombo = OldStats.m_player[p].iCurCombo; STATSMAN->m_CurStageStats.m_player[p].iCurCombo = OldStats.m_player[p].iCurCombo;
} }
} }
} }
@@ -647,12 +647,12 @@ void GameState::FinishStage()
// //
FOREACH_HumanPlayer( pn ) FOREACH_HumanPlayer( pn )
{ {
int iNumTapsAndHolds = (int) g_CurStageStats.m_player[pn].radarActual[RADAR_NUM_TAPS_AND_HOLDS]; int iNumTapsAndHolds = (int) STATSMAN->m_CurStageStats.m_player[pn].radarActual[RADAR_NUM_TAPS_AND_HOLDS];
int iNumJumps = (int) g_CurStageStats.m_player[pn].radarActual[RADAR_NUM_JUMPS]; int iNumJumps = (int) STATSMAN->m_CurStageStats.m_player[pn].radarActual[RADAR_NUM_JUMPS];
int iNumHolds = (int) g_CurStageStats.m_player[pn].radarActual[RADAR_NUM_HOLDS]; int iNumHolds = (int) STATSMAN->m_CurStageStats.m_player[pn].radarActual[RADAR_NUM_HOLDS];
int iNumMines = (int) g_CurStageStats.m_player[pn].radarActual[RADAR_NUM_MINES]; int iNumMines = (int) STATSMAN->m_CurStageStats.m_player[pn].radarActual[RADAR_NUM_MINES];
int iNumHands = (int) g_CurStageStats.m_player[pn].radarActual[RADAR_NUM_HANDS]; int iNumHands = (int) STATSMAN->m_CurStageStats.m_player[pn].radarActual[RADAR_NUM_HANDS];
float fCaloriesBurned = g_CurStageStats.m_player[pn].fCaloriesBurned; float fCaloriesBurned = STATSMAN->m_CurStageStats.m_player[pn].fCaloriesBurned;
PROFILEMAN->AddStepTotals( pn, iNumTapsAndHolds, iNumJumps, iNumHolds, iNumMines, iNumHands, fCaloriesBurned ); PROFILEMAN->AddStepTotals( pn, iNumTapsAndHolds, iNumJumps, iNumHolds, iNumMines, iNumHands, fCaloriesBurned );
} }
@@ -660,7 +660,7 @@ void GameState::FinishStage()
// Update profile stats // Update profile stats
Profile* pMachineProfile = PROFILEMAN->GetMachineProfile(); Profile* pMachineProfile = PROFILEMAN->GetMachineProfile();
int iGameplaySeconds = (int)truncf(g_CurStageStats.fGameplaySeconds); int iGameplaySeconds = (int)truncf(STATSMAN->m_CurStageStats.fGameplaySeconds);
pMachineProfile->m_iTotalGameplaySeconds += iGameplaySeconds; pMachineProfile->m_iTotalGameplaySeconds += iGameplaySeconds;
pMachineProfile->m_iCurrentCombo = 0; pMachineProfile->m_iCurrentCombo = 0;
@@ -676,11 +676,11 @@ void GameState::FinishStage()
pPlayerProfile->m_iTotalGameplaySeconds += iGameplaySeconds; pPlayerProfile->m_iTotalGameplaySeconds += iGameplaySeconds;
pPlayerProfile->m_iCurrentCombo = pPlayerProfile->m_iCurrentCombo =
PREFSMAN->m_bComboContinuesBetweenSongs ? PREFSMAN->m_bComboContinuesBetweenSongs ?
g_CurStageStats.m_player[pn].iCurCombo : STATSMAN->m_CurStageStats.m_player[pn].iCurCombo :
0; 0;
} }
const StageStats& ss = g_CurStageStats; const StageStats& ss = STATSMAN->m_CurStageStats;
AddPlayerStatsToProfile( pMachineProfile, ss, pn ); AddPlayerStatsToProfile( pMachineProfile, ss, pn );
if( pPlayerProfile ) if( pPlayerProfile )
@@ -778,7 +778,7 @@ int GameState::GetCourseSongIndex() const
int iSongIndex = 0; int iSongIndex = 0;
/* iSongsPlayed includes the current song, so it's 1-based; subtract one. */ /* iSongsPlayed includes the current song, so it's 1-based; subtract one. */
FOREACH_EnabledPlayer( pn ) FOREACH_EnabledPlayer( pn )
iSongIndex = max( iSongIndex, g_CurStageStats.m_player[pn].iSongsPlayed-1 ); iSongIndex = max( iSongIndex, STATSMAN->m_CurStageStats.m_player[pn].iSongsPlayed-1 );
return iSongIndex; return iSongIndex;
} }
@@ -975,7 +975,7 @@ bool GameState::HasEarnedExtraStage() const
if( PREFSMAN->m_bPickExtraStage && this->IsExtraStage() && !this->m_bAllow2ndExtraStage ) if( PREFSMAN->m_bPickExtraStage && this->IsExtraStage() && !this->m_bAllow2ndExtraStage )
continue; continue;
if( g_CurStageStats.m_player[pn].GetGrade() <= GRADE_TIER_3 ) if( STATSMAN->m_CurStageStats.m_player[pn].GetGrade() <= GRADE_TIER_3 )
return true; return true;
} }
} }
@@ -1013,11 +1013,11 @@ StageResult GameState::GetStageResult( PlayerNumber pn ) const
continue; continue;
/* If anyone did just as well, at best it's a draw. */ /* If anyone did just as well, at best it's a draw. */
if( g_CurStageStats.m_player[p].iActualDancePoints == g_CurStageStats.m_player[pn].iActualDancePoints ) if( STATSMAN->m_CurStageStats.m_player[p].iActualDancePoints == STATSMAN->m_CurStageStats.m_player[pn].iActualDancePoints )
win = RESULT_DRAW; win = RESULT_DRAW;
/* If anyone did better, we lost. */ /* If anyone did better, we lost. */
if( g_CurStageStats.m_player[p].iActualDancePoints > g_CurStageStats.m_player[pn].iActualDancePoints ) if( STATSMAN->m_CurStageStats.m_player[p].iActualDancePoints > STATSMAN->m_CurStageStats.m_player[pn].iActualDancePoints )
return RESULT_LOSE; return RESULT_LOSE;
} }
return win; return win;
@@ -1029,9 +1029,9 @@ void GameState::GetFinalEvalStats( StageStats& statsOut ) const
// Show stats only for the latest 3 normal songs + passed extra stages // Show stats only for the latest 3 normal songs + passed extra stages
int PassedRegularSongsLeft = 3; int PassedRegularSongsLeft = 3;
for( int i = (int)g_vPlayedStageStats.size()-1; i >= 0; --i ) for( int i = (int)STATSMAN->m_vPlayedStageStats.size()-1; i >= 0; --i )
{ {
const StageStats &s = g_vPlayedStageStats[i]; const StageStats &s = STATSMAN->m_vPlayedStageStats[i];
if( !s.OnePassed() ) if( !s.OnePassed() )
continue; continue;
@@ -1410,13 +1410,13 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
// //
vector<SongAndSteps> vSongAndSteps; vector<SongAndSteps> vSongAndSteps;
for( unsigned i=0; i<g_vPlayedStageStats.size(); i++ ) for( unsigned i=0; i<STATSMAN->m_vPlayedStageStats.size(); i++ )
{ {
CHECKPOINT_M( ssprintf("%u/%i", i, (int)g_vPlayedStageStats.size() ) ); CHECKPOINT_M( ssprintf("%u/%i", i, (int)STATSMAN->m_vPlayedStageStats.size() ) );
SongAndSteps sas; SongAndSteps sas;
sas.pSong = g_vPlayedStageStats[i].vpSongs[0]; sas.pSong = STATSMAN->m_vPlayedStageStats[i].vpSongs[0];
ASSERT( sas.pSong ); ASSERT( sas.pSong );
sas.pSteps = g_vPlayedStageStats[i].m_player[pn].vpSteps[0]; sas.pSteps = STATSMAN->m_vPlayedStageStats[i].m_player[pn].vpSteps[0];
ASSERT( sas.pSteps ); ASSERT( sas.pSteps );
vSongAndSteps.push_back( sas ); vSongAndSteps.push_back( sas );
} }
@@ -1678,7 +1678,7 @@ bool GameState::AllAreDead() const
bool GameState::AllHaveComboOf30OrMoreMisses() const bool GameState::AllHaveComboOf30OrMoreMisses() const
{ {
FOREACH_EnabledPlayer( p ) FOREACH_EnabledPlayer( p )
if( g_CurStageStats.m_player[p].iCurMissCombo < 30 ) if( STATSMAN->m_CurStageStats.m_player[p].iCurMissCombo < 30 )
return false; return false;
return true; return true;
} }
+3 -3
View File
@@ -8,7 +8,7 @@
#include "song.h" #include "song.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "GameplayMessages.h" #include "GameplayMessages.h"
#include "StageStats.h" #include "StatsManager.h"
#include "ThemeMetric.h" #include "ThemeMetric.h"
#include "PlayerState.h" #include "PlayerState.h"
@@ -94,10 +94,10 @@ void Inventory::Update( float fDelta )
PlayerNumber pn = m_pPlayerState->m_PlayerNumber; PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
// check to see if they deserve a new item // check to see if they deserve a new item
if( g_CurStageStats.m_player[pn].iCurCombo != m_iLastSeenCombo ) if( STATSMAN->m_CurStageStats.m_player[pn].iCurCombo != m_iLastSeenCombo )
{ {
int iOldCombo = m_iLastSeenCombo; int iOldCombo = m_iLastSeenCombo;
m_iLastSeenCombo = g_CurStageStats.m_player[pn].iCurCombo; m_iLastSeenCombo = STATSMAN->m_CurStageStats.m_player[pn].iCurCombo;
int iNewCombo = m_iLastSeenCombo; int iNewCombo = m_iLastSeenCombo;
#define CROSSED(i) (iOldCombo<i)&&(iNewCombo>=i) #define CROSSED(i) (iOldCombo<i)&&(iNewCombo>=i)
+3 -3
View File
@@ -7,7 +7,7 @@
#include "RageMath.h" #include "RageMath.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "song.h" #include "song.h"
#include "StageStats.h" #include "StatsManager.h"
#include "ThemeMetric.h" #include "ThemeMetric.h"
#include "PlayerState.h" #include "PlayerState.h"
@@ -402,7 +402,7 @@ void LifeMeterBar::ChangeLife( float fDeltaLife )
} }
/* If we've already failed, there's no point in letting them fill up the bar again. */ /* If we've already failed, there's no point in letting them fill up the bar again. */
if( g_CurStageStats.m_player[m_PlayerNumber].bFailed ) if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailed )
fDeltaLife = 0; fDeltaLife = 0;
switch( GAMESTATE->m_SongOptions.m_DrainType ) switch( GAMESTATE->m_SongOptions.m_DrainType )
@@ -431,7 +431,7 @@ void LifeMeterBar::ChangeLife( float fDeltaLife )
CLAMP( m_fLifePercentage, 0, 1 ); CLAMP( m_fLifePercentage, 0, 1 );
if( m_fLifePercentage <= FAIL_THRESHOLD ) if( m_fLifePercentage <= FAIL_THRESHOLD )
g_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier = true; STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier = true;
m_fLifeVelocity += fDeltaLife; m_fLifeVelocity += fDeltaLife;
} }
+6 -6
View File
@@ -3,7 +3,7 @@
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "Steps.h" #include "Steps.h"
#include "StageStats.h" #include "StatsManager.h"
const float BATTERY_X[NUM_PLAYERS] = { -92, +92 }; const float BATTERY_X[NUM_PLAYERS] = { -92, +92 };
@@ -54,7 +54,7 @@ void LifeMeterBattery::Load( PlayerNumber pn )
if( bPlayerEnabled ) if( bPlayerEnabled )
{ {
m_Percent.SetName( "LifeMeterBattery Percent" ); m_Percent.SetName( "LifeMeterBattery Percent" );
m_Percent.Load( pn, &g_CurStageStats.m_player[pn], true ); m_Percent.Load( pn, &STATSMAN->m_CurStageStats.m_player[pn], true );
this->AddChild( &m_Percent ); this->AddChild( &m_Percent );
} }
@@ -63,7 +63,7 @@ void LifeMeterBattery::Load( PlayerNumber pn )
void LifeMeterBattery::OnSongEnded() void LifeMeterBattery::OnSongEnded()
{ {
if( g_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier ) if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier )
return; return;
if( m_iLivesLeft < GAMESTATE->m_SongOptions.m_iBatteryLives ) if( m_iLivesLeft < GAMESTATE->m_SongOptions.m_iBatteryLives )
@@ -80,7 +80,7 @@ void LifeMeterBattery::OnSongEnded()
void LifeMeterBattery::ChangeLife( TapNoteScore score ) void LifeMeterBattery::ChangeLife( TapNoteScore score )
{ {
if( g_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier ) if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier )
return; return;
switch( score ) switch( score )
@@ -108,7 +108,7 @@ void LifeMeterBattery::ChangeLife( TapNoteScore score )
ASSERT(0); ASSERT(0);
} }
if( m_iLivesLeft == 0 ) if( m_iLivesLeft == 0 )
g_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier = true; STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier = true;
} }
void LifeMeterBattery::ChangeLife( HoldNoteScore score, TapNoteScore tscore ) void LifeMeterBattery::ChangeLife( HoldNoteScore score, TapNoteScore tscore )
@@ -146,7 +146,7 @@ bool LifeMeterBattery::IsHot() const
bool LifeMeterBattery::IsFailing() const bool LifeMeterBattery::IsFailing() const
{ {
return g_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier; return STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier;
} }
float LifeMeterBattery::GetLife() const float LifeMeterBattery::GetLife() const
+3 -1
View File
@@ -289,7 +289,9 @@ MemoryCardManager.cpp MemoryCardManager.h \
MessageManager.cpp MessageManager.h NetworkSyncManager.cpp NetworkSyncManager.h \ MessageManager.cpp MessageManager.h NetworkSyncManager.cpp NetworkSyncManager.h \
NetworkSyncServer.cpp NetworkSyncServer.h NoteSkinManager.cpp NoteSkinManager.h \ NetworkSyncServer.cpp NetworkSyncServer.h NoteSkinManager.cpp NoteSkinManager.h \
PrefsManager.cpp PrefsManager.h ProfileManager.cpp ProfileManager.h ScreenManager.cpp \ PrefsManager.cpp PrefsManager.h ProfileManager.cpp ProfileManager.h ScreenManager.cpp \
ScreenManager.h SongManager.cpp SongManager.h ThemeManager.cpp ThemeManager.h \ ScreenManager.h SongManager.cpp SongManager.h \
StatsManager.cpp StatsManager.h \
ThemeManager.cpp ThemeManager.h \
UnlockSystem.cpp UnlockSystem.h UnlockSystem.cpp UnlockSystem.h
if !WITHOUT_NETWORKING if !WITHOUT_NETWORKING
+3 -3
View File
@@ -32,7 +32,7 @@ void NetworkSyncManager::SelectUserSong() { }
#include "song.h" #include "song.h"
#include "Course.h" #include "Course.h"
#include "GameState.h" #include "GameState.h"
#include "StageStats.h" #include "StatsManager.h"
#include "Steps.h" #include "Steps.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ProductInfo.h" #include "ProductInfo.h"
@@ -297,9 +297,9 @@ void NetworkSyncManager::ReportScore(int playerID, int step, int score, int comb
uint8_t ctr = (uint8_t) (playerID * 16 + step - 1); uint8_t ctr = (uint8_t) (playerID * 16 + step - 1);
m_packet.Write1(ctr); m_packet.Write1(ctr);
ctr = uint8_t( g_CurStageStats.m_player[playerID].GetGrade()*16 ); ctr = uint8_t( STATSMAN->m_CurStageStats.m_player[playerID].GetGrade()*16 );
if ( g_CurStageStats.m_player[playerID].bFailedEarlier ) if ( STATSMAN->m_CurStageStats.m_player[playerID].bFailedEarlier )
ctr = uint8_t( 112 ); //Code for failed (failed constant seems not to work) ctr = uint8_t( 112 ); //Code for failed (failed constant seems not to work)
m_packet.Write1(ctr); m_packet.Write1(ctr);
+6 -5
View File
@@ -2,6 +2,7 @@
#include "NoteDataWithScoring.h" #include "NoteDataWithScoring.h"
#include "NoteData.h" #include "NoteData.h"
#include "StageStats.h" #include "StageStats.h"
#include "StatsManager.h"
namespace namespace
{ {
@@ -222,12 +223,12 @@ float GetActualStreamRadarValue( const NoteData &in, float fSongSeconds, PlayerN
float GetActualVoltageRadarValue( const NoteData &in, float fSongSeconds, PlayerNumber pn ) float GetActualVoltageRadarValue( const NoteData &in, float fSongSeconds, PlayerNumber pn )
{ {
/* g_CurStageStats.iMaxCombo is unrelated to GetNumTapNotes: m_bComboContinuesBetweenSongs /* STATSMAN->m_CurStageStats.iMaxCombo is unrelated to GetNumTapNotes: m_bComboContinuesBetweenSongs
* might be on, and the way combo is counted varies depending on the mode and score * 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 * 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. */ * only subtly different: it's the percent of the song the longest combo took to get. */
const PlayerStageStats::Combo_t MaxCombo = g_CurStageStats.m_player[pn].GetMaxCombo(); const PlayerStageStats::Combo_t MaxCombo = STATSMAN->m_CurStageStats.m_player[pn].GetMaxCombo();
float fComboPercent = SCALE( MaxCombo.fSizeSeconds, 0, g_CurStageStats.m_player[pn].fLastSecond-g_CurStageStats.m_player[pn].fFirstSecond, 0.0f, 1.0f ); float fComboPercent = SCALE( MaxCombo.fSizeSeconds, 0, STATSMAN->m_CurStageStats.m_player[pn].fLastSecond-STATSMAN->m_CurStageStats.m_player[pn].fFirstSecond, 0.0f, 1.0f );
return clamp( fComboPercent, 0.0f, 1.0f ); return clamp( fComboPercent, 0.0f, 1.0f );
} }
@@ -244,11 +245,11 @@ float GetActualAirRadarValue( const NoteData &in, float fSongSeconds, PlayerNumb
float GetActualChaosRadarValue( const NoteData &in, float fSongSeconds, PlayerNumber pn ) float GetActualChaosRadarValue( const NoteData &in, float fSongSeconds, PlayerNumber pn )
{ {
const int iPossibleDP = g_CurStageStats.m_player[pn].iPossibleDancePoints; const int iPossibleDP = STATSMAN->m_CurStageStats.m_player[pn].iPossibleDancePoints;
if ( iPossibleDP == 0 ) if ( iPossibleDP == 0 )
return 1; return 1;
const int ActualDP = g_CurStageStats.m_player[pn].iActualDancePoints; const int ActualDP = STATSMAN->m_CurStageStats.m_player[pn].iActualDancePoints;
return clamp( float(ActualDP)/iPossibleDP, 0.0f, 1.0f ); return clamp( float(ActualDP)/iPossibleDP, 0.0f, 1.0f );
} }
+1 -1
View File
@@ -38,7 +38,7 @@ void ScoreDisplayCalories::PlayCommand( const CString &sCommandName )
{ {
if( sCommandName == m_sMessageOnStep ) if( sCommandName == m_sMessageOnStep )
{ {
float fCals = g_CurStageStats.m_player[m_PlayerNumber].fCaloriesBurned; float fCals = STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].fCaloriesBurned;
this->SetTargetNumber( fCals ); this->SetTargetNumber( fCals );
} }
+3 -3
View File
@@ -6,7 +6,7 @@
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "PlayerState.h" #include "PlayerState.h"
#include "StageStats.h" #include "StatsManager.h"
#include "CommonMetrics.h" #include "CommonMetrics.h"
@@ -46,8 +46,8 @@ void ScoreDisplayNormal::SetScore( int iNewScore )
// score for subtracrive is MaxScore - score). // score for subtracrive is MaxScore - score).
int iMaxScore = g_CurStageStats.m_player[pn].iMaxScore; int iMaxScore = STATSMAN->m_CurStageStats.m_player[pn].iMaxScore;
int iCurMaxScore = g_CurStageStats.m_player[pn].iCurMaxScore; int iCurMaxScore = STATSMAN->m_CurStageStats.m_player[pn].iCurMaxScore;
switch( m_pPlayerState->m_CurrentPlayerOptions.m_ScoreDisplay ) switch( m_pPlayerState->m_CurrentPlayerOptions.m_ScoreDisplay )
{ {
+2 -2
View File
@@ -6,7 +6,7 @@
#include "RageLog.h" #include "RageLog.h"
#include "GameState.h" #include "GameState.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "StageStats.h" #include "StatsManager.h"
#include "PlayerState.h" #include "PlayerState.h"
#include "CommonMetrics.h" #include "CommonMetrics.h"
@@ -44,7 +44,7 @@ void ScoreDisplayOni::Update( float fDelta )
float fSecsIntoPlay = 0; float fSecsIntoPlay = 0;
if( GAMESTATE->IsPlayerEnabled(pn) ) if( GAMESTATE->IsPlayerEnabled(pn) )
fSecsIntoPlay = g_CurStageStats.m_player[pn].fAliveSeconds; fSecsIntoPlay = STATSMAN->m_CurStageStats.m_player[pn].fAliveSeconds;
m_text.SetText( SecondsToMMSSMsMs(fSecsIntoPlay) ); m_text.SetText( SecondsToMMSSMsMs(fSecsIntoPlay) );
} }
+2 -2
View File
@@ -2,7 +2,7 @@
#include "ScoreDisplayPercentage.h" #include "ScoreDisplayPercentage.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "StageStats.h" #include "StatsManager.h"
#include "PlayerState.h" #include "PlayerState.h"
ScoreDisplayPercentage::ScoreDisplayPercentage() ScoreDisplayPercentage::ScoreDisplayPercentage()
@@ -16,7 +16,7 @@ ScoreDisplayPercentage::ScoreDisplayPercentage()
void ScoreDisplayPercentage::Init( const PlayerState* pPlayerState ) void ScoreDisplayPercentage::Init( const PlayerState* pPlayerState )
{ {
m_Percent.Load( pPlayerState->m_PlayerNumber, &g_CurStageStats.m_player[pPlayerState->m_PlayerNumber], true ); m_Percent.Load( pPlayerState->m_PlayerNumber, &STATSMAN->m_CurStageStats.m_player[pPlayerState->m_PlayerNumber], true );
} }
/* /*
+1 -1
View File
@@ -29,7 +29,7 @@ ScoreKeeperMAX2::ScoreKeeperMAX2(
ASSERT( apSongs.size() == apSteps_.size() ); ASSERT( apSongs.size() == apSteps_.size() );
ASSERT( apSongs.size() == asModifiers.size() ); ASSERT( apSongs.size() == asModifiers.size() );
// //
// Fill in g_CurStageStats, calculate multiplier // Fill in STATSMAN->m_CurStageStats, calculate multiplier
// //
int iTotalPossibleDancePoints = 0; int iTotalPossibleDancePoints = 0;
for( unsigned i=0; i<apSteps.size(); i++ ) for( unsigned i=0; i<apSteps.size(); i++ )
+24 -24
View File
@@ -15,7 +15,7 @@
#include "SongUtil.h" #include "SongUtil.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "StageStats.h" #include "StatsManager.h"
#include "PlayerState.h" #include "PlayerState.h"
#include "BGAnimation.h" #include "BGAnimation.h"
@@ -152,8 +152,8 @@ ScreenEnding::ScreenEnding( CString sClassName ) : ScreenAttract( sClassName, fa
GAMESTATE->m_pCurCourse = SONGMAN->GetRandomCourse(); GAMESTATE->m_pCurCourse = SONGMAN->GetRandomCourse();
GAMESTATE->m_pCurSteps[PLAYER_1] = GAMESTATE->m_pCurSong->GetAllSteps()[0]; GAMESTATE->m_pCurSteps[PLAYER_1] = GAMESTATE->m_pCurSong->GetAllSteps()[0];
GAMESTATE->m_pCurSteps[PLAYER_2] = GAMESTATE->m_pCurSong->GetAllSteps()[0]; GAMESTATE->m_pCurSteps[PLAYER_2] = GAMESTATE->m_pCurSong->GetAllSteps()[0];
g_CurStageStats.m_player[PLAYER_1].vpSteps.push_back( GAMESTATE->m_pCurSteps[PLAYER_1] ); STATSMAN->m_CurStageStats.m_player[PLAYER_1].vpSteps.push_back( GAMESTATE->m_pCurSteps[PLAYER_1] );
g_CurStageStats.m_player[PLAYER_2].vpSteps.push_back( GAMESTATE->m_pCurSteps[PLAYER_2] ); STATSMAN->m_CurStageStats.m_player[PLAYER_2].vpSteps.push_back( GAMESTATE->m_pCurSteps[PLAYER_2] );
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_fScrollSpeed = 2; GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_fScrollSpeed = 2;
GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions.m_fScrollSpeed = 2; GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions.m_fScrollSpeed = 2;
GAMESTATE->m_iCurrentStageIndex = 0; GAMESTATE->m_iCurrentStageIndex = 0;
@@ -163,31 +163,31 @@ ScreenEnding::ScreenEnding( CString sClassName ) : ScreenAttract( sClassName, fa
for( float f = 0; f < 100.0f; f += 1.0f ) for( float f = 0; f < 100.0f; f += 1.0f )
{ {
float fP1 = fmodf(f/100*4+.3f,1); float fP1 = fmodf(f/100*4+.3f,1);
g_CurStageStats.m_player[PLAYER_1].SetLifeRecordAt( fP1, f ); STATSMAN->m_CurStageStats.m_player[PLAYER_1].SetLifeRecordAt( fP1, f );
g_CurStageStats.m_player[PLAYER_2].SetLifeRecordAt( 1-fP1, f ); STATSMAN->m_CurStageStats.m_player[PLAYER_2].SetLifeRecordAt( 1-fP1, f );
} }
g_CurStageStats.m_player[PLAYER_1].iActualDancePoints = rand()%3; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iActualDancePoints = rand()%3;
g_CurStageStats.m_player[PLAYER_1].iPossibleDancePoints = 2; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iPossibleDancePoints = 2;
g_CurStageStats.m_player[PLAYER_2].iActualDancePoints = rand()%2; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iActualDancePoints = rand()%2;
g_CurStageStats.m_player[PLAYER_2].iPossibleDancePoints = 1; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iPossibleDancePoints = 1;
g_CurStageStats.m_player[PLAYER_1].iCurCombo = 0; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 0;
g_CurStageStats.m_player[PLAYER_1].UpdateComboList( 0, false ); STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 0, false );
g_CurStageStats.m_player[PLAYER_1].iCurCombo = 1; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 1;
g_CurStageStats.m_player[PLAYER_1].UpdateComboList( 1, false ); STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 1, false );
g_CurStageStats.m_player[PLAYER_1].iCurCombo = 50; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 50;
g_CurStageStats.m_player[PLAYER_1].UpdateComboList( 25, false ); STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 25, false );
g_CurStageStats.m_player[PLAYER_1].iCurCombo = 250; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 250;
g_CurStageStats.m_player[PLAYER_1].UpdateComboList( 100, false ); STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 100, false );
g_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_MARVELOUS] = rand()%2; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_MARVELOUS] = rand()%2;
g_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_PERFECT] = rand()%2; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_PERFECT] = rand()%2;
g_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_GREAT] = rand()%2; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_GREAT] = rand()%2;
g_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_MARVELOUS] = rand()%2; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_MARVELOUS] = rand()%2;
g_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_PERFECT] = rand()%2; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_PERFECT] = rand()%2;
g_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_GREAT] = rand()%2; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_GREAT] = rand()%2;
g_vPlayedStageStats.clear(); STATSMAN->m_vPlayedStageStats.clear();
} }
+50 -50
View File
@@ -20,7 +20,7 @@
#include "LightsManager.h" #include "LightsManager.h"
#include "ProfileManager.h" #include "ProfileManager.h"
#include "song.h" #include "song.h"
#include "StageStats.h" #include "StatsManager.h"
#include "Grade.h" #include "Grade.h"
#include "CodeDetector.h" #include "CodeDetector.h"
#include "RageDisplay.h" #include "RageDisplay.h"
@@ -114,8 +114,8 @@ void ScreenEvaluation::Init()
GAMESTATE->m_pCurCourse = SONGMAN->GetRandomCourse(); GAMESTATE->m_pCurCourse = SONGMAN->GetRandomCourse();
GAMESTATE->m_pCurSteps[PLAYER_1] = GAMESTATE->m_pCurSong->GetAllSteps()[0]; GAMESTATE->m_pCurSteps[PLAYER_1] = GAMESTATE->m_pCurSong->GetAllSteps()[0];
GAMESTATE->m_pCurSteps[PLAYER_2] = GAMESTATE->m_pCurSong->GetAllSteps()[0]; GAMESTATE->m_pCurSteps[PLAYER_2] = GAMESTATE->m_pCurSong->GetAllSteps()[0];
g_CurStageStats.m_player[PLAYER_1].vpSteps.push_back( GAMESTATE->m_pCurSteps[PLAYER_1] ); STATSMAN->m_CurStageStats.m_player[PLAYER_1].vpSteps.push_back( GAMESTATE->m_pCurSteps[PLAYER_1] );
g_CurStageStats.m_player[PLAYER_2].vpSteps.push_back( GAMESTATE->m_pCurSteps[PLAYER_2] ); STATSMAN->m_CurStageStats.m_player[PLAYER_2].vpSteps.push_back( GAMESTATE->m_pCurSteps[PLAYER_2] );
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_fScrollSpeed = 2; GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_fScrollSpeed = 2;
GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions.m_fScrollSpeed = 2; GAMESTATE->m_pPlayerState[PLAYER_2]->m_PlayerOptions.m_fScrollSpeed = 2;
GAMESTATE->m_iCurrentStageIndex = 0; GAMESTATE->m_iCurrentStageIndex = 0;
@@ -129,61 +129,61 @@ void ScreenEvaluation::Init()
for( float f = 0; f < 100.0f; f += 1.0f ) for( float f = 0; f < 100.0f; f += 1.0f )
{ {
float fP1 = fmodf(f/100*4+.3f,1); float fP1 = fmodf(f/100*4+.3f,1);
g_CurStageStats.m_player[PLAYER_1].SetLifeRecordAt( fP1, f ); STATSMAN->m_CurStageStats.m_player[PLAYER_1].SetLifeRecordAt( fP1, f );
g_CurStageStats.m_player[PLAYER_2].SetLifeRecordAt( 1-fP1, f ); STATSMAN->m_CurStageStats.m_player[PLAYER_2].SetLifeRecordAt( 1-fP1, f );
} }
g_CurStageStats.m_player[PLAYER_1].iActualDancePoints = rand()%3; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iActualDancePoints = rand()%3;
g_CurStageStats.m_player[PLAYER_1].iPossibleDancePoints = 2; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iPossibleDancePoints = 2;
g_CurStageStats.m_player[PLAYER_2].iActualDancePoints = rand()%2; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iActualDancePoints = rand()%2;
g_CurStageStats.m_player[PLAYER_2].iPossibleDancePoints = 1; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iPossibleDancePoints = 1;
g_CurStageStats.m_player[PLAYER_1].iCurCombo = 0; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 0;
g_CurStageStats.m_player[PLAYER_1].UpdateComboList( 0, false ); STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 0, false );
g_CurStageStats.m_player[PLAYER_1].iCurCombo = 1; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 1;
g_CurStageStats.m_player[PLAYER_1].UpdateComboList( 1, false ); STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 1, false );
g_CurStageStats.m_player[PLAYER_1].iCurCombo = 50; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 50;
g_CurStageStats.m_player[PLAYER_1].UpdateComboList( 25, false ); STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 25, false );
g_CurStageStats.m_player[PLAYER_1].iCurCombo = 250; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = 250;
g_CurStageStats.m_player[PLAYER_1].UpdateComboList( 100, false ); STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 100, false );
if( rand()%2 ) if( rand()%2 )
{ {
g_CurStageStats.m_player[PLAYER_1].iCurCombo = rand()%11000; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iCurCombo = rand()%11000;
g_CurStageStats.m_player[PLAYER_1].UpdateComboList( 110, false ); STATSMAN->m_CurStageStats.m_player[PLAYER_1].UpdateComboList( 110, false );
} }
if( rand()%5 == 0 ) if( rand()%5 == 0 )
{ {
g_CurStageStats.m_player[PLAYER_1].bFailedEarlier = true; STATSMAN->m_CurStageStats.m_player[PLAYER_1].bFailedEarlier = true;
g_CurStageStats.m_player[PLAYER_2].bFailedEarlier = true; STATSMAN->m_CurStageStats.m_player[PLAYER_2].bFailedEarlier = true;
} }
g_CurStageStats.m_player[PLAYER_2].iCurCombo = 0; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iCurCombo = 0;
g_CurStageStats.m_player[PLAYER_2].UpdateComboList( 0, false ); STATSMAN->m_CurStageStats.m_player[PLAYER_2].UpdateComboList( 0, false );
g_CurStageStats.m_player[PLAYER_2].iCurCombo = 1; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iCurCombo = 1;
g_CurStageStats.m_player[PLAYER_2].UpdateComboList( 1, false ); STATSMAN->m_CurStageStats.m_player[PLAYER_2].UpdateComboList( 1, false );
g_CurStageStats.m_player[PLAYER_2].iCurCombo = 50; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iCurCombo = 50;
g_CurStageStats.m_player[PLAYER_2].UpdateComboList( 25, false ); STATSMAN->m_CurStageStats.m_player[PLAYER_2].UpdateComboList( 25, false );
g_CurStageStats.m_player[PLAYER_2].iCurCombo = 250; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iCurCombo = 250;
g_CurStageStats.m_player[PLAYER_2].UpdateComboList( 100, false ); STATSMAN->m_CurStageStats.m_player[PLAYER_2].UpdateComboList( 100, false );
if( rand()%2 ) if( rand()%2 )
{ {
g_CurStageStats.m_player[PLAYER_2].iCurCombo = rand()%11000; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iCurCombo = rand()%11000;
g_CurStageStats.m_player[PLAYER_2].UpdateComboList( 110, false ); STATSMAN->m_CurStageStats.m_player[PLAYER_2].UpdateComboList( 110, false );
} }
g_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_MARVELOUS] = rand()%3; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_MARVELOUS] = rand()%3;
g_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_PERFECT] = rand()%3; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_PERFECT] = rand()%3;
g_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_GREAT] = rand()%3; STATSMAN->m_CurStageStats.m_player[PLAYER_1].iTapNoteScores[TNS_GREAT] = rand()%3;
g_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_MARVELOUS] = rand()%3; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_MARVELOUS] = rand()%3;
g_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_PERFECT] = rand()%3; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_PERFECT] = rand()%3;
g_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_GREAT] = rand()%3; STATSMAN->m_CurStageStats.m_player[PLAYER_2].iTapNoteScores[TNS_GREAT] = rand()%3;
g_vPlayedStageStats.clear(); STATSMAN->m_vPlayedStageStats.clear();
} }
LOG->Trace( "ScreenEvaluation::ScreenEvaluation()" ); LOG->Trace( "ScreenEvaluation::ScreenEvaluation()" );
LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU ); LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU );
m_bFailed = g_CurStageStats.AllFailed(); m_bFailed = STATSMAN->m_CurStageStats.AllFailed();
ZERO( m_bSavedScreenshot ); ZERO( m_bSavedScreenshot );
@@ -210,7 +210,7 @@ void ScreenEvaluation::Init()
break; break;
case stage: case stage:
case course: case course:
stageStats = g_CurStageStats; stageStats = STATSMAN->m_CurStageStats;
break; break;
default: default:
ASSERT(0); ASSERT(0);
@@ -249,7 +249,7 @@ void ScreenEvaluation::Init()
const int ScoreBonuses[] = { 10000000, 10000000, 1000000, 100000, 10000, 1000, 100 }; const int ScoreBonuses[] = { 10000000, 10000000, 1000000, 100000, 10000, 1000, 100 };
if( grade[p] < (int) ARRAYSIZE(ScoreBonuses) ) if( grade[p] < (int) ARRAYSIZE(ScoreBonuses) )
{ {
g_CurStageStats.m_player[p].iBonus += ScoreBonuses[(int)grade[p] ]; STATSMAN->m_CurStageStats.m_player[p].iBonus += ScoreBonuses[(int)grade[p] ];
stageStats.m_player[p].iBonus += ScoreBonuses[(int)grade[p] ]; stageStats.m_player[p].iBonus += ScoreBonuses[(int)grade[p] ];
} }
} }
@@ -500,7 +500,7 @@ void ScreenEvaluation::Init()
/* Use "ScreenEvaluation Percent" for the [metric set], but position and /* Use "ScreenEvaluation Percent" for the [metric set], but position and
* tween it with "PercentP1X", etc. */ * tween it with "PercentP1X", etc. */
m_Percent[p].SetName( "ScreenEvaluation Percent" ); m_Percent[p].SetName( "ScreenEvaluation Percent" );
m_Percent[p].Load( p, &g_CurStageStats.m_player[p], true ); m_Percent[p].Load( p, &STATSMAN->m_CurStageStats.m_player[p], true );
m_Percent[p].SetXY( THEME->GetMetricF(m_sName, ssprintf("PercentP%dX",p+1)), m_Percent[p].SetXY( THEME->GetMetricF(m_sName, ssprintf("PercentP%dX",p+1)),
THEME->GetMetricF(m_sName,ssprintf("PercentP%dY",p+1)) ); THEME->GetMetricF(m_sName,ssprintf("PercentP%dY",p+1)) );
m_Percent[p].RunCommands( THEME->GetMetricA(m_sName,ssprintf("PercentP%dOnCommand",p+1)) ); m_Percent[p].RunCommands( THEME->GetMetricA(m_sName,ssprintf("PercentP%dOnCommand",p+1)) );
@@ -703,8 +703,8 @@ void ScreenEvaluation::Init()
FOREACH_EnabledPlayer( p ) FOREACH_EnabledPlayer( p )
{ {
int iTotalScore=0; int iTotalScore=0;
for( unsigned i=0; i<g_vPlayedStageStats.size(); i++ ) for( unsigned i=0; i<STATSMAN->m_vPlayedStageStats.size(); i++ )
iTotalScore += g_vPlayedStageStats[i].m_player[p].iScore; iTotalScore += STATSMAN->m_vPlayedStageStats[i].m_player[p].iScore;
//iTotalScore += stageStats.m_player[p].iScore; //iTotalScore += stageStats.m_player[p].iScore;
@@ -1288,7 +1288,7 @@ void ScreenEvaluation::Update( float fDeltaTime )
FOREACH_EnabledPlayer( p ) FOREACH_EnabledPlayer( p )
{ {
if( g_CurStageStats.m_player[p].iBonus == 0 ) if( STATSMAN->m_CurStageStats.m_player[p].iBonus == 0 )
continue; continue;
if( GAMESTATE->IsCourseMode() ) if( GAMESTATE->IsCourseMode() )
@@ -1298,16 +1298,16 @@ void ScreenEvaluation::Update( float fDeltaTime )
if( RageTimer::GetTimeSinceStart() - m_fScreenCreateTime < 1.5f ) if( RageTimer::GetTimeSinceStart() - m_fScreenCreateTime < 1.5f )
continue; continue;
int increment = g_CurStageStats.m_player[p].iBonus/10; int increment = STATSMAN->m_CurStageStats.m_player[p].iBonus/10;
/* XXX: What's this supposed to do? If i < 1, then min(i, 1024) is i ... */ /* XXX: What's this supposed to do? If i < 1, then min(i, 1024) is i ... */
if( increment < 1 ) if( increment < 1 )
increment = min( 1024, g_CurStageStats.m_player[p].iBonus ); increment = min( 1024, STATSMAN->m_CurStageStats.m_player[p].iBonus );
g_CurStageStats.m_player[p].iBonus -= increment; STATSMAN->m_CurStageStats.m_player[p].iBonus -= increment;
g_CurStageStats.m_player[p].iScore += increment; STATSMAN->m_CurStageStats.m_player[p].iScore += increment;
if( SHOW_SCORE_AREA ) if( SHOW_SCORE_AREA )
m_textScore[p].SetText( ssprintf("%*.0i", NUM_SCORE_DIGITS, g_CurStageStats.m_player[p].iScore) ); m_textScore[p].SetText( ssprintf("%*.0i", NUM_SCORE_DIGITS, STATSMAN->m_CurStageStats.m_player[p].iScore) );
} }
} }
+37 -37
View File
@@ -35,7 +35,7 @@
#include "UnlockSystem.h" #include "UnlockSystem.h"
#include "LightsManager.h" #include "LightsManager.h"
#include "ProfileManager.h" #include "ProfileManager.h"
#include "StageStats.h" #include "StatsManager.h"
#include "PlayerAI.h" // for NUM_SKILL_LEVELS #include "PlayerAI.h" // for NUM_SKILL_LEVELS
#include "NetworkSyncManager.h" #include "NetworkSyncManager.h"
#include "Foreach.h" #include "Foreach.h"
@@ -195,23 +195,23 @@ void ScreenGameplay::Init()
/* Called once per stage (single song or single course). */ /* Called once per stage (single song or single course). */
GAMESTATE->BeginStage(); GAMESTATE->BeginStage();
g_CurStageStats.playMode = GAMESTATE->m_PlayMode; STATSMAN->m_CurStageStats.playMode = GAMESTATE->m_PlayMode;
g_CurStageStats.pStyle = GAMESTATE->m_pCurStyle; STATSMAN->m_CurStageStats.pStyle = GAMESTATE->m_pCurStyle;
FOREACH_EnabledPlayer(p) FOREACH_EnabledPlayer(p)
{ {
ASSERT( !m_vpStepsQueue[p].empty() ); ASSERT( !m_vpStepsQueue[p].empty() );
/* Record combo rollover. */ /* Record combo rollover. */
g_CurStageStats.m_player[p].UpdateComboList( 0, true ); STATSMAN->m_CurStageStats.m_player[p].UpdateComboList( 0, true );
} }
if( GAMESTATE->IsExtraStage() ) if( GAMESTATE->IsExtraStage() )
g_CurStageStats.StageType = StageStats::STAGE_EXTRA; STATSMAN->m_CurStageStats.StageType = StageStats::STAGE_EXTRA;
else if( GAMESTATE->IsExtraStage2() ) else if( GAMESTATE->IsExtraStage2() )
g_CurStageStats.StageType = StageStats::STAGE_EXTRA2; STATSMAN->m_CurStageStats.StageType = StageStats::STAGE_EXTRA2;
else else
g_CurStageStats.StageType = StageStats::STAGE_NORMAL; STATSMAN->m_CurStageStats.StageType = StageStats::STAGE_NORMAL;
// //
// Init ScoreKeepers // Init ScoreKeepers
@@ -228,7 +228,7 @@ void ScreenGameplay::Init()
m_vpStepsQueue[p], m_vpStepsQueue[p],
m_asModifiersQueue[p], m_asModifiersQueue[p],
GAMESTATE->m_pPlayerState[p], GAMESTATE->m_pPlayerState[p],
&g_CurStageStats.m_player[p] ); &STATSMAN->m_CurStageStats.m_player[p] );
break; break;
default: ASSERT(0); default: ASSERT(0);
} }
@@ -238,7 +238,7 @@ void ScreenGameplay::Init()
case PLAY_MODE_RAVE: case PLAY_MODE_RAVE:
m_pSecondaryScoreKeeper[p] = new ScoreKeeperRave( m_pSecondaryScoreKeeper[p] = new ScoreKeeperRave(
GAMESTATE->m_pPlayerState[p], GAMESTATE->m_pPlayerState[p],
&g_CurStageStats.m_player[p] ); &STATSMAN->m_CurStageStats.m_player[p] );
break; break;
} }
} }
@@ -434,7 +434,7 @@ void ScreenGameplay::Init()
m_MaxCombo.LoadFromFont( THEME->GetPathF(m_sName,"max combo") ); m_MaxCombo.LoadFromFont( THEME->GetPathF(m_sName,"max combo") );
m_MaxCombo.SetName( "MaxCombo" ); m_MaxCombo.SetName( "MaxCombo" );
SET_XY( m_MaxCombo ); SET_XY( m_MaxCombo );
m_MaxCombo.SetText( ssprintf("%d", g_CurStageStats.m_player[GAMESTATE->m_MasterPlayerNumber].iMaxCombo) ); // TODO: Make this work for both players m_MaxCombo.SetText( ssprintf("%d", STATSMAN->m_CurStageStats.m_player[GAMESTATE->m_MasterPlayerNumber].iMaxCombo) ); // TODO: Make this work for both players
this->AddChild( &m_MaxCombo ); this->AddChild( &m_MaxCombo );
FOREACH_EnabledPlayer(p) FOREACH_EnabledPlayer(p)
@@ -832,7 +832,7 @@ void ScreenGameplay::SetupSong( PlayerNumber p, int iSongIndex )
NoteDataUtil::RemoveAllTapsOfType( nd, TapNote::autoKeysound ); NoteDataUtil::RemoveAllTapsOfType( nd, TapNote::autoKeysound );
m_Player[p].Init( m_Player[p].Init(
GAMESTATE->m_pPlayerState[p], GAMESTATE->m_pPlayerState[p],
&g_CurStageStats.m_player[p], &STATSMAN->m_CurStageStats.m_player[p],
m_pLifeMeter[p], m_pLifeMeter[p],
m_pCombinedLifeMeter, m_pCombinedLifeMeter,
m_pPrimaryScoreDisplay[p], m_pPrimaryScoreDisplay[p],
@@ -879,7 +879,7 @@ static int GetMaxSongsPlayed()
{ {
int SongNumber = 0; int SongNumber = 0;
FOREACH_EnabledPlayer(p) FOREACH_EnabledPlayer(p)
SongNumber = max( SongNumber, g_CurStageStats.m_player[p].iSongsPlayed ); SongNumber = max( SongNumber, STATSMAN->m_CurStageStats.m_player[p].iSongsPlayed );
return SongNumber; return SongNumber;
} }
@@ -901,8 +901,8 @@ void ScreenGameplay::LoadNextSong()
FOREACH_EnabledPlayer( p ) FOREACH_EnabledPlayer( p )
{ {
g_CurStageStats.m_player[p].iSongsPlayed++; STATSMAN->m_CurStageStats.m_player[p].iSongsPlayed++;
m_textCourseSongNumber[p].SetText( ssprintf("%d", g_CurStageStats.m_player[p].iSongsPlayed) ); m_textCourseSongNumber[p].SetText( ssprintf("%d", STATSMAN->m_CurStageStats.m_player[p].iSongsPlayed) );
} }
LoadCourseSongNumber( GetMaxSongsPlayed() ); LoadCourseSongNumber( GetMaxSongsPlayed() );
@@ -910,7 +910,7 @@ void ScreenGameplay::LoadNextSong()
int iPlaySongIndex = GAMESTATE->GetCourseSongIndex(); int iPlaySongIndex = GAMESTATE->GetCourseSongIndex();
iPlaySongIndex %= m_apSongsQueue.size(); iPlaySongIndex %= m_apSongsQueue.size();
GAMESTATE->m_pCurSong = m_apSongsQueue[iPlaySongIndex]; GAMESTATE->m_pCurSong = m_apSongsQueue[iPlaySongIndex];
g_CurStageStats.vpSongs.push_back( GAMESTATE->m_pCurSong ); STATSMAN->m_CurStageStats.vpSongs.push_back( GAMESTATE->m_pCurSong );
// No need to do this here. We do it in SongFinished(). // No need to do this here. We do it in SongFinished().
//GAMESTATE->RemoveAllActiveAttacks(); //GAMESTATE->RemoveAllActiveAttacks();
@@ -931,7 +931,7 @@ void ScreenGameplay::LoadNextSong()
Song* pSong = GAMESTATE->m_pCurSong; Song* pSong = GAMESTATE->m_pCurSong;
Steps* pSteps = GAMESTATE->m_pCurSteps[p]; Steps* pSteps = GAMESTATE->m_pCurSteps[p];
g_CurStageStats.m_player[p].vpSteps.push_back( pSteps ); STATSMAN->m_CurStageStats.m_player[p].vpSteps.push_back( pSteps );
ASSERT( GAMESTATE->m_pCurSteps[p] ); ASSERT( GAMESTATE->m_pCurSteps[p] );
m_textStepsDescription[p].SetText( GAMESTATE->m_pCurSteps[p]->GetDescription() ); m_textStepsDescription[p].SetText( GAMESTATE->m_pCurSteps[p]->GetDescription() );
@@ -948,7 +948,7 @@ void ScreenGameplay::LoadNextSong()
m_sprOniGameOver[p].SetY( SCREEN_TOP - m_sprOniGameOver[p].GetZoomedHeight()/2 ); 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 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 && g_CurStageStats.m_player[p].bFailed ) // already failed if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BATTERY && STATSMAN->m_CurStageStats.m_player[p].bFailed ) // already failed
ShowOniGameOver(p); ShowOniGameOver(p);
if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BAR && GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR && !PREFSMAN->m_bEventMode && !GAMESTATE->m_bDemonstrationOrJukebox) if( GAMESTATE->m_SongOptions.m_LifeType==SongOptions::LIFE_BAR && GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR && !PREFSMAN->m_bEventMode && !GAMESTATE->m_bDemonstrationOrJukebox)
@@ -1318,7 +1318,7 @@ void ScreenGameplay::Update( float fDeltaTime )
return; return;
if( GAMESTATE->m_MasterPlayerNumber != PLAYER_INVALID ) if( GAMESTATE->m_MasterPlayerNumber != PLAYER_INVALID )
m_MaxCombo.SetText( ssprintf("%d", g_CurStageStats.m_player[GAMESTATE->m_MasterPlayerNumber].iMaxCombo) ); /* MAKE THIS WORK FOR BOTH PLAYERS! */ m_MaxCombo.SetText( ssprintf("%d", STATSMAN->m_CurStageStats.m_player[GAMESTATE->m_MasterPlayerNumber].iMaxCombo) ); /* 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() ); //LOG->Trace( "m_fOffsetInBeats = %f, m_fBeatsPerSecond = %f, m_Music.GetPositionSeconds = %f", m_fOffsetInBeats, m_fBeatsPerSecond, m_Music.GetPositionSeconds() );
@@ -1359,7 +1359,7 @@ void ScreenGameplay::Update( float fDeltaTime )
switch( m_DancingState ) switch( m_DancingState )
{ {
case STATE_DANCING: case STATE_DANCING:
/* Set g_CurStageStats.bFailed for failed players. In, FAIL_IMMEDIATE, send /* Set STATSMAN->m_CurStageStats.bFailed for failed players. In, FAIL_IMMEDIATE, send
* SM_BeginFailed if all players failed, and kill dead Oni players. */ * SM_BeginFailed if all players failed, and kill dead Oni players. */
switch( GAMESTATE->m_SongOptions.m_FailType ) switch( GAMESTATE->m_SongOptions.m_FailType )
{ {
@@ -1373,7 +1373,7 @@ void ScreenGameplay::Update( float fDeltaTime )
if( (m_pLifeMeter[pn] && !m_pLifeMeter[pn]->IsFailing()) || if( (m_pLifeMeter[pn] && !m_pLifeMeter[pn]->IsFailing()) ||
(m_pCombinedLifeMeter && !m_pCombinedLifeMeter->IsFailing(pn)) ) (m_pCombinedLifeMeter && !m_pCombinedLifeMeter->IsFailing(pn)) )
continue; /* isn't failing */ continue; /* isn't failing */
if( g_CurStageStats.m_player[pn].bFailed ) if( STATSMAN->m_CurStageStats.m_player[pn].bFailed )
continue; /* failed and is already dead */ continue; /* failed and is already dead */
/* If recovery is enabled, only set fail if both are failing. /* If recovery is enabled, only set fail if both are failing.
@@ -1383,12 +1383,12 @@ void ScreenGameplay::Update( float fDeltaTime )
continue; continue;
LOG->Trace("Player %d failed", (int)pn); LOG->Trace("Player %d failed", (int)pn);
g_CurStageStats.m_player[pn].bFailed = true; // fail STATSMAN->m_CurStageStats.m_player[pn].bFailed = true; // fail
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY &&
GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_IMMEDIATE ) GAMESTATE->m_SongOptions.m_FailType == SongOptions::FAIL_IMMEDIATE )
{ {
if( !g_CurStageStats.AllFailedEarlier() ) // if not the last one to fail if( !STATSMAN->m_CurStageStats.AllFailedEarlier() ) // if not the last one to fail
{ {
// kill them! // kill them!
SOUND->PlayOnceFromDir( THEME->GetPathS(m_sName,"oni die") ); SOUND->PlayOnceFromDir( THEME->GetPathS(m_sName,"oni die") );
@@ -1425,11 +1425,11 @@ void ScreenGameplay::Update( float fDeltaTime )
// Update living players' alive time // Update living players' alive time
// //
FOREACH_EnabledPlayer(pn) FOREACH_EnabledPlayer(pn)
if(!g_CurStageStats.m_player[pn].bFailed) if(!STATSMAN->m_CurStageStats.m_player[pn].bFailed)
g_CurStageStats.m_player[pn].fAliveSeconds += fDeltaTime * GAMESTATE->m_SongOptions.m_fMusicRate; STATSMAN->m_CurStageStats.m_player[pn].fAliveSeconds += fDeltaTime * GAMESTATE->m_SongOptions.m_fMusicRate;
// update fGameplaySeconds // update fGameplaySeconds
g_CurStageStats.fGameplaySeconds += fDeltaTime; STATSMAN->m_CurStageStats.fGameplaySeconds += fDeltaTime;
// //
// Check for end of song // Check for end of song
@@ -1537,7 +1537,7 @@ void ScreenGameplay::Update( float fDeltaTime )
case SongOptions::FAIL_COMBO_OF_30_MISSES: case SongOptions::FAIL_COMBO_OF_30_MISSES:
case SongOptions::FAIL_END_OF_SONG: case SongOptions::FAIL_END_OF_SONG:
FOREACH_EnabledPlayer(pn) FOREACH_EnabledPlayer(pn)
g_CurStageStats.m_player[pn].bFailed = true; // fail STATSMAN->m_CurStageStats.m_player[pn].bFailed = true; // fail
} }
this->PostScreenMessage( SM_NotesEnded, 0 ); this->PostScreenMessage( SM_NotesEnded, 0 );
@@ -2048,10 +2048,10 @@ void ScreenGameplay::SongFinished()
RadarValues v; RadarValues v;
NoteDataUtil::GetRadarValues( m_Player[p].m_NoteData, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds, v ); NoteDataUtil::GetRadarValues( m_Player[p].m_NoteData, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds, v );
g_CurStageStats.m_player[p].radarPossible += v; STATSMAN->m_CurStageStats.m_player[p].radarPossible += v;
NoteDataWithScoring::GetActualRadarValues( m_Player[p].m_NoteData, p, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds, v ); NoteDataWithScoring::GetActualRadarValues( m_Player[p].m_NoteData, p, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds, v );
g_CurStageStats.m_player[p].radarActual += v; STATSMAN->m_CurStageStats.m_player[p].radarActual += v;
} }
/* Extremely important: if we don't remove attacks before moving on to the next /* Extremely important: if we don't remove attacks before moving on to the next
@@ -2082,7 +2082,7 @@ void ScreenGameplay::StageFinished( bool bBackedOut )
// save current stage stats // save current stage stats
if( !bBackedOut ) if( !bBackedOut )
g_vPlayedStageStats.push_back( g_CurStageStats ); STATSMAN->m_vPlayedStageStats.push_back( STATSMAN->m_CurStageStats );
/* Reset options. */ /* Reset options. */
GAMESTATE->RestoreSelectedOptions(); GAMESTATE->RestoreSelectedOptions();
@@ -2127,29 +2127,29 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
{ {
LOG->Trace("Player %i failed: life %f is under %f", LOG->Trace("Player %i failed: life %f is under %f",
p+1, m_pLifeMeter[p]->GetLife(), GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.m_fPassmark ); p+1, m_pLifeMeter[p]->GetLife(), GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.m_fPassmark );
g_CurStageStats.m_player[p].bFailed = true; STATSMAN->m_CurStageStats.m_player[p].bFailed = true;
} }
/* Mark failure. This hasn't been done yet if m_bTwoPlayerRecovery is set. */ /* Mark failure. This hasn't been done yet if m_bTwoPlayerRecovery is set. */
if( GAMESTATE->m_SongOptions.m_FailType != SongOptions::FAIL_OFF && if( GAMESTATE->m_SongOptions.m_FailType != SongOptions::FAIL_OFF &&
(m_pLifeMeter[p] && m_pLifeMeter[p]->IsFailing()) || (m_pLifeMeter[p] && m_pLifeMeter[p]->IsFailing()) ||
(m_pCombinedLifeMeter && m_pCombinedLifeMeter->IsFailing(p)) ) (m_pCombinedLifeMeter && m_pCombinedLifeMeter->IsFailing(p)) )
g_CurStageStats.m_player[p].bFailed = true; STATSMAN->m_CurStageStats.m_player[p].bFailed = true;
if( !g_CurStageStats.m_player[p].bFailed ) if( !STATSMAN->m_CurStageStats.m_player[p].bFailed )
g_CurStageStats.m_player[p].iSongsPassed++; STATSMAN->m_CurStageStats.m_player[p].iSongsPassed++;
} }
/* If all players have *really* failed (bFailed, not the life meter or /* If all players have *really* failed (bFailed, not the life meter or
* bFailedEarlier): */ * bFailedEarlier): */
const bool bAllReallyFailed = g_CurStageStats.AllFailed(); const bool bAllReallyFailed = STATSMAN->m_CurStageStats.AllFailed();
if( !bAllReallyFailed && !IsLastSong() ) if( !bAllReallyFailed && !IsLastSong() )
{ {
/* Next song. */ /* Next song. */
FOREACH_EnabledPlayer(p) FOREACH_EnabledPlayer(p)
{ {
if( !g_CurStageStats.m_player[p].bFailed ) if( !STATSMAN->m_CurStageStats.m_player[p].bFailed )
{ {
// give a little life back between stages // give a little life back between stages
if( m_pLifeMeter[p] ) if( m_pLifeMeter[p] )
@@ -2182,7 +2182,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
FOREACH_EnabledPlayer(p) FOREACH_EnabledPlayer(p)
{ {
/* XXX: In battle modes, switch( GAMESTATE->GetStageResult(p) ). */ /* XXX: In battle modes, switch( GAMESTATE->GetStageResult(p) ). */
if( g_CurStageStats.m_player[p].bFailed ) if( STATSMAN->m_CurStageStats.m_player[p].bFailed )
Dancers->Change2DAnimState( p, AS2D_FAIL ); // fail anim Dancers->Change2DAnimState( p, AS2D_FAIL ); // fail anim
else if( m_pLifeMeter[p] && m_pLifeMeter[p]->GetLife() == 1.0f ) // full life else if( m_pLifeMeter[p] && m_pLifeMeter[p]->GetLife() == 1.0f ) // full life
Dancers->Change2DAnimState( p, AS2D_WINFEVER ); // full life pass anim Dancers->Change2DAnimState( p, AS2D_WINFEVER ); // full life pass anim
@@ -2378,7 +2378,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
{ {
float fMaxSurviveSeconds = 0; float fMaxSurviveSeconds = 0;
FOREACH_EnabledPlayer(p) FOREACH_EnabledPlayer(p)
fMaxSurviveSeconds = max( fMaxSurviveSeconds, g_CurStageStats.m_player[p].fAliveSeconds ); fMaxSurviveSeconds = max( fMaxSurviveSeconds, STATSMAN->m_CurStageStats.m_player[p].fAliveSeconds );
ASSERT( fMaxSurviveSeconds > 0 ); ASSERT( fMaxSurviveSeconds > 0 );
m_textSurviveTime.SetText( "TIME: " + SecondsToMMSSMsMs(fMaxSurviveSeconds) ); m_textSurviveTime.SetText( "TIME: " + SecondsToMMSSMsMs(fMaxSurviveSeconds) );
SET_XY_AND_ON_COMMAND( m_textSurviveTime ); SET_XY_AND_ON_COMMAND( m_textSurviveTime );
+9 -9
View File
@@ -5,7 +5,7 @@
#include "GameState.h" #include "GameState.h"
#include "Foreach.h" #include "Foreach.h"
#include "Course.h" #include "Course.h"
#include "StageStats.h" #include "StatsManager.h"
#include "ScoreKeeperMAX2.h" #include "ScoreKeeperMAX2.h"
#include "ScoreKeeperRave.h" #include "ScoreKeeperRave.h"
#include "ScreenDimensions.h" #include "ScreenDimensions.h"
@@ -131,19 +131,19 @@ void ScreenGameplayMultiplayer::Init()
/* Called once per stage (single song or single course). */ /* Called once per stage (single song or single course). */
GAMESTATE->BeginStage(); GAMESTATE->BeginStage();
g_CurStageStats.playMode = GAMESTATE->m_PlayMode; STATSMAN->m_CurStageStats.playMode = GAMESTATE->m_PlayMode;
g_CurStageStats.pStyle = GAMESTATE->m_pCurStyle; STATSMAN->m_CurStageStats.pStyle = GAMESTATE->m_pCurStyle;
{ {
ASSERT( !m_vpStepsQueue.empty() ); ASSERT( !m_vpStepsQueue.empty() );
} }
if( GAMESTATE->IsExtraStage() ) if( GAMESTATE->IsExtraStage() )
g_CurStageStats.StageType = StageStats::STAGE_EXTRA; STATSMAN->m_CurStageStats.StageType = StageStats::STAGE_EXTRA;
else if( GAMESTATE->IsExtraStage2() ) else if( GAMESTATE->IsExtraStage2() )
g_CurStageStats.StageType = StageStats::STAGE_EXTRA2; STATSMAN->m_CurStageStats.StageType = StageStats::STAGE_EXTRA2;
else else
g_CurStageStats.StageType = StageStats::STAGE_NORMAL; STATSMAN->m_CurStageStats.StageType = StageStats::STAGE_NORMAL;
// //
// Init ScoreKeepers // Init ScoreKeepers
@@ -349,7 +349,7 @@ void ScreenGameplayMultiplayer::LoadNextSong()
int iPlaySongIndex = GAMESTATE->GetCourseSongIndex(); int iPlaySongIndex = GAMESTATE->GetCourseSongIndex();
iPlaySongIndex %= m_vpSongsQueue.size(); iPlaySongIndex %= m_vpSongsQueue.size();
GAMESTATE->m_pCurSong = m_vpSongsQueue[iPlaySongIndex]; GAMESTATE->m_pCurSong = m_vpSongsQueue[iPlaySongIndex];
g_CurStageStats.vpSongs.push_back( GAMESTATE->m_pCurSong ); STATSMAN->m_CurStageStats.vpSongs.push_back( GAMESTATE->m_pCurSong );
// No need to do this here. We do it in SongFinished(). // No need to do this here. We do it in SongFinished().
//GAMESTATE->RemoveAllActiveAttacks(); //GAMESTATE->RemoveAllActiveAttacks();
@@ -364,7 +364,7 @@ void ScreenGameplayMultiplayer::LoadNextSong()
Steps* pSteps = GAMESTATE->m_pCurSteps[GAMESTATE->m_MasterPlayerNumber]; Steps* pSteps = GAMESTATE->m_pCurSteps[GAMESTATE->m_MasterPlayerNumber];
g_CurStageStats.m_player[GAMESTATE->m_MasterPlayerNumber].vpSteps.push_back( pSteps ); STATSMAN->m_CurStageStats.m_player[GAMESTATE->m_MasterPlayerNumber].vpSteps.push_back( pSteps );
FOREACH_MultiPlayer( p ) FOREACH_MultiPlayer( p )
{ {
@@ -596,7 +596,7 @@ void ScreenGameplayMultiplayer::StageFinished( bool bBackedOut )
// save current stage stats // save current stage stats
if( !bBackedOut ) if( !bBackedOut )
g_vPlayedStageStats.push_back( g_CurStageStats ); STATSMAN->m_vPlayedStageStats.push_back( STATSMAN->m_CurStageStats );
/* Reset options. */ /* Reset options. */
GAMESTATE->RestoreSelectedOptions(); GAMESTATE->RestoreSelectedOptions();
+5 -5
View File
@@ -18,7 +18,7 @@
#include "song.h" #include "song.h"
#include "Steps.h" #include "Steps.h"
#include "ProfileManager.h" #include "ProfileManager.h"
#include "StageStats.h" #include "StatsManager.h"
#include "RageDisplay.h" #include "RageDisplay.h"
#include "Foreach.h" #include "Foreach.h"
#include "Style.h" #include "Style.h"
@@ -162,7 +162,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
PROFILEMAN->AddCategoryScore( st, RANKING_A, p, hs, a, b ); PROFILEMAN->AddCategoryScore( st, RANKING_A, p, hs, a, b );
} }
g_vPlayedStageStats.push_back( ss ); STATSMAN->m_vPlayedStageStats.push_back( ss );
} }
} }
@@ -305,11 +305,11 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
actor.FinishTweening(); \ actor.FinishTweening(); \
} }
m_FeatDisplay[p].reserve( g_vPlayedStageStats.size() ); m_FeatDisplay[p].reserve( STATSMAN->m_vPlayedStageStats.size() );
for( unsigned i = 0; i < g_vPlayedStageStats.size(); ++i ) for( unsigned i = 0; i < STATSMAN->m_vPlayedStageStats.size(); ++i )
{ {
StageStats &ss = g_vPlayedStageStats[i]; StageStats &ss = STATSMAN->m_vPlayedStageStats[i];
Song* pSong = ss.vpSongs[0]; Song* pSong = ss.vpSongs[0];
Steps* pSteps = ss.m_player[p].vpSteps[0]; Steps* pSteps = ss.m_player[p].vpSteps[0];
Course* pCourse = GAMESTATE->m_pCurCourse; Course* pCourse = GAMESTATE->m_pCurCourse;
+4 -4
View File
@@ -20,7 +20,7 @@
#include "ProfileManager.h" #include "ProfileManager.h"
#include "MenuTimer.h" #include "MenuTimer.h"
#include "LightsManager.h" #include "LightsManager.h"
#include "StageStats.h" #include "StatsManager.h"
#include "StepsUtil.h" #include "StepsUtil.h"
#include "Foreach.h" #include "Foreach.h"
#include "Style.h" #include "Style.h"
@@ -1099,9 +1099,9 @@ void ScreenSelectMusic::MenuStart( PlayerNumber pn )
bool bIsRepeat = false; bool bIsRepeat = false;
int i = 0; int i = 0;
if( PREFSMAN->m_bEventMode ) if( PREFSMAN->m_bEventMode )
i = max( 0, int(g_vPlayedStageStats.size())-5 ); i = max( 0, int(STATSMAN->m_vPlayedStageStats.size())-5 );
for( ; i < (int)g_vPlayedStageStats.size(); ++i ) for( ; i < (int)STATSMAN->m_vPlayedStageStats.size(); ++i )
if( g_vPlayedStageStats[i].vpSongs.back() == m_MusicWheel.GetSelectedSong() ) if( STATSMAN->m_vPlayedStageStats[i].vpSongs.back() == m_MusicWheel.GetSelectedSong() )
bIsRepeat = true; bIsRepeat = true;
/* Don't complain about repeats if the user didn't get to pick. */ /* Don't complain about repeats if the user didn't get to pick. */
+4 -4
View File
@@ -29,7 +29,7 @@
#include "UnlockSystem.h" #include "UnlockSystem.h"
#include "CatalogXml.h" #include "CatalogXml.h"
#include "Foreach.h" #include "Foreach.h"
#include "StageStats.h" #include "StatsManager.h"
#include "Style.h" #include "Style.h"
#include "ThemeMetric.h" #include "ThemeMetric.h"
@@ -749,7 +749,7 @@ void SongManager::RevertFromDisk( Song *pSong, bool bAllowNotesLoss )
LOG->MapLog( "RevertFromDisk", "Reverted \"%s\" from disk", pSong->GetTranslitMainTitle().c_str() ); LOG->MapLog( "RevertFromDisk", "Reverted \"%s\" from disk", pSong->GetTranslitMainTitle().c_str() );
// Ugly: When we re-load the song, the Steps* will change. // Ugly: When we re-load the song, the Steps* will change.
// Fix GAMESTATE->m_CurSteps, g_CurStageStats, g_vPlayedStageStats[] after reloading. // Fix GAMESTATE->m_CurSteps, STATSMAN->m_CurStageStats, STATSMAN->m_vPlayedStageStats[] after reloading.
/* XXX: This is very brittle. However, we must know about all globals uses of Steps*, /* XXX: This is very brittle. However, we must know about all globals uses of Steps*,
* so we can check to make sure we didn't lose any steps which are referenced ... */ * so we can check to make sure we didn't lose any steps which are referenced ... */
@@ -804,10 +804,10 @@ void SongManager::RevertFromDisk( Song *pSong, bool bAllowNotesLoss )
{ {
CONVERT_STEPS_POINTER( GAMESTATE->m_pCurSteps[p] ); CONVERT_STEPS_POINTER( GAMESTATE->m_pCurSteps[p] );
FOREACH( Steps*, g_CurStageStats.m_player[p].vpSteps, pSteps ) FOREACH( Steps*, STATSMAN->m_CurStageStats.m_player[p].vpSteps, pSteps )
CONVERT_STEPS_POINTER( *pSteps ); CONVERT_STEPS_POINTER( *pSteps );
FOREACH( StageStats, g_vPlayedStageStats, ss ) FOREACH( StageStats, STATSMAN->m_vPlayedStageStats, ss )
FOREACH( Steps*, ss->m_player[p].vpSteps, pSteps ) FOREACH( Steps*, ss->m_player[p].vpSteps, pSteps )
CONVERT_STEPS_POINTER( *pSteps ); CONVERT_STEPS_POINTER( *pSteps );
} }
-87
View File
@@ -5,9 +5,6 @@
#include "Steps.h" #include "Steps.h"
#include "song.h" #include "song.h"
StageStats g_CurStageStats;
vector<StageStats> g_vPlayedStageStats;
void StageStats::Init() void StageStats::Init()
{ {
playMode = PLAY_MODE_INVALID; playMode = PLAY_MODE_INVALID;
@@ -104,90 +101,6 @@ LUA_REGISTER_CLASS( StageStats )
// lua end // lua end
//
// Old Lua
//
static Grade GetBestGrade()
{
Grade g = NUM_GRADES;
FOREACH_EnabledPlayer( pn )
g = min( g, g_CurStageStats.m_player[pn].GetGrade() );
return g;
}
static Grade GetWorstGrade()
{
Grade g = GRADE_TIER_1;
FOREACH_EnabledPlayer( pn )
g = max( g, g_CurStageStats.m_player[pn].GetGrade() );
return g;
}
#include "LuaFunctions.h"
LuaFunction_NoArgs( GetStagesPlayed, (int) g_vPlayedStageStats.size() );
LuaFunction_NoArgs( GetBestGrade, GetBestGrade() );
LuaFunction_NoArgs( GetWorstGrade, GetWorstGrade() );
LuaFunction_NoArgs( OnePassed, g_CurStageStats.OnePassed() );
LuaFunction_NoArgs( AllFailed, g_CurStageStats.AllFailed() );
LuaFunction_PlayerNumber( FullCombo, g_CurStageStats.m_player[pn].FullCombo() )
LuaFunction_PlayerNumber( MaxCombo, g_CurStageStats.m_player[pn].GetMaxCombo().cnt )
LuaFunction_PlayerNumber( GetGrade, g_CurStageStats.m_player[pn].GetGrade() )
LuaFunction_Str( Grade, StringToGrade(str) );
const StageStats *GetStageStatsN( int n )
{
if( n == (int) g_vPlayedStageStats.size() )
return &g_CurStageStats;
if( n > (int) g_vPlayedStageStats.size() )
return NULL;
return &g_vPlayedStageStats[n];
}
/* GetGrade(0) returns the first grade; GetGrade(1) returns the second grade, and
* and so on. GetGrade(GetStagesPlayed()) returns the current grade (from g_CurStageStats).
* If beyond the current song played, return GRADE_NO_DATA. */
Grade GetGrade( int n, PlayerNumber pn )
{
const StageStats *pStats = GetStageStatsN( n );
if( pStats == NULL )
return GRADE_NO_DATA;
return pStats->m_player[pn].GetGrade();
}
bool OneGotGrade( int n, Grade g )
{
FOREACH_HumanPlayer( pn )
if( GetGrade( n, pn ) == g )
return true;
return false;
}
LuaFunction_IntInt( OneGotGrade, OneGotGrade( a1, (Grade) a2 ) );
Grade GetFinalGrade( PlayerNumber pn )
{
if( !GAMESTATE->IsHumanPlayer(pn) )
return GRADE_NO_DATA;
StageStats stats;
GAMESTATE->GetFinalEvalStats( stats );
return stats.m_player[pn].GetGrade();
}
LuaFunction_PlayerNumber( GetFinalGrade, GetFinalGrade(pn) );
Grade GetBestFinalGrade()
{
Grade top_grade = GRADE_FAILED;
StageStats stats;
GAMESTATE->GetFinalEvalStats( stats );
FOREACH_HumanPlayer( p )
top_grade = min( top_grade, stats.m_player[p].GetGrade() );
return top_grade;
}
LuaFunction_NoArgs( GetBestFinalGrade, GetBestFinalGrade() );
/* /*
* (c) 2001-2004 Chris Danford, Glenn Maynard * (c) 2001-2004 Chris Danford, Glenn Maynard
* All rights reserved. * All rights reserved.
-2
View File
@@ -45,8 +45,6 @@ struct StageStats
* Arcade: for the current stage (one song). * Arcade: for the current stage (one song).
* Nonstop/Oni/Endless: for current course (which usually contains multiple songs) * 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 #endif
+142
View File
@@ -0,0 +1,142 @@
#include "global.h"
#include "StatsManager.h"
#include "GameState.h"
StatsManager* STATSMAN = NULL; // global object accessable from anywhere in the program
StatsManager::StatsManager()
{
}
// lua start
#include "LuaBinding.h"
template<class T>
class LunaStatsManager : public Luna<T>
{
public:
LunaStatsManager() { LUA->Register( Register ); }
static int GetCurStageStats( T* p, lua_State *L ) { p->m_CurStageStats.PushSelf(L); return 1; }
static void Register(lua_State *L)
{
ADD_METHOD( GetCurStageStats )
Luna<T>::Register( L );
}
};
LUA_REGISTER_CLASS( StatsManager )
// lua end
//
// Old Lua
//
static Grade GetBestGrade()
{
Grade g = NUM_GRADES;
FOREACH_EnabledPlayer( pn )
g = min( g, STATSMAN->m_CurStageStats.m_player[pn].GetGrade() );
return g;
}
static Grade GetWorstGrade()
{
Grade g = GRADE_TIER_1;
FOREACH_EnabledPlayer( pn )
g = max( g, STATSMAN->m_CurStageStats.m_player[pn].GetGrade() );
return g;
}
#include "LuaFunctions.h"
LuaFunction_NoArgs( GetStagesPlayed, (int) STATSMAN->m_vPlayedStageStats.size() );
LuaFunction_NoArgs( GetBestGrade, GetBestGrade() );
LuaFunction_NoArgs( GetWorstGrade, GetWorstGrade() );
LuaFunction_NoArgs( OnePassed, STATSMAN->m_CurStageStats.OnePassed() );
LuaFunction_NoArgs( AllFailed, STATSMAN->m_CurStageStats.AllFailed() );
LuaFunction_PlayerNumber( FullCombo, STATSMAN->m_CurStageStats.m_player[pn].FullCombo() )
LuaFunction_PlayerNumber( MaxCombo, STATSMAN->m_CurStageStats.m_player[pn].GetMaxCombo().cnt )
LuaFunction_PlayerNumber( GetGrade, STATSMAN->m_CurStageStats.m_player[pn].GetGrade() )
LuaFunction_Str( Grade, StringToGrade(str) );
const StageStats *GetStageStatsN( int n )
{
if( n == (int) STATSMAN->m_vPlayedStageStats.size() )
return &STATSMAN->m_CurStageStats;
if( n > (int) STATSMAN->m_vPlayedStageStats.size() )
return NULL;
return &STATSMAN->m_vPlayedStageStats[n];
}
/* GetGrade(0) returns the first grade; GetGrade(1) returns the second grade, and
* and so on. GetGrade(GetStagesPlayed()) returns the current grade (from STATSMAN->m_CurStageStats).
* If beyond the current song played, return GRADE_NO_DATA. */
Grade GetGrade( int n, PlayerNumber pn )
{
const StageStats *pStats = GetStageStatsN( n );
if( pStats == NULL )
return GRADE_NO_DATA;
return pStats->m_player[pn].GetGrade();
}
bool OneGotGrade( int n, Grade g )
{
FOREACH_HumanPlayer( pn )
if( GetGrade( n, pn ) == g )
return true;
return false;
}
LuaFunction_IntInt( OneGotGrade, OneGotGrade( a1, (Grade) a2 ) );
Grade GetFinalGrade( PlayerNumber pn )
{
if( !GAMESTATE->IsHumanPlayer(pn) )
return GRADE_NO_DATA;
StageStats stats;
GAMESTATE->GetFinalEvalStats( stats );
return stats.m_player[pn].GetGrade();
}
LuaFunction_PlayerNumber( GetFinalGrade, GetFinalGrade(pn) );
Grade GetBestFinalGrade()
{
Grade top_grade = GRADE_FAILED;
StageStats stats;
GAMESTATE->GetFinalEvalStats( stats );
FOREACH_HumanPlayer( p )
top_grade = min( top_grade, stats.m_player[p].GetGrade() );
return top_grade;
}
LuaFunction_NoArgs( GetBestFinalGrade, GetBestFinalGrade() );
/*
* (c) 2001-2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+48
View File
@@ -0,0 +1,48 @@
/* ThemeManager - Managed non-persisted statistics. */
#ifndef StatsManager_H
#define StatsManager_H
#include "StageStats.h"
class StatsManager
{
public:
StatsManager();
StageStats m_CurStageStats; // current stage (not necessarily passed if Extra Stage)
vector<StageStats> m_vPlayedStageStats;
// Lua
void PushSelf( lua_State *L );
};
extern StatsManager* STATSMAN; // global and accessable from anywhere in our program
#endif
/*
* (c) 2001-2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+3
View File
@@ -63,6 +63,7 @@
#include "CryptManager.h" #include "CryptManager.h"
#include "NetworkSyncManager.h" #include "NetworkSyncManager.h"
#include "MessageManager.h" #include "MessageManager.h"
#include "StatsManager.h"
#if defined(XBOX) #if defined(XBOX)
#include "Archutils/Xbox/VirtualMemory.h" #include "Archutils/Xbox/VirtualMemory.h"
@@ -178,6 +179,7 @@ void ShutdownGame()
SOUNDMAN->Shutdown(); SOUNDMAN->Shutdown();
SAFE_DELETE( SCREENMAN ); SAFE_DELETE( SCREENMAN );
SAFE_DELETE( STATSMAN );
SAFE_DELETE( MESSAGEMAN ); SAFE_DELETE( MESSAGEMAN );
SAFE_DELETE( NSMAN ); SAFE_DELETE( NSMAN );
/* Delete INPUTMAN before the other INPUTFILTER handlers, or an input /* Delete INPUTMAN before the other INPUTFILTER handlers, or an input
@@ -1088,6 +1090,7 @@ int main(int argc, char* argv[])
UNLOCKMAN = new UnlockSystem; UNLOCKMAN = new UnlockSystem;
NSMAN = new NetworkSyncManager( loading_window ); NSMAN = new NetworkSyncManager( loading_window );
MESSAGEMAN = new MessageManager; MESSAGEMAN = new MessageManager;
STATSMAN = new StatsManager;
// UGLY: Reload the current theme now that all global singletons are // UGLY: Reload the current theme now that all global singletons are
// constructed so that they can be registered with Lua. // constructed so that they can be registered with Lua.
+8
View File
@@ -3116,6 +3116,14 @@ SOURCE=.\SongManager.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\StatsManager.cpp
# End Source File
# Begin Source File
SOURCE=.\StatsManager.h
# End Source File
# Begin Source File
SOURCE=.\ThemeManager.cpp SOURCE=.\ThemeManager.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
+6
View File
@@ -2433,6 +2433,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File <File
RelativePath=".\SongManager.h"> RelativePath=".\SongManager.h">
</File> </File>
<File
RelativePath="StatsManager.cpp">
</File>
<File
RelativePath="StatsManager.h">
</File>
<File <File
RelativePath=".\ThemeManager.cpp"> RelativePath=".\ThemeManager.cpp">
</File> </File>