diff --git a/stepmania/src/GameCommand.cpp b/stepmania/src/GameCommand.cpp index d9310118f2..9490e76e1b 100644 --- a/stepmania/src/GameCommand.cpp +++ b/stepmania/src/GameCommand.cpp @@ -726,7 +726,7 @@ void GameCommand::ApplySelf( const vector &vpns ) const if( m_bInsertCredit ) { - InsertCredit(); + StepMania::InsertCredit(); } if( m_bApplyDefaultOptions ) { diff --git a/stepmania/src/GameLoop.cpp b/stepmania/src/GameLoop.cpp index 89b661f63c..8f76b6073f 100644 --- a/stepmania/src/GameLoop.cpp +++ b/stepmania/src/GameLoop.cpp @@ -109,7 +109,7 @@ void GameLoop() /* If we don't have focus, give up lots of CPU. */ // XXX: do this in DISPLAY EndFrame? - if( !AppHasFocus() ) + if( !StepMania::AppHasFocus() ) usleep( 10000 );// give some time to other processes and threads #if defined(_WINDOWS) /* In Windows, we want to give up some CPU for other threads. Most OS's do diff --git a/stepmania/src/RageDisplay_D3D.cpp b/stepmania/src/RageDisplay_D3D.cpp index f047046c17..aa5513734b 100644 --- a/stepmania/src/RageDisplay_D3D.cpp +++ b/stepmania/src/RageDisplay_D3D.cpp @@ -700,7 +700,7 @@ bool RageDisplay_D3D::BeginFrame() { bool bIgnore = false; VideoModeParams params; - GetPreferredVideoModeParams( params ); + StepMania::GetPreferredVideoModeParams( params ); CString sError = SetVideoMode( params, bIgnore ); if( sError != "" ) diff --git a/stepmania/src/RageException.cpp b/stepmania/src/RageException.cpp index 05446bcca2..065c31415c 100644 --- a/stepmania/src/RageException.cpp +++ b/stepmania/src/RageException.cpp @@ -42,7 +42,7 @@ void RageException::Throw(const char *fmt, ...) DebugBreak(); #endif - HandleException( error ); + StepMania::HandleException( error ); } /* diff --git a/stepmania/src/ScreenDebugOverlay.cpp b/stepmania/src/ScreenDebugOverlay.cpp index dc98760cee..3e72c1aa05 100644 --- a/stepmania/src/ScreenDebugOverlay.cpp +++ b/stepmania/src/ScreenDebugOverlay.cpp @@ -506,7 +506,7 @@ class DebugLineVsync : public IDebugLine virtual void Do( CString &sMessageOut ) { PREFSMAN->m_bVsync.Set( !PREFSMAN->m_bVsync ); - ApplyGraphicOptions(); + StepMania::ApplyGraphicOptions(); IDebugLine::Do( sMessageOut ); } }; @@ -589,7 +589,7 @@ class DebugLineReloadCurrentScreen : public IDebugLine virtual void Do( CString &sMessageOut ) { SOUND->StopMusic(); - ResetGame(); + StepMania::ResetGame(); SCREENMAN->SetNewScreen( SCREENMAN->GetTopScreen()->GetName() ); IDebugLine::Do( sMessageOut ); sMessageOut = ""; diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index c2813872bc..80ca76e59a 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -866,7 +866,7 @@ void ScreenEvaluation::Input( const InputEventPlus &input ) Profile* pProfile = PROFILEMAN->GetProfile(pn); CString sDir = PROFILEMAN->GetProfileDir((ProfileSlot)pn) + "Screenshots/"; int iScreenshotIndex = pProfile->GetNextScreenshotIndex(); - CString sFileName = SaveScreenshot( sDir, true, true, iScreenshotIndex ); + CString sFileName = StepMania::SaveScreenshot( sDir, true, true, iScreenshotIndex ); CString sPath = sDir+sFileName; if( !sFileName.empty() ) diff --git a/stepmania/src/ScreenOptionsMaster.cpp b/stepmania/src/ScreenOptionsMaster.cpp index 34c1ca8dea..908e299c16 100644 --- a/stepmania/src/ScreenOptionsMaster.cpp +++ b/stepmania/src/ScreenOptionsMaster.cpp @@ -195,7 +195,7 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM ) if( (m_iChangeMask & OPT_APPLY_THEME) || (m_iChangeMask & OPT_APPLY_GRAPHICS) || (m_iChangeMask & OPT_APPLY_ASPECT_RATIO) ) - ApplyGraphicOptions(); + StepMania::ApplyGraphicOptions(); if( m_iChangeMask & OPT_SAVE_PREFERENCES ) { @@ -206,7 +206,7 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM ) if( m_iChangeMask & OPT_RESET_GAME ) { - ResetGame(); + StepMania::ResetGame(); SCREENMAN->SetNewScreen( CommonMetrics::INITIAL_SCREEN ); m_bExportWillSetANewScreen = false; } diff --git a/stepmania/src/ScreenOptionsMasterPrefs.cpp b/stepmania/src/ScreenOptionsMasterPrefs.cpp index 0e9d9d4362..64c11cc2ed 100644 --- a/stepmania/src/ScreenOptionsMasterPrefs.cpp +++ b/stepmania/src/ScreenOptionsMasterPrefs.cpp @@ -147,7 +147,7 @@ static void GameSel( int &sel, bool ToSel, const ConfOption *pConfOption ) } else { vector aGames; GAMEMAN->GetEnabledGames( aGames ); - ChangeCurrentGame( aGames[sel] ); + StepMania::ChangeCurrentGame( aGames[sel] ); } } diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index d28fa72043..0946b7608d 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -75,7 +75,7 @@ void ScreenTitleMenu::Input( const InputEventPlus &input ) CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_THEME2) ) { THEME->NextTheme(); - ApplyGraphicOptions(); // update window title and icon + StepMania::ApplyGraphicOptions(); // update window title and icon SCREENMAN->SystemMessage( "Theme: "+THEME->GetCurThemeName() ); SCREENMAN->SetNewScreen( m_sName ); TEXTUREMAN->DoDelayedDelete(); @@ -107,7 +107,7 @@ void ScreenTitleMenu::Input( const InputEventPlus &input ) GAMESTATE->SetCurGame( *iter ); /* 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->SetNewScreen( m_sName ); diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index e43fbbf1a9..5a4839a203 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -86,7 +86,7 @@ static Preference g_bAllowMultipleInstances( "AllowMultipleInstances", fal void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame ); -void GetPreferredVideoModeParams( VideoModeParams ¶msOut ) +void StepMania::GetPreferredVideoModeParams( VideoModeParams ¶msOut ) { paramsOut = VideoModeParams( PREFSMAN->m_bWindowed, @@ -168,7 +168,7 @@ static void StartDisplay() ); } -void ApplyGraphicOptions() +void StepMania::ApplyGraphicOptions() { bool bNeedReload = false; @@ -261,7 +261,7 @@ void ShutdownGame() /* 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. */ -void HandleException( CString error ) +void StepMania::HandleException( CString error ) { if( g_bAutoRestart ) HOOKS->RestartProgram(); @@ -275,7 +275,7 @@ void HandleException( CString error ) exit(1); } -void ResetGame() +void StepMania::ResetGame() { GAMESTATE->Reset(); @@ -715,7 +715,7 @@ RageDisplay *CreateDisplay() CheckVideoDefaultSettings(); VideoModeParams params; - GetPreferredVideoModeParams( params ); + StepMania::GetPreferredVideoModeParams( params ); 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" @@ -767,7 +767,7 @@ RageDisplay *CreateDisplay() extern const CString STATIC_INI_PATH; -void ChangeCurrentGame( const Game* g ) +void StepMania::ChangeCurrentGame( const Game* g ) { ASSERT( g ); @@ -1112,7 +1112,7 @@ int main(int argc, char* argv[]) if( ChangeAppPri() ) HOOKS->BoostPriority(); - ResetGame(); + StepMania::ResetGame(); /* Now that GAMESTATE is reset, tell SCREENMAN to update the theme (load * overlay screens and global sounds), and load the initial screen. */ @@ -1151,7 +1151,7 @@ int main(int argc, char* argv[]) #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 @@ -1220,7 +1220,7 @@ CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature, static Preference g_iCoinSettleTime( "CoinSettleTime", 0.03f ); -void InsertCoin( int iNum, const RageTimer *pTime ) +void StepMania::InsertCoin( int iNum, const RageTimer *pTime ) { if( pTime != NULL ) { @@ -1248,7 +1248,7 @@ void InsertCoin( int iNum, const RageTimer *pTime ) MESSAGEMAN->Broadcast( Message_CoinInserted ); } -void InsertCredit() +void StepMania::InsertCredit() { InsertCoin( PREFSMAN->m_iCoinsPerCredit ); } @@ -1284,7 +1284,7 @@ bool HandleGlobalInputs( const InputEventPlus &input ) LOG->Trace( "Ignored coin insertion (editing)" ); 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 } @@ -1324,7 +1324,7 @@ bool HandleGlobalInputs( const InputEventPlus &input ) { // If holding LShift save uncompressed, else save compressed bool bSaveCompressed = !INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT) ); - SaveScreenshot( "Screenshots/", bSaveCompressed, false ); + StepMania::SaveScreenshot( "Screenshots/", bSaveCompressed, false ); return true; // handled } @@ -1335,7 +1335,7 @@ bool HandleGlobalInputs( const InputEventPlus &input ) { /* alt-enter */ PREFSMAN->m_bWindowed.Set( !PREFSMAN->m_bWindowed ); - ApplyGraphicOptions(); + StepMania::ApplyGraphicOptions(); return true; } } @@ -1427,7 +1427,7 @@ void HandleInputEvents(float fDeltaTime) } } -void FocusChanged( bool bHasFocus ) +void StepMania::FocusChanged( bool bHasFocus ) { if( g_bHasFocus == bHasFocus ) return; @@ -1448,7 +1448,7 @@ void FocusChanged( bool bHasFocus ) } } -bool AppHasFocus() +bool StepMania::AppHasFocus() { return g_bHasFocus; } diff --git a/stepmania/src/StepMania.h b/stepmania/src/StepMania.h index 1964da0912..25ab7572a0 100644 --- a/stepmania/src/StepMania.h +++ b/stepmania/src/StepMania.h @@ -3,27 +3,31 @@ class Game; class RageTimer; +class VideoModeParams; #ifdef _XBOX void __cdecl main(); #else int main( int argc, char* argv[] ); #endif -void ApplyGraphicOptions(); -void NORETURN HandleException( CString error ); -void ResetGame(); -void ChangeCurrentGame( const Game* g ); -void FocusChanged( bool bHasFocus ); -bool AppHasFocus(); -// If successful, return filename of screenshot in sDir, else return "" -CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature, int iIndex = -1 ); +namespace StepMania +{ + void ApplyGraphicOptions(); + void NORETURN HandleException( CString error ); + void ResetGame(); + void ChangeCurrentGame( const Game* g ); + void FocusChanged( bool bHasFocus ); + bool AppHasFocus(); -void InsertCoin( int iNum = 1, const RageTimer *pTime = NULL ); -void InsertCredit(); + // If successful, return filename of screenshot in sDir, else return "" + CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature, int iIndex = -1 ); -class VideoModeParams; -void GetPreferredVideoModeParams( VideoModeParams ¶msOut ); + void InsertCoin( int iNum = 1, const RageTimer *pTime = NULL ); + void InsertCredit(); + + void GetPreferredVideoModeParams( VideoModeParams ¶msOut ); +} #endif