move floating globals into a namespace

This commit is contained in:
Chris Danford
2005-12-02 01:16:28 +00:00
parent 58eb9115db
commit 800158e185
11 changed files with 43 additions and 39 deletions
+1 -1
View File
@@ -726,7 +726,7 @@ void GameCommand::ApplySelf( const vector<PlayerNumber> &vpns ) const
if( m_bInsertCredit ) if( m_bInsertCredit )
{ {
InsertCredit(); StepMania::InsertCredit();
} }
if( m_bApplyDefaultOptions ) if( m_bApplyDefaultOptions )
{ {
+1 -1
View File
@@ -109,7 +109,7 @@ void GameLoop()
/* If we don't have focus, give up lots of CPU. */ /* If we don't have focus, give up lots of CPU. */
// XXX: do this in DISPLAY EndFrame? // XXX: do this in DISPLAY EndFrame?
if( !AppHasFocus() ) if( !StepMania::AppHasFocus() )
usleep( 10000 );// give some time to other processes and threads usleep( 10000 );// give some time to other processes and threads
#if defined(_WINDOWS) #if defined(_WINDOWS)
/* In Windows, we want to give up some CPU for other threads. Most OS's do /* In Windows, we want to give up some CPU for other threads. Most OS's do
+1 -1
View File
@@ -700,7 +700,7 @@ bool RageDisplay_D3D::BeginFrame()
{ {
bool bIgnore = false; bool bIgnore = false;
VideoModeParams params; VideoModeParams params;
GetPreferredVideoModeParams( params ); StepMania::GetPreferredVideoModeParams( params );
CString sError = SetVideoMode( params, bIgnore ); CString sError = SetVideoMode( params, bIgnore );
if( sError != "" ) if( sError != "" )
+1 -1
View File
@@ -42,7 +42,7 @@ void RageException::Throw(const char *fmt, ...)
DebugBreak(); DebugBreak();
#endif #endif
HandleException( error ); StepMania::HandleException( error );
} }
/* /*
+2 -2
View File
@@ -506,7 +506,7 @@ class DebugLineVsync : public IDebugLine
virtual void Do( CString &sMessageOut ) virtual void Do( CString &sMessageOut )
{ {
PREFSMAN->m_bVsync.Set( !PREFSMAN->m_bVsync ); PREFSMAN->m_bVsync.Set( !PREFSMAN->m_bVsync );
ApplyGraphicOptions(); StepMania::ApplyGraphicOptions();
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
} }
}; };
@@ -589,7 +589,7 @@ class DebugLineReloadCurrentScreen : public IDebugLine
virtual void Do( CString &sMessageOut ) virtual void Do( CString &sMessageOut )
{ {
SOUND->StopMusic(); SOUND->StopMusic();
ResetGame(); StepMania::ResetGame();
SCREENMAN->SetNewScreen( SCREENMAN->GetTopScreen()->GetName() ); SCREENMAN->SetNewScreen( SCREENMAN->GetTopScreen()->GetName() );
IDebugLine::Do( sMessageOut ); IDebugLine::Do( sMessageOut );
sMessageOut = ""; sMessageOut = "";
+1 -1
View File
@@ -866,7 +866,7 @@ void ScreenEvaluation::Input( const InputEventPlus &input )
Profile* pProfile = PROFILEMAN->GetProfile(pn); Profile* pProfile = PROFILEMAN->GetProfile(pn);
CString sDir = PROFILEMAN->GetProfileDir((ProfileSlot)pn) + "Screenshots/"; CString sDir = PROFILEMAN->GetProfileDir((ProfileSlot)pn) + "Screenshots/";
int iScreenshotIndex = pProfile->GetNextScreenshotIndex(); int iScreenshotIndex = pProfile->GetNextScreenshotIndex();
CString sFileName = SaveScreenshot( sDir, true, true, iScreenshotIndex ); CString sFileName = StepMania::SaveScreenshot( sDir, true, true, iScreenshotIndex );
CString sPath = sDir+sFileName; CString sPath = sDir+sFileName;
if( !sFileName.empty() ) if( !sFileName.empty() )
+2 -2
View File
@@ -195,7 +195,7 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
if( (m_iChangeMask & OPT_APPLY_THEME) || if( (m_iChangeMask & OPT_APPLY_THEME) ||
(m_iChangeMask & OPT_APPLY_GRAPHICS) || (m_iChangeMask & OPT_APPLY_GRAPHICS) ||
(m_iChangeMask & OPT_APPLY_ASPECT_RATIO) ) (m_iChangeMask & OPT_APPLY_ASPECT_RATIO) )
ApplyGraphicOptions(); StepMania::ApplyGraphicOptions();
if( m_iChangeMask & OPT_SAVE_PREFERENCES ) if( m_iChangeMask & OPT_SAVE_PREFERENCES )
{ {
@@ -206,7 +206,7 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
if( m_iChangeMask & OPT_RESET_GAME ) if( m_iChangeMask & OPT_RESET_GAME )
{ {
ResetGame(); StepMania::ResetGame();
SCREENMAN->SetNewScreen( CommonMetrics::INITIAL_SCREEN ); SCREENMAN->SetNewScreen( CommonMetrics::INITIAL_SCREEN );
m_bExportWillSetANewScreen = false; m_bExportWillSetANewScreen = false;
} }
+1 -1
View File
@@ -147,7 +147,7 @@ static void GameSel( int &sel, bool ToSel, const ConfOption *pConfOption )
} else { } else {
vector<const Game*> aGames; vector<const Game*> aGames;
GAMEMAN->GetEnabledGames( aGames ); GAMEMAN->GetEnabledGames( aGames );
ChangeCurrentGame( aGames[sel] ); StepMania::ChangeCurrentGame( aGames[sel] );
} }
} }
+2 -2
View File
@@ -75,7 +75,7 @@ void ScreenTitleMenu::Input( const InputEventPlus &input )
CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_THEME2) ) CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_THEME2) )
{ {
THEME->NextTheme(); THEME->NextTheme();
ApplyGraphicOptions(); // update window title and icon StepMania::ApplyGraphicOptions(); // update window title and icon
SCREENMAN->SystemMessage( "Theme: "+THEME->GetCurThemeName() ); SCREENMAN->SystemMessage( "Theme: "+THEME->GetCurThemeName() );
SCREENMAN->SetNewScreen( m_sName ); SCREENMAN->SetNewScreen( m_sName );
TEXTUREMAN->DoDelayedDelete(); TEXTUREMAN->DoDelayedDelete();
@@ -107,7 +107,7 @@ void ScreenTitleMenu::Input( const InputEventPlus &input )
GAMESTATE->SetCurGame( *iter ); GAMESTATE->SetCurGame( *iter );
/* Reload the theme if it's changed, but don't back to the initial screen. */ /* Reload the theme if it's changed, but don't back to the initial screen. */
ResetGame(); StepMania::ResetGame();
SCREENMAN->SystemMessage( CString("Game: ") + GAMESTATE->GetCurrentGame()->m_szName ); SCREENMAN->SystemMessage( CString("Game: ") + GAMESTATE->GetCurrentGame()->m_szName );
SCREENMAN->SetNewScreen( m_sName ); SCREENMAN->SetNewScreen( m_sName );
+15 -15
View File
@@ -86,7 +86,7 @@ static Preference<bool> g_bAllowMultipleInstances( "AllowMultipleInstances", fal
void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame ); void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame );
void GetPreferredVideoModeParams( VideoModeParams &paramsOut ) void StepMania::GetPreferredVideoModeParams( VideoModeParams &paramsOut )
{ {
paramsOut = VideoModeParams( paramsOut = VideoModeParams(
PREFSMAN->m_bWindowed, PREFSMAN->m_bWindowed,
@@ -168,7 +168,7 @@ static void StartDisplay()
); );
} }
void ApplyGraphicOptions() void StepMania::ApplyGraphicOptions()
{ {
bool bNeedReload = false; bool bNeedReload = false;
@@ -261,7 +261,7 @@ void ShutdownGame()
/* Cleanly shut down, show a dialog and exit the game. We don't go back /* Cleanly shut down, show a dialog and exit the game. We don't go back
* up the call stack, to avoid having to use exceptions. */ * up the call stack, to avoid having to use exceptions. */
void HandleException( CString error ) void StepMania::HandleException( CString error )
{ {
if( g_bAutoRestart ) if( g_bAutoRestart )
HOOKS->RestartProgram(); HOOKS->RestartProgram();
@@ -275,7 +275,7 @@ void HandleException( CString error )
exit(1); exit(1);
} }
void ResetGame() void StepMania::ResetGame()
{ {
GAMESTATE->Reset(); GAMESTATE->Reset();
@@ -715,7 +715,7 @@ RageDisplay *CreateDisplay()
CheckVideoDefaultSettings(); CheckVideoDefaultSettings();
VideoModeParams params; VideoModeParams params;
GetPreferredVideoModeParams( params ); StepMania::GetPreferredVideoModeParams( params );
CString error = "There was an error while initializing your video card.\n\n" CString error = "There was an error while initializing your video card.\n\n"
"Please do not file this error as a bug! Use the web page below to troubleshoot this problem.\n\n" "Please do not file this error as a bug! Use the web page below to troubleshoot this problem.\n\n"
@@ -767,7 +767,7 @@ RageDisplay *CreateDisplay()
extern const CString STATIC_INI_PATH; extern const CString STATIC_INI_PATH;
void ChangeCurrentGame( const Game* g ) void StepMania::ChangeCurrentGame( const Game* g )
{ {
ASSERT( g ); ASSERT( g );
@@ -1112,7 +1112,7 @@ int main(int argc, char* argv[])
if( ChangeAppPri() ) if( ChangeAppPri() )
HOOKS->BoostPriority(); HOOKS->BoostPriority();
ResetGame(); StepMania::ResetGame();
/* Now that GAMESTATE is reset, tell SCREENMAN to update the theme (load /* Now that GAMESTATE is reset, tell SCREENMAN to update the theme (load
* overlay screens and global sounds), and load the initial screen. */ * overlay screens and global sounds), and load the initial screen. */
@@ -1151,7 +1151,7 @@ int main(int argc, char* argv[])
#endif #endif
} }
CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature, int iIndex ) CString StepMania::SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature, int iIndex )
{ {
// //
// Find a file name for the screenshot // Find a file name for the screenshot
@@ -1220,7 +1220,7 @@ CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature,
static Preference<float> g_iCoinSettleTime( "CoinSettleTime", 0.03f ); static Preference<float> g_iCoinSettleTime( "CoinSettleTime", 0.03f );
void InsertCoin( int iNum, const RageTimer *pTime ) void StepMania::InsertCoin( int iNum, const RageTimer *pTime )
{ {
if( pTime != NULL ) if( pTime != NULL )
{ {
@@ -1248,7 +1248,7 @@ void InsertCoin( int iNum, const RageTimer *pTime )
MESSAGEMAN->Broadcast( Message_CoinInserted ); MESSAGEMAN->Broadcast( Message_CoinInserted );
} }
void InsertCredit() void StepMania::InsertCredit()
{ {
InsertCoin( PREFSMAN->m_iCoinsPerCredit ); InsertCoin( PREFSMAN->m_iCoinsPerCredit );
} }
@@ -1284,7 +1284,7 @@ bool HandleGlobalInputs( const InputEventPlus &input )
LOG->Trace( "Ignored coin insertion (editing)" ); LOG->Trace( "Ignored coin insertion (editing)" );
break; break;
} }
InsertCoin( 1, &input.DeviceI.ts ); StepMania::InsertCoin( 1, &input.DeviceI.ts );
return false; // Attract need to know because they go to TitleMenu on > 1 credit return false; // Attract need to know because they go to TitleMenu on > 1 credit
} }
@@ -1324,7 +1324,7 @@ bool HandleGlobalInputs( const InputEventPlus &input )
{ {
// If holding LShift save uncompressed, else save compressed // If holding LShift save uncompressed, else save compressed
bool bSaveCompressed = !INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT) ); bool bSaveCompressed = !INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT) );
SaveScreenshot( "Screenshots/", bSaveCompressed, false ); StepMania::SaveScreenshot( "Screenshots/", bSaveCompressed, false );
return true; // handled return true; // handled
} }
@@ -1335,7 +1335,7 @@ bool HandleGlobalInputs( const InputEventPlus &input )
{ {
/* alt-enter */ /* alt-enter */
PREFSMAN->m_bWindowed.Set( !PREFSMAN->m_bWindowed ); PREFSMAN->m_bWindowed.Set( !PREFSMAN->m_bWindowed );
ApplyGraphicOptions(); StepMania::ApplyGraphicOptions();
return true; return true;
} }
} }
@@ -1427,7 +1427,7 @@ void HandleInputEvents(float fDeltaTime)
} }
} }
void FocusChanged( bool bHasFocus ) void StepMania::FocusChanged( bool bHasFocus )
{ {
if( g_bHasFocus == bHasFocus ) if( g_bHasFocus == bHasFocus )
return; return;
@@ -1448,7 +1448,7 @@ void FocusChanged( bool bHasFocus )
} }
} }
bool AppHasFocus() bool StepMania::AppHasFocus()
{ {
return g_bHasFocus; return g_bHasFocus;
} }
+5 -1
View File
@@ -3,12 +3,16 @@
class Game; class Game;
class RageTimer; class RageTimer;
class VideoModeParams;
#ifdef _XBOX #ifdef _XBOX
void __cdecl main(); void __cdecl main();
#else #else
int main( int argc, char* argv[] ); int main( int argc, char* argv[] );
#endif #endif
namespace StepMania
{
void ApplyGraphicOptions(); void ApplyGraphicOptions();
void NORETURN HandleException( CString error ); void NORETURN HandleException( CString error );
void ResetGame(); void ResetGame();
@@ -22,8 +26,8 @@ CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature,
void InsertCoin( int iNum = 1, const RageTimer *pTime = NULL ); void InsertCoin( int iNum = 1, const RageTimer *pTime = NULL );
void InsertCredit(); void InsertCredit();
class VideoModeParams;
void GetPreferredVideoModeParams( VideoModeParams &paramsOut ); void GetPreferredVideoModeParams( VideoModeParams &paramsOut );
}
#endif #endif