clean up memory card logic

This commit is contained in:
Chris Danford
2004-01-03 03:42:40 +00:00
parent 0cc7d74e3e
commit 97146abaaf
13 changed files with 228 additions and 343 deletions
@@ -0,0 +1 @@
Common normal
+13 -12
View File
@@ -2631,15 +2631,19 @@ TimerSeconds=0
[ScreenSystemLayer] [ScreenSystemLayer]
StatsX=632 StatsX=632
StatsY=10 StatsY=10
PlayerInfoP1X=120 StatsOnCommand=horizalign,right;vertalign,top;zoom,0.5;shadowlength,2
PlayerInfoP1Y=474 MessageX=4
PlayerInfoP1OnCommand=shadowlength,0 MessageY=4
PlayerInfoP2X=520 MessageOnCommand=horizalign,left;vertalign,top;zoom,0.8;shadowlength,2
PlayerInfoP2Y=474 TimeX=4
PlayerInfoP2OnCommand=shadowlength,0 TimeY=40
CreditsX=320 TimeOnCommand=horizalign,left;vertalign,top;zoom,0.5;shadowlength,0;diffuse,1,0,1,1
CreditsY=474 CreditsP1X=120
CreditsOnCommand=shadowlength,0 CreditsP1Y=474
CreditsP1OnCommand=shadowlength,0
CreditsP2X=520
CreditsP2Y=474
CreditsP2OnCommand=shadowlength,0
CreditsJoinOnly=0 CreditsJoinOnly=0
[MusicWheelItem] [MusicWheelItem]
@@ -3611,9 +3615,6 @@ TimerSeconds=24
MaxRankingNameLength=4 MaxRankingNameLength=4
StyleIcon=1 StyleIcon=1
MemoryCardIcons=1 MemoryCardIcons=1
NextScreen=ScreenRemoveMemoryCard
[ScreenRemoveMemoryCard]
NextScreen=ScreenBranchEnding@ScreenBranch NextScreen=ScreenBranchEnding@ScreenBranch
[ScreenBranchEnding] [ScreenBranchEnding]
+1 -1
View File
@@ -42,7 +42,7 @@ ScreenMusicScroll.cpp ScreenMusicScroll.h ScreenNameEntry.cpp ScreenNameEntry.h
ScreenOptionsMaster.cpp ScreenOptionsMaster.h ScreenOptionsMasterPrefs.cpp ScreenOptionsMasterPrefs.h \ ScreenOptionsMaster.cpp ScreenOptionsMaster.h ScreenOptionsMasterPrefs.cpp ScreenOptionsMasterPrefs.h \
ScreenPlayerOptions.cpp ScreenPlayerOptions.h ScreenPrompt.cpp ScreenPrompt.h \ ScreenPlayerOptions.cpp ScreenPlayerOptions.h ScreenPrompt.cpp ScreenPrompt.h \
ScreenProfileOptions.cpp ScreenProfileOptions.h ScreenRanking.cpp ScreenRanking.h ScreenRaveOptions.cpp ScreenRaveOptions.h \ ScreenProfileOptions.cpp ScreenProfileOptions.h ScreenRanking.cpp ScreenRanking.h ScreenRaveOptions.cpp ScreenRaveOptions.h \
ScreenReloadSongs.cpp ScreenReloadSongs.h ScreenRemoveMemoryCard.cpp ScreenRemoveMemoryCard.h ScreenSandbox.cpp ScreenSandbox.h ScreenSelect.cpp ScreenSelect.h \ ScreenReloadSongs.cpp ScreenReloadSongs.h ScreenSandbox.cpp ScreenSandbox.h ScreenSelect.cpp ScreenSelect.h \
ScreenSelectCharacter.cpp ScreenSelectCharacter.h ScreenSelectCourse.cpp ScreenSelectCourse.h \ ScreenSelectCharacter.cpp ScreenSelectCharacter.h ScreenSelectCourse.cpp ScreenSelectCourse.h \
ScreenSelectDifficulty.cpp ScreenSelectDifficulty.h ScreenSelectDifficultyEX.cpp ScreenSelectDifficultyEX.h \ ScreenSelectDifficulty.cpp ScreenSelectDifficulty.h ScreenSelectDifficultyEX.cpp ScreenSelectDifficultyEX.h \
ScreenSelectGroup.cpp ScreenSelectGroup.h ScreenSelectMaster.cpp ScreenSelectMaster.h \ ScreenSelectGroup.cpp ScreenSelectGroup.h ScreenSelectMaster.cpp ScreenSelectMaster.h \
+35 -18
View File
@@ -18,6 +18,8 @@
#include "ThemeManager.h" #include "ThemeManager.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "RageLog.h" #include "RageLog.h"
#include "ScreenManager.h"
#include "ProfileManager.h"
MemoryCardManager* MEMCARDMAN = NULL; // global and accessable from anywhere in our program MemoryCardManager* MEMCARDMAN = NULL; // global and accessable from anywhere in our program
@@ -56,44 +58,59 @@ void MemoryCardManager::Update( float fDelta )
vector<UsbStorageDevice> vConnects; // fill these in below vector<UsbStorageDevice> vConnects; // fill these in below
vector<UsbStorageDevice> vDisconnects; // fill these in below vector<UsbStorageDevice> vDisconnects; // fill these in below
unsigned i;
// check for disconnects // check for disconnects
for( i=0; i<vOld.size(); i++ )
{ {
const UsbStorageDevice old = vOld[i]; for( int i=0; i<vOld.size(); i++ )
if( find(vNew.begin(),vNew.end(),old) == vNew.end() ) // didn't find
{ {
LOG->Trace( ssprintf("Disconnected bus %d port %d device %d path %s", old.iBus, old.iPortOnHub, old.iDeviceOnBus, old.sOsMountDir.c_str()) ); const UsbStorageDevice old = vOld[i];
vDisconnects.push_back( old ); if( find(vNew.begin(),vNew.end(),old) == vNew.end() ) // didn't find
{
LOG->Trace( ssprintf("Disconnected bus %d port %d device %d path %s", old.iBus, old.iPortOnHub, old.iDeviceOnBus, old.sOsMountDir.c_str()) );
vDisconnects.push_back( old );
}
} }
} }
// check for connects // check for connects
for( i=0; i<vNew.size(); i++ )
{ {
const UsbStorageDevice newd = vNew[i]; for( int i=0; i<vNew.size(); i++ )
if( find(vOld.begin(),vOld.end(),newd) == vOld.end() ) // didn't find
{ {
LOG->Trace( ssprintf("Connected bus %d port %d device %d path %s", newd.iBus, newd.iPortOnHub, newd.iDeviceOnBus, newd.sOsMountDir.c_str()) ); const UsbStorageDevice newd = vNew[i];
vConnects.push_back( newd ); if( find(vOld.begin(),vOld.end(),newd) == vOld.end() ) // didn't find
{
LOG->Trace( ssprintf("Connected bus %d port %d device %d path %s", newd.iBus, newd.iPortOnHub, newd.iDeviceOnBus, newd.sOsMountDir.c_str()) );
vConnects.push_back( newd );
}
} }
} }
// unassign cards that were disconnected // unassign cards that were disconnected
for( int p=0; p<NUM_PLAYERS; p++ )
{ {
if( m_Device[p].IsBlank() ) // not assigned a card for( int p=0; p<NUM_PLAYERS; p++ )
continue;
if( find(vDisconnects.begin(),vDisconnects.end(),m_Device[p]) != vDisconnects.end() ) // assigned card was disconnected
{ {
m_Device[p].MakeBlank(); if( m_Device[p].IsBlank() ) // not assigned a card
m_soundDisconnect.Play(); continue;
if( find(vDisconnects.begin(),vDisconnects.end(),m_Device[p]) != vDisconnects.end() ) // assigned card was disconnected
{
m_Device[p].MakeBlank();
m_soundDisconnect.Play();
if( PROFILEMAN->ProfileWasLoadedFromMemoryCard((PlayerNumber)p) )
PROFILEMAN->UnloadProfile( (PlayerNumber)p );
}
} }
} }
AssignUnassignedCards(); AssignUnassignedCards();
if( !m_bCardsLocked )
{
for( int p=0; p<NUM_PLAYERS; p++ )
PROFILEMAN->LoadProfileFromMemoryCard( (PlayerNumber)p );
}
SCREENMAN->RefreshCreditsMessages();
} }
} }
-1
View File
@@ -289,7 +289,6 @@ void ModeChoice::Apply( PlayerNumber pn ) const
if( m_style != STYLE_INVALID ) if( m_style != STYLE_INVALID )
{ {
MEMCARDMAN->LockCards( true ); MEMCARDMAN->LockCards( true );
PROFILEMAN->LoadFirstAvailableProfile( pn );
} }
} }
+35 -29
View File
@@ -67,9 +67,7 @@ static const char *MEM_CARD_DIR[NUM_PLAYERS] =
ProfileManager::ProfileManager() ProfileManager::ProfileManager()
{ {
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ m_bWasLoadedFromMemoryCard[p] = false;
m_bUsingMemoryCard[p] = false;
}
InitMachineScoresFromDisk(); InitMachineScoresFromDisk();
} }
@@ -105,7 +103,7 @@ bool ProfileManager::LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIs
ASSERT( sProfileDir.Right(1) == "/" ); ASSERT( sProfileDir.Right(1) == "/" );
m_sProfileDir[pn] = sProfileDir; m_sProfileDir[pn] = sProfileDir;
m_bUsingMemoryCard[pn] = bIsMemCard; m_bWasLoadedFromMemoryCard[pn] = bIsMemCard;
bool bResult = m_Profile[pn].LoadFromIni( m_sProfileDir[pn]+PROFILE_FILE ); bool bResult = m_Profile[pn].LoadFromIni( m_sProfileDir[pn]+PROFILE_FILE );
if( !bResult ) if( !bResult )
@@ -161,18 +159,33 @@ bool ProfileManager::LoadDefaultProfileFromMachine( PlayerNumber pn )
bool ProfileManager::LoadProfileFromMemoryCard( PlayerNumber pn ) bool ProfileManager::LoadProfileFromMemoryCard( PlayerNumber pn )
{ {
CString sDir = MEM_CARD_DIR[pn]; UnloadProfile( pn );
#ifndef _XBOX
// mount card
if( MEMCARDMAN->GetCardState(pn) == MEMORY_CARD_STATE_READY )
{
FILEMAN->Mount( "dir", MEMCARDMAN->GetOsMountDir(pn), MEM_CARD_DIR[pn] );
DEBUG_ASSERT( FILEMAN->IsMounted(sDir) ); // should be called only if we've already mounted CString sDir = MEM_CARD_DIR[pn];
DEBUG_ASSERT( FILEMAN->IsMounted(sDir) ); // should be called only if we've already mounted
// tack on a subdirectory so that we don't write everything to the root
sDir += PREFSMAN->m_sMemoryCardProfileSubdir;
sDir += '/';
bool bResult;
bResult = LoadProfile( pn, sDir, true );
if( bResult )
return true;
// tack on a subdirectory so that we don't write everything to the root CreateMemoryCardProfile( pn );
sDir += PREFSMAN->m_sMemoryCardProfileSubdir;
sDir += '/'; bResult = LoadProfile( pn, sDir, true );
return bResult;
m_bUsingMemoryCard[pn] = true; }
bool bResult; #endif
bResult = LoadProfile( pn, sDir, false ); return false;
return bResult;
} }
bool ProfileManager::CreateMemoryCardProfile( PlayerNumber pn ) bool ProfileManager::CreateMemoryCardProfile( PlayerNumber pn )
@@ -190,20 +203,8 @@ bool ProfileManager::CreateMemoryCardProfile( PlayerNumber pn )
bool ProfileManager::LoadFirstAvailableProfile( PlayerNumber pn ) bool ProfileManager::LoadFirstAvailableProfile( PlayerNumber pn )
{ {
#ifndef _XBOX if( LoadProfileFromMemoryCard(pn) )
// mount card return true;
if( MEMCARDMAN->GetCardState(pn) == MEMORY_CARD_STATE_READY )
{
FILEMAN->Mount( "dir", MEMCARDMAN->GetOsMountDir(pn), MEM_CARD_DIR[pn] );
if( LoadProfileFromMemoryCard(pn) )
return true;
CreateMemoryCardProfile( pn );
if( LoadProfileFromMemoryCard(pn) )
return true;
}
#endif
if( LoadDefaultProfileFromMachine(pn) ) if( LoadDefaultProfileFromMachine(pn) )
return true; return true;
@@ -229,7 +230,7 @@ bool ProfileManager::SaveProfile( PlayerNumber pn )
void ProfileManager::UnloadProfile( PlayerNumber pn ) void ProfileManager::UnloadProfile( PlayerNumber pn )
{ {
m_sProfileDir[pn] = ""; m_sProfileDir[pn] = "";
m_bUsingMemoryCard[pn] = false; m_bWasLoadedFromMemoryCard[pn] = false;
m_Profile[pn].Init(); m_Profile[pn].Init();
} }
@@ -1446,3 +1447,8 @@ bool ProfileManager::CategoryData::HighScore::operator>=( const HighScore& other
else else
return iScore >= other.iScore; return iScore >= other.iScore;
} }
bool ProfileManager::ProfileWasLoadedFromMemoryCard( PlayerNumber pn )
{
return GetProfile(pn) && m_bWasLoadedFromMemoryCard[pn];
}
+4 -4
View File
@@ -71,7 +71,8 @@ public:
void GetLocalProfileIDs( vector<CString> &asProfileIDsOut ); void GetLocalProfileIDs( vector<CString> &asProfileIDsOut );
void GetLocalProfileNames( vector<CString> &asNamesOut ); void GetLocalProfileNames( vector<CString> &asNamesOut );
bool LoadFirstAvailableProfile( PlayerNumber pn ); bool LoadProfileFromMemoryCard( PlayerNumber pn );
bool LoadFirstAvailableProfile( PlayerNumber pn ); // memory card or local profile
bool SaveProfile( PlayerNumber pn ); bool SaveProfile( PlayerNumber pn );
void UnloadProfile( PlayerNumber pn ); void UnloadProfile( PlayerNumber pn );
@@ -83,7 +84,7 @@ public:
Profile* GetMachineProfile() { return &m_MachineProfile; } Profile* GetMachineProfile() { return &m_MachineProfile; }
CString GetPlayerName( PlayerNumber pn ); CString GetPlayerName( PlayerNumber pn );
bool IsUsingMemoryCard( PlayerNumber pn ) { return m_bUsingMemoryCard[pn]; } bool ProfileWasLoadedFromMemoryCard( PlayerNumber pn );
// //
@@ -134,7 +135,6 @@ public:
private: private:
bool LoadDefaultProfileFromMachine( PlayerNumber pn ); bool LoadDefaultProfileFromMachine( PlayerNumber pn );
bool CreateMemoryCardProfile( PlayerNumber pn ); bool CreateMemoryCardProfile( PlayerNumber pn );
bool LoadProfileFromMemoryCard( PlayerNumber pn );
bool LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIsMemCard ); bool LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIsMemCard );
bool CreateProfile( CString sProfileDir, CString sName ); bool CreateProfile( CString sProfileDir, CString sName );
@@ -142,7 +142,7 @@ private:
// on a memory card. // on a memory card.
CString m_sProfileDir[NUM_PLAYERS]; CString m_sProfileDir[NUM_PLAYERS];
bool m_bUsingMemoryCard[NUM_PLAYERS]; bool m_bWasLoadedFromMemoryCard[NUM_PLAYERS];
// actual loaded profile data // actual loaded profile data
Profile m_Profile[NUM_PLAYERS]; Profile m_Profile[NUM_PLAYERS];
+3 -2
View File
@@ -18,6 +18,7 @@
#include "ThemeManager.h" #include "ThemeManager.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "RageSounds.h" #include "RageSounds.h"
#include "ProfileManager.h"
Screen::Screen( CString sName ) Screen::Screen( CString sName )
{ {
@@ -194,6 +195,8 @@ bool Screen::JoinInput( const DeviceInput& DeviceI, const InputEventType type, c
if( GAMESTATE->m_MasterPlayerNumber == PLAYER_INVALID ) if( GAMESTATE->m_MasterPlayerNumber == PLAYER_INVALID )
GAMESTATE->m_MasterPlayerNumber = MenuI.player; GAMESTATE->m_MasterPlayerNumber = MenuI.player;
for( int p=0; p<NUM_PLAYERS; p++ )
PROFILEMAN->LoadProfileFromMemoryCard( (PlayerNumber)p );
SCREENMAN->RefreshCreditsMessages(); SCREENMAN->RefreshCreditsMessages();
SOUND->PlayOnce( THEME->GetPathToS("Common start") ); SOUND->PlayOnce( THEME->GetPathToS("Common start") );
@@ -287,7 +290,6 @@ void Screen::ClearMessageQueue( const ScreenMessage SM )
#include "ScreenCenterImage.h" #include "ScreenCenterImage.h"
#include "ScreenTestInput.h" #include "ScreenTestInput.h"
#include "ScreenBookkeeping.h" #include "ScreenBookkeeping.h"
#include "ScreenRemoveMemoryCard.h"
#include "ScreenBranch.h" #include "ScreenBranch.h"
Screen* Screen::Create( CString sClassName ) Screen* Screen::Create( CString sClassName )
@@ -392,7 +394,6 @@ Screen* Screen::Create( CString sClassName )
IF_RETURN( ScreenCenterImage ); IF_RETURN( ScreenCenterImage );
IF_RETURN( ScreenTestInput ); IF_RETURN( ScreenTestInput );
IF_RETURN( ScreenBookkeeping ); IF_RETURN( ScreenBookkeeping );
IF_RETURN( ScreenRemoveMemoryCard );
IF_RETURN( ScreenBranch ); IF_RETURN( ScreenBranch );
RageException::Throw( "Invalid Screen class name '%s'", sClassName.c_str() ); RageException::Throw( "Invalid Screen class name '%s'", sClassName.c_str() );
+128 -126
View File
@@ -31,34 +31,31 @@
#include "RageTextureManager.h" #include "RageTextureManager.h"
#include "ProfileManager.h" #include "ProfileManager.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "MemoryCardManager.h"
ScreenManager* SCREENMAN = NULL; // global and accessable from anywhere in our program ScreenManager* SCREENMAN = NULL; // global and accessable from anywhere in our program
#define STATS_X THEME->GetMetricF("ScreenSystemLayer","StatsX") #define CREDITS_PRESS_START THEME->GetMetric ("ScreenSystemLayer","CreditsPressStart")
#define STATS_Y THEME->GetMetricF("ScreenSystemLayer","StatsY") #define CREDITS_INSERT_CARD THEME->GetMetric ("ScreenSystemLayer","CreditsInsertCard")
#define PLAYER_INFO_PRESS_START THEME->GetMetric ("ScreenSystemLayer","PlayerInfoPressStart") #define CREDITS_CARD_ERROR THEME->GetMetric ("ScreenSystemLayer","CreditsCardError")
#define PLAYER_INFO_INSERT_CARD THEME->GetMetric ("ScreenSystemLayer","PlayerInfoInsertCard") #define CREDITS_CARD_TOO_LATE THEME->GetMetric ("ScreenSystemLayer","CreditsCardTooLate")
#define PLAYER_INFO_NO_CARD THEME->GetMetric ("ScreenSystemLayer","PlayerInfoNoCard") #define CREDITS_TEXT_HOME THEME->GetMetric ("ScreenSystemLayer","CreditsTextHome")
#define PLAYER_INFO_NOT_PRESENT THEME->GetMetric ("ScreenSystemLayer","PlayerInfoNotPresent") #define CREDITS_TEXT_FREE_PLAY THEME->GetMetric ("ScreenSystemLayer","CreditsTextFreePlay")
#define PLAYER_INFO_INSERT_MORE THEME->GetMetric ("ScreenSystemLayer","PlayerInfoInsertMore") #define CREDITS_TEXT_CREDITS THEME->GetMetric ("ScreenSystemLayer","CreditsTextCredits")
#define CREDITS_TEXT_HOME THEME->GetMetric ("ScreenSystemLayer","CreditsTextHome") #define CREDITS_JOIN_ONLY THEME->GetMetricB("ScreenSystemLayer","CreditsJoinOnly")
#define CREDITS_TEXT_FREE_PLAY THEME->GetMetric ("ScreenSystemLayer","CreditsTextFreePlay")
#define CREDITS_TEXT_CREDITS THEME->GetMetric ("ScreenSystemLayer","CreditsTextCredits")
#define CREDITS_JOIN_ONLY THEME->GetMetric ("ScreenSystemLayer","CreditsJoinOnly")
const int NUM_SKIPS = 5; const int NUM_SKIPS_TO_SHOW = 5;
/* This screen is drawn on top of everything else, and receives updates, /* This screen is drawn on top of everything else, and receives updates,
* but not input. */ * but not input. */
class ScreenSystemLayer: public Screen class ScreenSystemLayer: public Screen
{ {
BitmapText m_textStats; BitmapText m_textStats;
BitmapText m_textSystemMessage; BitmapText m_textMessage;
BitmapText m_textPlayerInfo[NUM_PLAYERS]; BitmapText m_textCredits[NUM_PLAYERS];
BitmapText m_textCredits; BitmapText m_textTime;
BitmapText m_textSysTime; BitmapText m_textSkips[NUM_SKIPS_TO_SHOW];
BitmapText m_Skips[NUM_SKIPS];
int m_LastSkip; int m_LastSkip;
Quad m_SkipBackground; Quad m_SkipBackground;
@@ -75,38 +72,29 @@ public:
ScreenSystemLayer::ScreenSystemLayer() : Screen("ScreenSystemLayer") ScreenSystemLayer::ScreenSystemLayer() : Screen("ScreenSystemLayer")
{ {
m_textSystemMessage.LoadFromFont( THEME->GetPathToF("Common normal") ); m_textMessage.LoadFromFont( THEME->GetPathToF("ScreenSystemLayer message") );
m_textSystemMessage.SetHorizAlign( Actor::align_left ); m_textMessage.SetName( "Message" );
m_textSystemMessage.SetVertAlign( Actor::align_top ); SET_XY_AND_ON_COMMAND( m_textMessage );
m_textSystemMessage.SetXY( 4.0f, 4.0f ); this->AddChild(&m_textMessage);
m_textSystemMessage.SetZoom( 0.8f );
m_textSystemMessage.SetShadowLength( 2 );
m_textSystemMessage.SetDiffuse( RageColor(1,1,1,0) );
this->AddChild(&m_textSystemMessage);
m_textStats.LoadFromFont( THEME->GetPathToF("Common normal") ); m_textStats.LoadFromFont( THEME->GetPathToF("ScreenSystemLayer stats") );
m_textStats.SetXY( STATS_X, STATS_Y ); m_textStats.SetName( "Stats" );
m_textStats.SetHorizAlign( Actor::align_right ); SET_XY_AND_ON_COMMAND( m_textStats );
m_textStats.SetVertAlign( Actor::align_top );
m_textStats.SetZoom( 0.5f );
m_textStats.SetShadowLength( 2 );
this->AddChild(&m_textStats); this->AddChild(&m_textStats);
m_textSysTime.LoadFromFont( THEME->GetPathToF("Common normal") ); m_textTime.LoadFromFont( THEME->GetPathToF("ScreenSystemLayer time") );
m_textSysTime.SetXY( 4.0f, 40.0f ); m_textTime.SetName( "Time" );
m_textSysTime.SetHorizAlign( Actor::align_left ); SET_XY_AND_ON_COMMAND( m_textTime );
m_textSysTime.SetVertAlign( Actor::align_top ); this->AddChild(&m_textTime);
m_textSysTime.SetZoom( 0.5f );
m_textSysTime.SetDiffuse( RageColor(1,0,1,1) );
m_textSysTime.EnableShadow(false);
this->AddChild(&m_textSysTime);
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
this->AddChild(&m_textPlayerInfo[p]); m_textCredits[p].LoadFromFont( THEME->GetPathToF("ScreenManager credits") );
m_textCredits[p].SetName( ssprintf("CreditsP%d",p+1) );
SET_XY_AND_ON_COMMAND( &m_textCredits[p] );
this->AddChild(&m_textCredits[p]);
} }
this->AddChild(&m_textCredits);
/* "Was that a skip?" This displays a message when an update takes /* "Was that a skip?" This displays a message when an update takes
* abnormally long, to quantify skips more precisely, verify them * abnormally long, to quantify skips more precisely, verify them
@@ -118,124 +106,138 @@ ScreenSystemLayer::ScreenSystemLayer() : Screen("ScreenSystemLayer")
SKIP_WIDTH = 160.0f, SKIP_Y_DIST = 16.0f; SKIP_WIDTH = 160.0f, SKIP_Y_DIST = 16.0f;
m_SkipBackground.StretchTo(RectF(SKIP_LEFT-8, SKIP_TOP-8, m_SkipBackground.StretchTo(RectF(SKIP_LEFT-8, SKIP_TOP-8,
SKIP_LEFT+SKIP_WIDTH, SKIP_TOP+SKIP_Y_DIST*NUM_SKIPS)); SKIP_LEFT+SKIP_WIDTH, SKIP_TOP+SKIP_Y_DIST*NUM_SKIPS_TO_SHOW));
m_SkipBackground.SetDiffuse( RageColor(0,0,0,0) ); m_SkipBackground.SetDiffuse( RageColor(0,0,0,0) );
this->AddChild(&m_SkipBackground); this->AddChild(&m_SkipBackground);
for( int i=0; i<NUM_SKIPS; i++ ) for( int i=0; i<NUM_SKIPS_TO_SHOW; i++ )
{ {
/* This is somewhat big. Let's put it on the right side, where it'll /* This is somewhat big. Let's put it on the right side, where it'll
* obscure the 2P side during gameplay; there's nowhere to put it that * obscure the 2P side during gameplay; there's nowhere to put it that
* doesn't obscure something, and it's just a diagnostic. */ * doesn't obscure something, and it's just a diagnostic. */
m_Skips[i].LoadFromFont( THEME->GetPathToF("Common normal") ); m_textSkips[i].LoadFromFont( THEME->GetPathToF("Common normal") );
m_Skips[i].SetXY( SKIP_LEFT, SKIP_TOP + SKIP_Y_DIST*i ); m_textSkips[i].SetXY( SKIP_LEFT, SKIP_TOP + SKIP_Y_DIST*i );
m_Skips[i].SetHorizAlign( Actor::align_left ); m_textSkips[i].SetHorizAlign( Actor::align_left );
m_Skips[i].SetVertAlign( Actor::align_top ); m_textSkips[i].SetVertAlign( Actor::align_top );
m_Skips[i].SetZoom( 0.5f ); m_textSkips[i].SetZoom( 0.5f );
m_Skips[i].SetDiffuse( RageColor(1,1,1,0) ); m_textSkips[i].SetDiffuse( RageColor(1,1,1,0) );
m_Skips[i].EnableShadow(false); m_textSkips[i].EnableShadow(false);
this->AddChild(&m_Skips[i]); this->AddChild(&m_textSkips[i]);
} }
RefreshCreditsMessages();
} }
void ScreenSystemLayer::SystemMessage( CString sMessage ) void ScreenSystemLayer::SystemMessage( CString sMessage )
{ {
m_textSystemMessage.FinishTweening(); m_textMessage.FinishTweening();
m_textSystemMessage.SetText( sMessage ); m_textMessage.SetText( sMessage );
m_textSystemMessage.SetDiffuseAlpha( 1 ); m_textMessage.SetDiffuseAlpha( 1 );
m_textSystemMessage.SetX( -640 ); m_textMessage.SetX( -640 );
m_textSystemMessage.BeginTweening( 0.5f ); m_textMessage.BeginTweening( 0.5f );
m_textSystemMessage.SetX( 4 ); m_textMessage.SetX( 4 );
m_textSystemMessage.BeginTweening( 5 ); m_textMessage.BeginTweening( 5 );
m_textSystemMessage.BeginTweening( 0.5f ); m_textMessage.BeginTweening( 0.5f );
m_textSystemMessage.SetDiffuse( RageColor(1,1,1,0) ); m_textMessage.SetDiffuse( RageColor(1,1,1,0) );
} }
void ScreenSystemLayer::SystemMessageNoAnimate( CString sMessage ) void ScreenSystemLayer::SystemMessageNoAnimate( CString sMessage )
{ {
m_textSystemMessage.FinishTweening(); m_textMessage.FinishTweening();
m_textSystemMessage.SetText( sMessage ); m_textMessage.SetText( sMessage );
m_textSystemMessage.SetX( 4 ); m_textMessage.SetX( 4 );
m_textSystemMessage.SetDiffuseAlpha( 1 ); m_textMessage.SetDiffuseAlpha( 1 );
m_textSystemMessage.BeginTweening( 5 ); m_textMessage.BeginTweening( 5 );
m_textSystemMessage.BeginTweening( 0.5f ); m_textMessage.BeginTweening( 0.5f );
m_textSystemMessage.SetDiffuse( RageColor(1,1,1,0) ); m_textMessage.SetDiffuse( RageColor(1,1,1,0) );
} }
void ScreenSystemLayer::RefreshCreditsMessages() void ScreenSystemLayer::RefreshCreditsMessages()
{ {
m_textCredits.LoadFromFont( THEME->GetPathToF("ScreenManager credits") );
m_textCredits.SetName( "Credits" );
SET_XY_AND_ON_COMMAND( &m_textCredits );
CString sCredits;
switch( PREFSMAN->m_iCoinMode )
{
case COIN_HOME:
sCredits = CREDITS_TEXT_HOME;
break;
case COIN_PAY:
{
int Coins = GAMESTATE->m_iCoins % PREFSMAN->m_iCoinsPerCredit;
sCredits = ssprintf("%s %d", CREDITS_TEXT_CREDITS.c_str(), GAMESTATE->m_iCoins / PREFSMAN->m_iCoinsPerCredit);
if (Coins)
sCredits += ssprintf(" %d/%d", Coins, PREFSMAN->m_iCoinsPerCredit );
}
break;
case COIN_FREE:
sCredits = CREDITS_TEXT_FREE_PLAY;
break;
default:
ASSERT(0);
}
if( CREDITS_JOIN_ONLY && !GAMESTATE->PlayersCanJoin() )
sCredits = "";
m_textCredits.SetText( sCredits );
// update joined // update joined
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
m_textPlayerInfo[p].LoadFromFont( THEME->GetPathToF("ScreenManager credits") ); CString sCredits;
m_textPlayerInfo[p].SetName( ssprintf("PlayerInfoP%d",p+1 ) );
SET_XY_AND_ON_COMMAND( &m_textPlayerInfo[p] );
CString sPlayerInfo; if( GAMESTATE->m_bIsOnSystemMenu ) // no mem card
if( GAMESTATE->m_bSideIsJoined[p] )
{ {
sCredits = "";
}
else if( GAMESTATE->m_bSideIsJoined[p] )
{
MemoryCardState mcs = MEMCARDMAN->GetCardState( (PlayerNumber)p );
Profile* pProfile = PROFILEMAN->GetProfile( (PlayerNumber)p ); Profile* pProfile = PROFILEMAN->GetProfile( (PlayerNumber)p );
if( pProfile ) if( pProfile )
{ {
if( !pProfile->m_sLastUsedHighScoreName.empty() ) if( !pProfile->m_sLastUsedHighScoreName.empty() )
sPlayerInfo = pProfile->m_sLastUsedHighScoreName; sCredits = pProfile->m_sLastUsedHighScoreName;
else else
sPlayerInfo = pProfile->m_sName; sCredits = pProfile->m_sName;
} }
else if( GAMESTATE->m_bIsOnSystemMenu ) // no mem card
sPlayerInfo = "";
else else
{ {
if( GAMESTATE->PlayersCanJoin() ) switch( mcs )
sPlayerInfo = PLAYER_INFO_INSERT_CARD; {
else case MEMORY_CARD_STATE_NO_CARD:
sPlayerInfo = PLAYER_INFO_NO_CARD; if( GAMESTATE->PlayersCanJoin() )
sCredits = CREDITS_INSERT_CARD;
else
sCredits = "";
break;
case MEMORY_CARD_STATE_WRITE_ERROR:
sCredits = CREDITS_CARD_ERROR;
break;
case MEMORY_CARD_STATE_TOO_LATE:
sCredits = CREDITS_CARD_TOO_LATE;
break;
case MEMORY_CARD_STATE_READY:
sCredits = "";
break;
default:
ASSERT(0);
}
} }
} }
else if( GAMESTATE->PlayersCanJoin() ) else if( GAMESTATE->PlayersCanJoin() )
{ {
sCredits = CREDITS_PRESS_START;
if( PREFSMAN->m_iCoinMode==COIN_PAY && if( PREFSMAN->m_iCoinMode==COIN_PAY &&
PREFSMAN->m_Premium!=PrefsManager::JOINT_PREMIUM && PREFSMAN->m_Premium!=PrefsManager::JOINT_PREMIUM &&
GAMESTATE->m_iCoins<PREFSMAN->m_iCoinsPerCredit ) GAMESTATE->m_iCoins<PREFSMAN->m_iCoinsPerCredit )
sPlayerInfo = PLAYER_INFO_INSERT_MORE; {
else int Coins = GAMESTATE->m_iCoins % PREFSMAN->m_iCoinsPerCredit;
sPlayerInfo = PLAYER_INFO_PRESS_START; sCredits = ssprintf("%s %d", CREDITS_TEXT_CREDITS.c_str(), GAMESTATE->m_iCoins / PREFSMAN->m_iCoinsPerCredit);
if (Coins)
sCredits += ssprintf(" %d/%d", Coins, PREFSMAN->m_iCoinsPerCredit );
}
} }
else else
{ {
sPlayerInfo = PLAYER_INFO_NOT_PRESENT; switch( PREFSMAN->m_iCoinMode )
{
case COIN_HOME:
sCredits = CREDITS_TEXT_HOME;
break;
case COIN_PAY:
{
int Coins = GAMESTATE->m_iCoins % PREFSMAN->m_iCoinsPerCredit;
sCredits = ssprintf("%s %d", CREDITS_TEXT_CREDITS.c_str(), GAMESTATE->m_iCoins / PREFSMAN->m_iCoinsPerCredit);
if (Coins)
sCredits += ssprintf(" %d/%d", Coins, PREFSMAN->m_iCoinsPerCredit );
}
break;
case COIN_FREE:
sCredits = CREDITS_TEXT_FREE_PLAY;
break;
default:
ASSERT(0);
}
} }
m_textPlayerInfo[p].SetText( sPlayerInfo ); if( CREDITS_JOIN_ONLY && !GAMESTATE->PlayersCanJoin() )
sCredits = "";
m_textCredits[p].SetText( sCredits );
} }
} }
@@ -244,7 +246,7 @@ void ScreenSystemLayer::UpdateTimestampAndSkips()
if(!PREFSMAN->m_bTimestamping) if(!PREFSMAN->m_bTimestamping)
{ {
/* Hide: */ /* Hide: */
m_textSysTime.SetDiffuse( RageColor(1,1,1,0) ); m_textTime.SetDiffuse( RageColor(1,1,1,0) );
m_SkipBackground.SetDiffuse( RageColor(0,0,0,0) ); m_SkipBackground.SetDiffuse( RageColor(0,0,0,0) );
return; return;
} }
@@ -282,23 +284,23 @@ void ScreenSystemLayer::UpdateTimestampAndSkips()
RageColor(1,1,0,1), /* yellow */ RageColor(1,1,0,1), /* yellow */
RageColor(1,0.2f,0.2f,1) /* light red */ RageColor(1,0.2f,0.2f,1) /* light red */
}; };
m_Skips[m_LastSkip].SetText(ssprintf("%s: %.0fms (%.0f)", m_textSkips[m_LastSkip].SetText(ssprintf("%s: %.0fms (%.0f)",
time.c_str(), 1000*UpdateTime, UpdateTime/ExpectedUpdate)); time.c_str(), 1000*UpdateTime, UpdateTime/ExpectedUpdate));
m_Skips[m_LastSkip].StopTweening(); m_textSkips[m_LastSkip].StopTweening();
m_Skips[m_LastSkip].SetDiffuse(RageColor(1,1,1,1)); m_textSkips[m_LastSkip].SetDiffuse(RageColor(1,1,1,1));
m_Skips[m_LastSkip].BeginTweening(0.2f); m_textSkips[m_LastSkip].BeginTweening(0.2f);
m_Skips[m_LastSkip].SetDiffuse(colors[skip]); m_textSkips[m_LastSkip].SetDiffuse(colors[skip]);
m_Skips[m_LastSkip].BeginTweening(3.0f); m_textSkips[m_LastSkip].BeginTweening(3.0f);
m_Skips[m_LastSkip].BeginTweening(0.2f); m_textSkips[m_LastSkip].BeginTweening(0.2f);
m_Skips[m_LastSkip].SetDiffuse(RageColor(1,1,1,0)); m_textSkips[m_LastSkip].SetDiffuse(RageColor(1,1,1,0));
m_LastSkip++; m_LastSkip++;
m_LastSkip %= NUM_SKIPS; m_LastSkip %= NUM_SKIPS_TO_SHOW;
} }
} }
m_textSysTime.SetText( time ); m_textTime.SetText( time );
m_textSysTime.SetDiffuse( RageColor(1,0,1,1) ); m_textTime.SetDiffuse( RageColor(1,0,1,1) );
} }
void ScreenSystemLayer::Update( float fDeltaTime ) void ScreenSystemLayer::Update( float fDeltaTime )
-101
View File
@@ -1,101 +0,0 @@
#include "global.h"
/*
-----------------------------------------------------------------------------
Class: ScreenRemoveMemoryCard
Desc: Where the player maps device input to pad input.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ScreenRemoveMemoryCard.h"
#include "MemoryCardManager.h"
#include "RageLog.h"
#include "RageSounds.h"
#include "ThemeManager.h"
#include "GameConstantsAndTypes.h"
#include "PlayerNumber.h"
#include "ScreenManager.h"
#define NEXT_SCREEN THEME->GetMetric (m_sName,"NextScreen")
ScreenRemoveMemoryCard::ScreenRemoveMemoryCard( CString sClassName ) : Screen( sClassName )
{
if( !AnyCardsInserted() )
{
HandleScreenMessage( SM_GoToNextScreen ); // Don't show this screen
return;
}
LOG->Trace( "ScreenRemoveMemoryCard::ScreenRemoveMemoryCard()" );
m_Menu.Load( "ScreenRemoveMemoryCard" );
this->AddChild( &m_Menu );
SOUND->PlayMusic( THEME->GetPathToS("ScreenRemoveMemoryCard music") );
}
ScreenRemoveMemoryCard::~ScreenRemoveMemoryCard()
{
LOG->Trace( "ScreenRemoveMemoryCard::~ScreenRemoveMemoryCard()" );
}
void ScreenRemoveMemoryCard::DrawPrimitives()
{
m_Menu.DrawBottomLayer();
Screen::DrawPrimitives();
m_Menu.DrawTopLayer();
}
void ScreenRemoveMemoryCard::Update( float fDelta )
{
Screen::Update( fDelta );
if( !AnyCardsInserted() ) // all cards are pulled out
{
if( !m_Menu.IsTransitioning() )
m_Menu.StartTransitioning( SM_GoToPrevScreen );
}
}
void ScreenRemoveMemoryCard::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
if( type != IET_FIRST_PRESS && type != IET_SLOW_REPEAT )
return; // ignore
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default handler
}
void ScreenRemoveMemoryCard::HandleScreenMessage( const ScreenMessage SM )
{
switch( SM )
{
case SM_GoToNextScreen:
SCREENMAN->SetNewScreen( NEXT_SCREEN );
break;
}
}
void ScreenRemoveMemoryCard::MenuStart( PlayerNumber pn )
{
MenuBack( pn );
}
void ScreenRemoveMemoryCard::MenuBack( PlayerNumber pn )
{
if(!m_Menu.IsTransitioning())
{
m_Menu.StartTransitioning( SM_GoToPrevScreen );
}
}
bool ScreenRemoveMemoryCard::AnyCardsInserted()
{
for( int p=0; p<NUM_PLAYERS; p++ )
if( MEMCARDMAN->GetCardState((PlayerNumber)p) != MEMORY_CARD_STATE_NO_CARD )
return true;
return false;
}
-35
View File
@@ -1,35 +0,0 @@
/*
-----------------------------------------------------------------------------
Class: ScreenRemoveMemoryCard
Desc: Remind the player to remove their memory card.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "Screen.h"
#include "MenuElements.h"
class ScreenRemoveMemoryCard : public Screen
{
public:
ScreenRemoveMemoryCard( CString sName );
virtual ~ScreenRemoveMemoryCard();
virtual void DrawPrimitives();
virtual void Update( float fDelta );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuStart( PlayerNumber pn );
virtual void MenuBack( PlayerNumber pn );
private:
bool AnyCardsInserted();
MenuElements m_Menu;
};
+8 -8
View File
@@ -65,7 +65,7 @@ IntDir=.\../Debug6
TargetDir=\stepmania\stepmania\Program TargetDir=\stepmania\stepmania\Program
TargetName=StepMania-debug TargetName=StepMania-debug
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool # End Special Build Tool
@@ -102,8 +102,8 @@ IntDir=.\Debug
TargetDir=\stepmania\stepmania TargetDir=\stepmania\stepmania
TargetName=default TargetName=default
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c \ PreLink_Cmds=disasm\verinc cl /Zl /nologo /c \
verstub.cpp /Fo$(IntDir)\ verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool # End Special Build Tool
@@ -136,14 +136,14 @@ BSC32=bscmake.exe
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /pdb:"../release6/StepMania.pdb" /map /debug /machine:I386 # ADD BASE LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /pdb:"../release6/StepMania.pdb" /map /debug /machine:I386
# SUBTRACT BASE LINK32 /verbose /pdb:none # SUBTRACT BASE LINK32 /verbose /pdb:none
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /out:"../Program/StepMania.exe" # ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /out:"../../itg/Program/StepMania.exe"
# SUBTRACT LINK32 /verbose /pdb:none # SUBTRACT LINK32 /verbose /pdb:none
# Begin Special Build Tool # Begin Special Build Tool
IntDir=.\../Release6 IntDir=.\../Release6
TargetDir=\stepmania\stepmania\Program TargetDir=\stepmania\itg\Program
TargetName=StepMania TargetName=StepMania
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool # End Special Build Tool
@@ -184,8 +184,8 @@ IntDir=.\StepMania___Xbox_Release
TargetDir=\stepmania\stepmania TargetDir=\stepmania\stepmania
TargetName=default TargetName=default
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c \ PreLink_Cmds=disasm\verinc cl /Zl /nologo /c \
verstub.cpp /Fo$(IntDir)\ verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool # End Special Build Tool
-6
View File
@@ -388,12 +388,6 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File <File
RelativePath="ScreenReloadSongs.h"> RelativePath="ScreenReloadSongs.h">
</File> </File>
<File
RelativePath="ScreenRemoveMemoryCard.cpp">
</File>
<File
RelativePath="ScreenRemoveMemoryCard.h">
</File>
<File <File
RelativePath="ScreenSandbox.cpp"> RelativePath="ScreenSandbox.cpp">
</File> </File>