tweak credits text
fix memory card profile creation
This commit is contained in:
@@ -270,6 +270,9 @@ void ModeChoice::ApplyToAllPlayers() const
|
||||
|
||||
void ModeChoice::Apply( PlayerNumber pn ) const
|
||||
{
|
||||
if( !GAMESTATE->IsHumanPlayer(pn) )
|
||||
return;
|
||||
|
||||
const PlayMode OldPlayMode = GAMESTATE->m_PlayMode;
|
||||
if( m_game != GAME_INVALID )
|
||||
GAMESTATE->m_CurGame = m_game;
|
||||
|
||||
@@ -26,6 +26,7 @@ ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our
|
||||
|
||||
#define STEPS_MEM_CARD_DATA_FILE "StepsMemCardData.dat"
|
||||
#define COURSE_MEM_CARD_DATA_FILE "CourseMemCardData.dat"
|
||||
#define NEW_MEM_CARD_NAME "NewCard"
|
||||
#define NEW_PROFILE_NAME "NewProfile"
|
||||
|
||||
ProfileManager::ProfileManager()
|
||||
@@ -114,13 +115,21 @@ bool ProfileManager::LoadDefaultProfileFromMachine( PlayerNumber pn )
|
||||
return LoadProfile( pn, sDir, false );
|
||||
}
|
||||
|
||||
bool ProfileManager::IsMemoryCardInserted( PlayerNumber pn )
|
||||
CString GetMemCardDir( PlayerNumber pn )
|
||||
{
|
||||
CString sDir = PREFSMAN->m_sMemoryCardDir[pn];
|
||||
if( sDir.empty() )
|
||||
return false;
|
||||
return sDir;
|
||||
if( sDir.Right(1) != SLASH )
|
||||
sDir += SLASH;
|
||||
return sDir;
|
||||
}
|
||||
|
||||
bool ProfileManager::IsMemoryCardInserted( PlayerNumber pn )
|
||||
{
|
||||
CString sDir = GetMemCardDir( pn );
|
||||
if( sDir.empty() )
|
||||
return false;
|
||||
|
||||
//
|
||||
// Test whether a memory card is available by trying to write a file.
|
||||
@@ -141,35 +150,33 @@ bool ProfileManager::IsMemoryCardInserted( PlayerNumber pn )
|
||||
|
||||
bool ProfileManager::LoadProfileFromMemoryCard( PlayerNumber pn )
|
||||
{
|
||||
CString sDir = PREFSMAN->m_sMemoryCardDir[pn];
|
||||
CString sDir = GetMemCardDir( pn );
|
||||
if( sDir.empty() )
|
||||
return false;
|
||||
if( sDir.Right(1) != SLASH )
|
||||
sDir += SLASH;
|
||||
|
||||
m_bUsingMemoryCard[pn] = true;
|
||||
bool bResult;
|
||||
bResult = LoadProfile( pn, sDir, false );
|
||||
if( bResult )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// silently create memory card data here
|
||||
bResult = CreateProfile( sDir, NEW_PROFILE_NAME );
|
||||
return bResult;
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
|
||||
bool ProfileManager::LoadFirstAvailableProfile( PlayerNumber pn )
|
||||
{
|
||||
if( IsMemoryCardInserted(pn) && LoadProfileFromMemoryCard(pn) )
|
||||
if( LoadProfileFromMemoryCard(pn) )
|
||||
return true;
|
||||
else if( LoadDefaultProfileFromMachine(pn) )
|
||||
|
||||
CString sDir = GetMemCardDir( pn );
|
||||
if( !sDir.empty() )
|
||||
{
|
||||
CreateProfile( sDir, NEW_MEM_CARD_NAME );
|
||||
if( LoadProfileFromMemoryCard(pn) )
|
||||
return true;
|
||||
}
|
||||
|
||||
if( LoadDefaultProfileFromMachine(pn) )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ProfileManager::SaveProfile( PlayerNumber pn )
|
||||
@@ -240,7 +247,7 @@ bool Profile::SaveToIni( CString sIniPath )
|
||||
bool ProfileManager::CreateMachineProfile( CString sName )
|
||||
{
|
||||
if( sName.empty() )
|
||||
sName = NEW_PROFILE_NAME;
|
||||
sName = "Machine";
|
||||
|
||||
//
|
||||
// Find a free directory name in the profiles directory
|
||||
|
||||
+15
-14
@@ -318,20 +318,16 @@ bool CreateDirectories( CString Path )
|
||||
if( mkdir(curpath, 0755) == 0 )
|
||||
continue;
|
||||
|
||||
if(errno != EEXIST)
|
||||
{
|
||||
if( LOG )
|
||||
LOG->Warn("Couldn't create %s: %s", curpath.c_str(), strerror(errno) );
|
||||
if(errno == EEXIST)
|
||||
continue; // we expect to see this error
|
||||
|
||||
/* When creating a directory that already exists over Samba, Windows is
|
||||
* returning ENOENT instead of EEXIST. Continue if we get that error, but
|
||||
* log it just in case it was a real ENOENT. (Otherwise, we'll fail to
|
||||
* create a directory when we could have succeeded.) */
|
||||
if( errno != ENOENT )
|
||||
return false;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
// Log the error, but continue on.
|
||||
/* When creating a directory that already exists over Samba, Windows is
|
||||
* returning ENOENT instead of EEXIST. */
|
||||
/* On Win32 when Path is only a drive letter (e.g. "i:\"), the result is
|
||||
* EINVAL. */
|
||||
if( LOG )
|
||||
LOG->Warn("Couldn't create %s: %s", curpath.c_str(), strerror(errno) );
|
||||
|
||||
/* Make sure it's a directory. */
|
||||
FlushDirCache();
|
||||
@@ -339,7 +335,12 @@ bool CreateDirectories( CString Path )
|
||||
{
|
||||
if( LOG )
|
||||
LOG->Warn("Couldn't create %s: path exists and is not a directory", curpath.c_str() );
|
||||
return false;
|
||||
|
||||
// HACK: IsADirectory doesn't work if Path contains a drive letter.
|
||||
// So, ignore IsADirectory's result and continue trying to create
|
||||
// directories anyway. This shouldn't change behavior, but
|
||||
// is inefficient because we don't bail early on an error.
|
||||
//return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,12 +39,14 @@ ScreenManager* SCREENMAN = NULL; // global and accessable from anywhere in our p
|
||||
#define CREDITS_COLOR THEME->GetMetricC("ScreenSystemLayer","CreditsColor")
|
||||
#define CREDITS_SHADOW_LENGTH THEME->GetMetricF("ScreenSystemLayer","CreditsShadowLength")
|
||||
#define CREDITS_ZOOM THEME->GetMetricF("ScreenSystemLayer","CreditsZoom")
|
||||
#define CREDITS_TEXT_PRESS_START THEME->GetMetric ("ScreenSystemLayer","CreditsTextPressStart")
|
||||
#define CREDITS_TEXT_JOINED THEME->GetMetric ("ScreenSystemLayer","CreditsTextJoined")
|
||||
#define CREDITS_TEXT_TOO_LATE THEME->GetMetric ("ScreenSystemLayer","CreditsTextTooLate")
|
||||
#define CREDITS_TEXT_INSERT_MORE THEME->GetMetric ("ScreenSystemLayer","CreditsTextInsertMore")
|
||||
#define PLAYER_INFO_PRESS_START THEME->GetMetric ("ScreenSystemLayer","PlayerInfoPressStart")
|
||||
#define PLAYER_INFO_INSERT_CARD THEME->GetMetric ("ScreenSystemLayer","PlayerInfoInsertCard")
|
||||
#define PLAYER_INFO_NO_CARD THEME->GetMetric ("ScreenSystemLayer","PlayerInfoNoCard")
|
||||
#define PLAYER_INFO_NOT_PRESENT THEME->GetMetric ("ScreenSystemLayer","PlayerInfoNotPresent")
|
||||
#define PLAYER_INFO_INSERT_MORE THEME->GetMetric ("ScreenSystemLayer","PlayerInfoInsertMore")
|
||||
#define CREDITS_TEXT_HOME THEME->GetMetric ("ScreenSystemLayer","CreditsTextHome")
|
||||
#define CREDITS_TEXT_FREE_PLAY THEME->GetMetric ("ScreenSystemLayer","CreditsTextFreePlay")
|
||||
#define CREDITS_TEXT_CREDITS THEME->GetMetric ("ScreenSystemLayer","CreditsTextCredits")
|
||||
#define CREDITS_TEXT_FREE THEME->GetMetric ("ScreenSystemLayer","CreditsTextFree")
|
||||
|
||||
const int NUM_SKIPS = 5;
|
||||
|
||||
@@ -173,7 +175,7 @@ void ScreenSystemLayer::RefreshCreditsMessages()
|
||||
}
|
||||
break;
|
||||
case COIN_FREE:
|
||||
sCredits = CREDITS_TEXT_FREE;
|
||||
sCredits = CREDITS_TEXT_FREE_PLAY;
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
@@ -194,23 +196,27 @@ void ScreenSystemLayer::RefreshCreditsMessages()
|
||||
CString sPlayerInfo;
|
||||
if( GAMESTATE->m_bSideIsJoined[p] )
|
||||
{
|
||||
sPlayerInfo = CREDITS_TEXT_JOINED;
|
||||
Profile* pProfile = PROFILEMAN->GetProfile( (PlayerNumber)p );
|
||||
if( pProfile )
|
||||
sPlayerInfo = pProfile->m_sName;
|
||||
else if( GAMESTATE->m_bPlayersCanJoin )
|
||||
sPlayerInfo = PLAYER_INFO_INSERT_CARD;
|
||||
else if( GAMESTATE->m_bIsOnSystemMenu )
|
||||
sPlayerInfo = "";
|
||||
else
|
||||
sPlayerInfo = PLAYER_INFO_NO_CARD;
|
||||
}
|
||||
else if( GAMESTATE->m_bPlayersCanJoin )
|
||||
{
|
||||
if( PREFSMAN->m_iCoinMode==COIN_PAY && GAMESTATE->m_iCoins<PREFSMAN->m_iCoinsPerCredit )
|
||||
sPlayerInfo = CREDITS_TEXT_INSERT_MORE;
|
||||
sPlayerInfo = PLAYER_INFO_INSERT_MORE;
|
||||
else
|
||||
sPlayerInfo = CREDITS_TEXT_PRESS_START;
|
||||
sPlayerInfo = PLAYER_INFO_PRESS_START;
|
||||
}
|
||||
else
|
||||
{
|
||||
sPlayerInfo = CREDITS_TEXT_TOO_LATE;
|
||||
sPlayerInfo = PLAYER_INFO_NOT_PRESENT;
|
||||
}
|
||||
|
||||
Profile* pProfile = PROFILEMAN->GetProfile( (PlayerNumber)p );
|
||||
if( pProfile )
|
||||
sPlayerInfo += " " + pProfile->m_sName;
|
||||
|
||||
m_textPlayerInfo[p].SetText( sPlayerInfo );
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ struct VideoCardDefaults
|
||||
640,480,
|
||||
16,16,16,
|
||||
2048,
|
||||
0 // accelerated?
|
||||
1 // accelerated
|
||||
},
|
||||
{
|
||||
"GeForce|Radeon",
|
||||
|
||||
Reference in New Issue
Block a user