From 2be8db90ee8b8f427c1e3483b79b187e67183eb6 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 Sep 2011 05:23:42 +0300 Subject: AGI: Fixed bug #3196882 - "KQ3: PCSpeaker affects render mode" --- engines/agi/agi.cpp | 33 ++++++++++++++++----------------- engines/agi/agi.h | 2 ++ engines/agi/preagi.cpp | 16 +--------------- 3 files changed, 19 insertions(+), 32 deletions(-) diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 49b43356ea..4ed606c3ba 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -525,6 +525,21 @@ AgiBase::~AgiBase() { } } +void AgiBase::initRenderMode() { + _renderMode = Common::kRenderEGA; + + if (ConfMan.hasKey("platform")) { + Common::Platform platform = Common::parsePlatform(ConfMan.get("platform")); + _renderMode = (platform == Common::kPlatformAmiga) ? Common::kRenderAmiga : Common::kRenderEGA; + } + + if (ConfMan.hasKey("render_mode")) { + Common::RenderMode tmpMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str()); + if (tmpMode != Common::kRenderDefault) + _renderMode = tmpMode; + } +} + AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBase(syst, gameDesc) { // Setup mixer @@ -620,23 +635,7 @@ void AgiEngine::initialize() { } } - if (ConfMan.hasKey("render_mode")) { - _renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str()); - } else if (ConfMan.hasKey("platform")) { - switch (Common::parsePlatform(ConfMan.get("platform"))) { - case Common::kPlatformAmiga: - _renderMode = Common::kRenderAmiga; - break; - case Common::kPlatformPC: - _renderMode = Common::kRenderEGA; - break; - default: - _renderMode = Common::kRenderEGA; - break; - } - } else { - _renderMode = Common::kRenderDefault; - } + initRenderMode(); _buttonStyle = AgiButtonStyle(_renderMode); _defaultButtonStyle = AgiButtonStyle(); diff --git a/engines/agi/agi.h b/engines/agi/agi.h index d82bc58c76..07729b6ca1 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -776,6 +776,8 @@ protected: virtual void initialize() = 0; + void initRenderMode(); + public: GfxMgr *_gfx; diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp index 8d407ecd00..0b5afc7f8c 100644 --- a/engines/agi/preagi.cpp +++ b/engines/agi/preagi.cpp @@ -54,21 +54,7 @@ PreAgiEngine::PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : } void PreAgiEngine::initialize() { - if (ConfMan.hasKey("render_mode")) { - _renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str()); - } else if (ConfMan.hasKey("platform")) { - switch (Common::parsePlatform(ConfMan.get("platform"))) { - case Common::kPlatformAmiga: - _renderMode = Common::kRenderAmiga; - break; - case Common::kPlatformPC: - _renderMode = Common::kRenderEGA; - break; - default: - _renderMode = Common::kRenderEGA; - break; - } - } + initRenderMode(); _gfx = new GfxMgr(this); _picture = new PictureMgr(this, _gfx); -- cgit v1.2.3