persist combo between games

This commit is contained in:
Chris Danford
2003-12-08 04:39:29 +00:00
parent eac836cc40
commit f8c856209d
4 changed files with 25 additions and 2 deletions
+1
View File
@@ -25,6 +25,7 @@
Bookkeeper* BOOKKEEPER = NULL; // global and accessable from anywhere in our program
static const CString COINS_DAT = BASE_PATH "Data" SLASH "Coins.dat";
static const CString COINS_HTML = BASE_PATH "Data" SLASH "Coins.html";
const int COINS_DAT_VERSION = 1;
+20 -2
View File
@@ -181,6 +181,10 @@ void GameState::EndGame()
pProfile->m_iTotalPlaySeconds += iPlaySeconds;
pProfile->m_iTotalGameplaySeconds += iGameplaySeconds;
pProfile->m_iTotalPlays++;
pProfile->m_iCurrentCombo =
PREFSMAN->m_bComboContinuesBetweenSongs ?
GAMESTATE->m_CurStageStats.iCurCombo[p] :
0;
}
BOOKKEEPER->WriteToDisk();
@@ -293,8 +297,22 @@ void GameState::ResetStageStatistics()
{
StageStats OldStats = GAMESTATE->m_CurStageStats;
m_CurStageStats = StageStats();
if( GetStageIndex() > 0 && PREFSMAN->m_bComboContinuesBetweenSongs )
memcpy( GAMESTATE->m_CurStageStats.iCurCombo, OldStats .iCurCombo, sizeof(OldStats.iCurCombo) );
if( PREFSMAN->m_bComboContinuesBetweenSongs )
{
if( GetStageIndex() == 0 )
{
for( int p=0; p<NUM_PLAYERS; p++ )
{
Profile* pProfile = PROFILEMAN->GetProfile((PlayerNumber)p);
if( pProfile )
GAMESTATE->m_CurStageStats.iCurCombo[p] = pProfile->m_iCurrentCombo;
}
}
else // GetStageIndex() > 0
{
memcpy( GAMESTATE->m_CurStageStats.iCurCombo, OldStats.iCurCombo, sizeof(OldStats.iCurCombo) );
}
}
RemoveAllActiveAttacks();
RemoveAllInventory();
+2
View File
@@ -252,6 +252,7 @@ bool Profile::LoadFromIni( CString sIniPath )
ini.GetValue( "Profile", "TotalPlays", m_iTotalPlays );
ini.GetValue( "Profile", "TotalPlaySeconds", m_iTotalPlaySeconds );
ini.GetValue( "Profile", "TotalGameplaySeconds", m_iTotalGameplaySeconds );
ini.GetValue( "Profile", "CurrentCombo", m_iCurrentCombo );
return true;
}
@@ -265,6 +266,7 @@ bool Profile::SaveToIni( CString sIniPath )
ini.SetValue( "Profile", "TotalPlays", m_iTotalPlays );
ini.SetValue( "Profile", "TotalPlaySeconds", m_iTotalPlaySeconds );
ini.SetValue( "Profile", "TotalGameplaySeconds", m_iTotalGameplaySeconds );
ini.SetValue( "Profile", "CurrentCombo", m_iCurrentCombo );
ini.WriteFile();
return true;
}
+2
View File
@@ -28,6 +28,7 @@ struct Profile
m_iTotalPlays = 0;
m_iTotalPlaySeconds = 0;
m_iTotalGameplaySeconds = 0;
m_iCurrentCombo = 0;
}
bool LoadFromIni( CString sIniPath );
@@ -39,6 +40,7 @@ struct Profile
int m_iTotalPlays;
int m_iTotalPlaySeconds;
int m_iTotalGameplaySeconds;
int m_iCurrentCombo;
};
class ProfileManager