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 )
{
InsertCredit();
StepMania::InsertCredit();
}
if( m_bApplyDefaultOptions )
{
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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 != "" )
+1 -1
View File
@@ -42,7 +42,7 @@ void RageException::Throw(const char *fmt, ...)
DebugBreak();
#endif
HandleException( error );
StepMania::HandleException( error );
}
/*
+2 -2
View File
@@ -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 = "";
+1 -1
View File
@@ -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() )
+2 -2
View File
@@ -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;
}
+1 -1
View File
@@ -147,7 +147,7 @@ static void GameSel( int &sel, bool ToSel, const ConfOption *pConfOption )
} else {
vector<const Game*> 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) )
{
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 );
+15 -15
View File
@@ -86,7 +86,7 @@ static Preference<bool> g_bAllowMultipleInstances( "AllowMultipleInstances", fal
void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame );
void GetPreferredVideoModeParams( VideoModeParams &paramsOut )
void StepMania::GetPreferredVideoModeParams( VideoModeParams &paramsOut )
{
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<float> 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;
}
+16 -12
View File
@@ -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 &paramsOut );
void InsertCoin( int iNum = 1, const RageTimer *pTime = NULL );
void InsertCredit();
void GetPreferredVideoModeParams( VideoModeParams &paramsOut );
}
#endif