diff options
| author | Eugene Sandulenko | 2004-11-24 00:14:21 +0000 |
|---|---|---|
| committer | Eugene Sandulenko | 2004-11-24 00:14:21 +0000 |
| commit | 31e434dcf1e46510606efa3025c24c17ace379c6 (patch) | |
| tree | addc1c7b6b9b2489eb9aca49e21ee0c729671adb /base | |
| parent | 6414ec92a2a3509946ae4ec35a3a77e76ad152df (diff) | |
| download | scummvm-rg350-31e434dcf1e46510606efa3025c24c17ace379c6.tar.gz scummvm-rg350-31e434dcf1e46510606efa3025c24c17ace379c6.tar.bz2 scummvm-rg350-31e434dcf1e46510606efa3025c24c17ace379c6.zip | |
Fix a`ll engines. They work, though current fix is just temporary.
There are plans to add some brains to GameDetector class, which will let us
avoid passing detector to init() method.
svn-id: r15873
Diffstat (limited to 'base')
| -rw-r--r-- | base/engine.cpp | 25 | ||||
| -rw-r--r-- | base/engine.h | 5 | ||||
| -rw-r--r-- | base/main.cpp | 31 |
3 files changed, 30 insertions, 31 deletions
diff --git a/base/engine.cpp b/base/engine.cpp index 252b9d752b..7cdbc7c663 100644 --- a/base/engine.cpp +++ b/base/engine.cpp @@ -23,10 +23,10 @@ #include <malloc.h> #endif #include "base/engine.h" -#include "base/gameDetector.h" #include "common/config-manager.h" #include "common/file.h" #include "common/timer.h" +#include "common/scaler.h" // For GFX_NORMAL #include "sound/mixer.h" /* FIXME - BIG HACK for MidiEmu */ @@ -58,6 +58,29 @@ Engine::~Engine() { g_engine = NULL; } +void Engine::initCommonGFX(GameDetector &detector) { + const bool useDefaultGraphicsMode = + !ConfMan.hasKey("gfx_mode", detector._targetName) || + !scumm_stricmp(ConfMan.get("gfx_mode", detector._targetName).c_str(), "normal") || + !scumm_stricmp(ConfMan.get("gfx_mode", detector._targetName).c_str(), "default"); + + // See if the game should default to 1x scaler + if (useDefaultGraphicsMode && (detector._game.features & GF_DEFAULT_TO_1X_SCALER)) { + _system->setGraphicsMode(GFX_NORMAL); + } else { + // Override global scaler with any game-specific define + if (ConfMan.hasKey("gfx_mode")) { + _system->setGraphicsMode(ConfMan.get("gfx_mode").c_str()); + } + } + + // (De)activate aspect-ratio correction as determined by the config settings + _system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio")); + + // (De)activate fullscreen mode as determined by the config settings + _system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); +} + const char *Engine::getSavePath() const { #if defined(__PALM_OS__) diff --git a/base/engine.h b/base/engine.h index 3774c52ac8..47bf5d5b02 100644 --- a/base/engine.h +++ b/base/engine.h @@ -24,6 +24,7 @@ #include "common/scummsys.h" #include "common/str.h" #include "common/system.h" +#include "base/gameDetector.h" class SoundMixer; class Timer; @@ -46,7 +47,7 @@ public: * Init the engine. * @return 0 for success, else an error code. */ - virtual int init() = 0; + virtual int init(GameDetector &detector) = 0; /** * Start the main engine loop. @@ -64,6 +65,8 @@ public: /** Specific for each engine: prepare error string. */ virtual void errorString(const char *buf_input, char *buf_output) = 0; + + void initCommonGFX(GameDetector &detector); }; extern Engine *g_engine; diff --git a/base/main.cpp b/base/main.cpp index 695df68546..3abb77bc94 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -35,7 +35,6 @@ #include "base/version.h" #include "common/config-manager.h" #include "common/file.h" -#include "common/scaler.h" // For GFX_NORMAL #include "common/timer.h" #include "gui/newgui.h" #include "gui/launcher.h" @@ -247,11 +246,6 @@ static int runGame(GameDetector &detector, OSystem *system) { system->setWindowCaption(caption.c_str()); } - const bool useDefaultGraphicsMode = - !ConfMan.hasKey("gfx_mode", detector._targetName) || - !scumm_stricmp(ConfMan.get("gfx_mode", detector._targetName).c_str(), "normal") || - !scumm_stricmp(ConfMan.get("gfx_mode", detector._targetName).c_str(), "default"); - // Create the game engine Engine *engine = detector.createEngine(system); assert(engine); @@ -265,29 +259,8 @@ static int runGame(GameDetector &detector, OSystem *system) { int result; - // Start GFX transaction - system->beginGFXTransaction(); - - // See if the game should default to 1x scaler - if (useDefaultGraphicsMode && (detector._game.features & GF_DEFAULT_TO_1X_SCALER)) { - system->setGraphicsMode(GFX_NORMAL); - } else { - // Override global scaler with any game-specific define - if (ConfMan.hasKey("gfx_mode")) { - system->setGraphicsMode(ConfMan.get("gfx_mode").c_str()); - } - } - - // (De)activate aspect-ratio correction as determined by the config settings - system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio")); - - // (De)activate fullscreen mode as determined by the config settings - system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen")); - - // Init the engine (this might change the screen parameters - result = engine->init(); - - system->endGFXTransaction(); + // Init the engine (this might change the screen parameters + result = engine->init(detector); // Run the game engine if the initialization was successful. if (result == 0) { |
