From 49fd8b0a24f63e3a6f876aa7a706373c54b4a85c Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 12 Aug 2003 18:50:42 +0000 Subject: [PATCH] reduce duplicate code --- stepmania/src/StepMania.cpp | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 69d418295e..a937b67ff6 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -97,12 +97,9 @@ static void ChangeToDirOfExecutable(const char *argv0) #endif } -void ApplyGraphicOptions() -{ - bool bNeedReload = false; - - bNeedReload |= DISPLAY->SetVideoMode( - RageDisplay::VideoModeParams( +static RageDisplay::VideoModeParams GetCurVideoModeParams() +{ + return RageDisplay::VideoModeParams( PREFSMAN->m_bWindowed, PREFSMAN->m_iDisplayWidth, PREFSMAN->m_iDisplayHeight, @@ -116,7 +113,15 @@ void ApplyGraphicOptions() , PREFSMAN->m_bProgressive , PREFSMAN->m_bPAL #endif - ) ); + ); +} + +void ApplyGraphicOptions() +{ + bool bNeedReload = false; + + bNeedReload |= DISPLAY->SetVideoMode( GetCurVideoModeParams() ); + bNeedReload |= TEXTUREMAN->SetPrefs( PREFSMAN->m_iTextureColorDepth, PREFSMAN->m_iMovieColorDepth, @@ -370,22 +375,7 @@ RageDisplay *CreateDisplay() } } - - RageDisplay::VideoModeParams params( - PREFSMAN->m_bWindowed, - PREFSMAN->m_iDisplayWidth, - PREFSMAN->m_iDisplayHeight, - PREFSMAN->m_iDisplayColorDepth, - PREFSMAN->m_iRefreshRate, - PREFSMAN->m_bVsync, - PREFSMAN->m_bAntiAliasing, - THEME->GetMetric("Common","WindowTitle"), - THEME->GetPathToG("Common window icon") -#ifdef _XBOX - , PREFSMAN->m_bProgressive - , PREFSMAN->m_bPAL -#endif - ); + RageDisplay::VideoModeParams params(GetCurVideoModeParams()); CString error = "There was an error while initializing your video card.\n\n" " PLEASE DO NOT FILE THIS ERROR AS A BUG!\n\n"