persist combo between games
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
Bookkeeper* BOOKKEEPER = NULL; // global and accessable from anywhere in our program
|
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_DAT = BASE_PATH "Data" SLASH "Coins.dat";
|
||||||
|
static const CString COINS_HTML = BASE_PATH "Data" SLASH "Coins.html";
|
||||||
|
|
||||||
const int COINS_DAT_VERSION = 1;
|
const int COINS_DAT_VERSION = 1;
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,10 @@ void GameState::EndGame()
|
|||||||
pProfile->m_iTotalPlaySeconds += iPlaySeconds;
|
pProfile->m_iTotalPlaySeconds += iPlaySeconds;
|
||||||
pProfile->m_iTotalGameplaySeconds += iGameplaySeconds;
|
pProfile->m_iTotalGameplaySeconds += iGameplaySeconds;
|
||||||
pProfile->m_iTotalPlays++;
|
pProfile->m_iTotalPlays++;
|
||||||
|
pProfile->m_iCurrentCombo =
|
||||||
|
PREFSMAN->m_bComboContinuesBetweenSongs ?
|
||||||
|
GAMESTATE->m_CurStageStats.iCurCombo[p] :
|
||||||
|
0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOKKEEPER->WriteToDisk();
|
BOOKKEEPER->WriteToDisk();
|
||||||
@@ -293,8 +297,22 @@ void GameState::ResetStageStatistics()
|
|||||||
{
|
{
|
||||||
StageStats OldStats = GAMESTATE->m_CurStageStats;
|
StageStats OldStats = GAMESTATE->m_CurStageStats;
|
||||||
m_CurStageStats = StageStats();
|
m_CurStageStats = StageStats();
|
||||||
if( GetStageIndex() > 0 && PREFSMAN->m_bComboContinuesBetweenSongs )
|
if( PREFSMAN->m_bComboContinuesBetweenSongs )
|
||||||
memcpy( GAMESTATE->m_CurStageStats.iCurCombo, OldStats .iCurCombo, sizeof(OldStats.iCurCombo) );
|
{
|
||||||
|
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();
|
RemoveAllActiveAttacks();
|
||||||
RemoveAllInventory();
|
RemoveAllInventory();
|
||||||
|
|||||||
@@ -252,6 +252,7 @@ bool Profile::LoadFromIni( CString sIniPath )
|
|||||||
ini.GetValue( "Profile", "TotalPlays", m_iTotalPlays );
|
ini.GetValue( "Profile", "TotalPlays", m_iTotalPlays );
|
||||||
ini.GetValue( "Profile", "TotalPlaySeconds", m_iTotalPlaySeconds );
|
ini.GetValue( "Profile", "TotalPlaySeconds", m_iTotalPlaySeconds );
|
||||||
ini.GetValue( "Profile", "TotalGameplaySeconds", m_iTotalGameplaySeconds );
|
ini.GetValue( "Profile", "TotalGameplaySeconds", m_iTotalGameplaySeconds );
|
||||||
|
ini.GetValue( "Profile", "CurrentCombo", m_iCurrentCombo );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,6 +266,7 @@ bool Profile::SaveToIni( CString sIniPath )
|
|||||||
ini.SetValue( "Profile", "TotalPlays", m_iTotalPlays );
|
ini.SetValue( "Profile", "TotalPlays", m_iTotalPlays );
|
||||||
ini.SetValue( "Profile", "TotalPlaySeconds", m_iTotalPlaySeconds );
|
ini.SetValue( "Profile", "TotalPlaySeconds", m_iTotalPlaySeconds );
|
||||||
ini.SetValue( "Profile", "TotalGameplaySeconds", m_iTotalGameplaySeconds );
|
ini.SetValue( "Profile", "TotalGameplaySeconds", m_iTotalGameplaySeconds );
|
||||||
|
ini.SetValue( "Profile", "CurrentCombo", m_iCurrentCombo );
|
||||||
ini.WriteFile();
|
ini.WriteFile();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ struct Profile
|
|||||||
m_iTotalPlays = 0;
|
m_iTotalPlays = 0;
|
||||||
m_iTotalPlaySeconds = 0;
|
m_iTotalPlaySeconds = 0;
|
||||||
m_iTotalGameplaySeconds = 0;
|
m_iTotalGameplaySeconds = 0;
|
||||||
|
m_iCurrentCombo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LoadFromIni( CString sIniPath );
|
bool LoadFromIni( CString sIniPath );
|
||||||
@@ -39,6 +40,7 @@ struct Profile
|
|||||||
int m_iTotalPlays;
|
int m_iTotalPlays;
|
||||||
int m_iTotalPlaySeconds;
|
int m_iTotalPlaySeconds;
|
||||||
int m_iTotalGameplaySeconds;
|
int m_iTotalGameplaySeconds;
|
||||||
|
int m_iCurrentCombo;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ProfileManager
|
class ProfileManager
|
||||||
|
|||||||
Reference in New Issue
Block a user