diff options
author | Max Horn | 2003-10-05 14:37:16 +0000 |
---|---|---|
committer | Max Horn | 2003-10-05 14:37:16 +0000 |
commit | b4e5d97994a5827350e030429caea364514dadda (patch) | |
tree | 639bb20ae3e68f000e61293c165b8ea8929b16f7 | |
parent | bfde7528bab0dfa74bde6173ca31d61818c01bd9 (diff) | |
download | scummvm-rg350-b4e5d97994a5827350e030429caea364514dadda.tar.gz scummvm-rg350-b4e5d97994a5827350e030429caea364514dadda.tar.bz2 scummvm-rg350-b4e5d97994a5827350e030429caea364514dadda.zip |
factor out common gfx_mode/fullscreen setup code from the game engines into the main code (maybe putting this into the Engine constructor would be better, though?)
svn-id: r10611
-rw-r--r-- | base/main.cpp | 18 | ||||
-rw-r--r-- | queen/queen.cpp | 14 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 12 | ||||
-rw-r--r-- | simon/simon.cpp | 13 | ||||
-rw-r--r-- | sky/sky.cpp | 14 | ||||
-rw-r--r-- | sword2/sword2.cpp | 13 |
6 files changed, 17 insertions, 67 deletions
diff --git a/base/main.cpp b/base/main.cpp index 2a2cf17428..98fd8413f5 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -306,13 +306,29 @@ int main(int argc, char *argv[]) { prop.caption = detector.getGameName().c_str(); system->property(OSystem::PROP_SET_WINDOW_CAPTION, &prop); + // FIXME: It seem not logical that we first might set the gfx mode to + // 1x, and then immediately after might override it again. We probably + // should combine both checks into one. + // See if the game should default to 1x scaler if ((detector._default_gfx_mode) && (detector._game.features & GF_DEFAULT_TO_1X_SCALER)) { prop.gfx_mode = GFX_NORMAL; system->property(OSystem::PROP_SET_GFX_MODE, &prop); } - + + // Override global scaler with any game-specific define + if (g_config->get("gfx_mode")) { + prop.gfx_mode = detector.parseGraphicsMode(g_config->get("gfx_mode")); + system->property(OSystem::PROP_SET_GFX_MODE, &prop); + } + + // Override global fullscreen setting with any game-specific define + if (g_config->getBool("fullscreen", false)) { + if (!system->property(OSystem::PROP_GET_FULLSCREEN, 0)) + system->property(OSystem::PROP_TOGGLE_FULLSCREEN, 0); + } + // Create the game engine Engine *engine = detector.createEngine(system); assert(engine); diff --git a/queen/queen.cpp b/queen/queen.cpp index dd400d5be9..001021fa15 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -94,23 +94,9 @@ void QueenEngine::go() { } void QueenEngine::initialise(void) { - OSystem::Property prop; - _queenResource = new QueenResource(_gameDataPath); _queenLogic = new QueenLogic(_queenResource); //_queenSound = new QueenSound(_mixer, _detector->_sfx_volume); - - // Override global scaler with any game-specific define - if (g_config->get("gfx_mode")) { - prop.gfx_mode = _detector->parseGraphicsMode(g_config->get("gfx_mode")); - _system->property(OSystem::PROP_SET_GFX_MODE, &prop); - } - - // Override global fullscreen setting with any game-specific define - if (g_config->getBool("fullscreen", false)) { - if (!_system->property(OSystem::PROP_GET_FULLSCREEN, 0)) - _system->property(OSystem::PROP_TOGGLE_FULLSCREEN, 0); - } } void QueenEngine::delay(uint amount) { diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 30d7ac909e..fc8dfa16d0 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -640,24 +640,12 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst) _sound->_sound_volume_sfx = detector->_sfx_volume; _sound->_sound_volume_music = detector->_music_volume; - // Override global scaler with any game-specific define - if (g_config->get("gfx_mode")) { - prop.gfx_mode = detector->parseGraphicsMode(g_config->get("gfx_mode")); - syst->property(OSystem::PROP_SET_GFX_MODE, &prop); - } - /* Initialize backend */ syst->init_size(_screenWidth, _screenHeight); prop.cd_num = detector->_cdrom; if (prop.cd_num >= 0 && (_features & GF_AUDIOTRACKS)) syst->property(OSystem::PROP_OPEN_CD, &prop); - // Override global fullscreen setting with any game-specific define - if (g_config->getBool("fullscreen", false)) { - if (!syst->property(OSystem::PROP_GET_FULLSCREEN, 0)) - syst->property(OSystem::PROP_TOGGLE_FULLSCREEN, 0); - } - #ifndef __GP32__ //ph0x FIXME, "quick dirty hack" /* Bind the mixer to the system => mixer will be invoked * automatically when samples need to be generated */ diff --git a/simon/simon.cpp b/simon/simon.cpp index c26f84f689..1330d83177 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -203,7 +203,6 @@ static const GameSpecificSettings simon2dos_settings = { SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst) : Engine(detector, syst), midi (syst) { - OSystem::Property prop; _vc_ptr = 0; _game_offsets_ptr = 0; @@ -498,18 +497,6 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst) // FIXME Use auto dirty rects cleanup code to reduce CPU usage _system->property(OSystem::PROP_WANT_RECT_OPTIM,0); - - // Override global scaler with any game-specific define - if (g_config->get("gfx_mode")) { - prop.gfx_mode = detector->parseGraphicsMode(g_config->get("gfx_mode")); - _system->property(OSystem::PROP_SET_GFX_MODE, &prop); - } - - // Override global scaler with any game-specific define - if (g_config->getBool("fullscreen", false)) { - if (!_system->property(OSystem::PROP_GET_FULLSCREEN, 0)) - _system->property(OSystem::PROP_TOGGLE_FULLSCREEN, 0); - } } SimonEngine::~SimonEngine() { diff --git a/sky/sky.cpp b/sky/sky.cpp index 7c8230f14d..0b8b3acc41 100644 --- a/sky/sky.cpp +++ b/sky/sky.cpp @@ -239,8 +239,6 @@ void SkyState::go() { } void SkyState::initialise(void) { - OSystem::Property prop; - _skyDisk = new SkyDisk(_gameDataPath); _skySound = new SkySound(_mixer, _skyDisk, _detector->_sfx_volume); @@ -257,18 +255,6 @@ void SkyState::initialise(void) { _skyMusic = new SkyGmMusic(_detector->createMidi(), _skyDisk, _system); } - // Override global scaler with any game-specific define - if (g_config->get("gfx_mode")) { - prop.gfx_mode = _detector->parseGraphicsMode(g_config->get("gfx_mode")); - _system->property(OSystem::PROP_SET_GFX_MODE, &prop); - } - - // Override global fullscreen setting with any game-specific define - if (g_config->getBool("fullscreen", false)) { - if (!_system->property(OSystem::PROP_GET_FULLSCREEN, 0)) - _system->property(OSystem::PROP_TOGGLE_FULLSCREEN, 0); - } - if (isCDVersion()) { if (_detector->_noSubtitles) _systemVars.systemFlags |= SF_ALLOW_SPEECH; diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp index 2fbb5409c8..cf11daa697 100644 --- a/sword2/sword2.cpp +++ b/sword2/sword2.cpp @@ -252,7 +252,6 @@ int32 GameCycle(void) { } void Sword2Engine::go() { - OSystem::Property prop; uint32 rv; uint8 breakOut = 0; _keyboardEvent ke; @@ -265,21 +264,9 @@ void Sword2Engine::go() { // manager until a window has been created as any errors are displayed // via a window, thus time becomes a loop. - // Override global scaler with any game-specific define - if (g_config->get("gfx_mode")) { - prop.gfx_mode = _detector->parseGraphicsMode(g_config->get("gfx_mode")); - _system->property(OSystem::PROP_SET_GFX_MODE, &prop); - } - debug(5, "CALLING: InitialiseDisplay"); rv = InitialiseDisplay(640, 480); - // Override global fullscreen setting with any game-specific define - if (g_config->getBool("fullscreen", false)) { - if (!_system->property(OSystem::PROP_GET_FULLSCREEN, 0)) - _system->property(OSystem::PROP_TOGGLE_FULLSCREEN, 0); - } - if (rv != RD_OK) { // ReportDriverError(rv); CloseAppWindow(); |