From b956c707f45a52a950f9a78eef04323768e8c560 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sat, 25 Jul 2009 16:08:31 +0000 Subject: Moved the decision whether subtitles should be displayed, so that the broken subtitles in The Last Dynasty aren't shown svn-id: r42767 --- engines/gob/draw_v2.cpp | 2 +- engines/gob/global.cpp | 2 + engines/gob/global.h | 2 + engines/gob/gob.cpp | 183 ++++++++++++++++++++++++------------------------ engines/gob/gob.h | 3 +- engines/gob/init.cpp | 7 ++ engines/gob/init.h | 38 ++++++---- engines/gob/init_v1.cpp | 3 + engines/gob/init_v2.cpp | 3 + engines/gob/init_v3.cpp | 3 + engines/gob/init_v4.cpp | 45 ++++++++++++ engines/gob/init_v6.cpp | 3 + engines/gob/module.mk | 1 + 13 files changed, 187 insertions(+), 108 deletions(-) create mode 100644 engines/gob/init_v4.cpp diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index 5312b9c00a..5c1986289a 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -218,7 +218,7 @@ void Draw_v2::printTotText(int16 id) { bool isSubtitle = (ptr[1] & 0x80) != 0; - if (isSubtitle && !_vm->subtitles()) { + if (isSubtitle && !_vm->_global->_doSubtitles) { delete textItem; return; } diff --git a/engines/gob/global.cpp b/engines/gob/global.cpp index 2969ed0870..f4f1303386 100644 --- a/engines/gob/global.cpp +++ b/engines/gob/global.cpp @@ -124,6 +124,8 @@ Global::Global(GobEngine *vm) : _vm(vm) { _speedFactor = 1; + _doSubtitles = false; + _noCd = false; } diff --git a/engines/gob/global.h b/engines/gob/global.h index 7849490107..5830e3e58c 100644 --- a/engines/gob/global.h +++ b/engines/gob/global.h @@ -141,6 +141,8 @@ public: // Can be 1, 2 or 3 for normal, double and triple speed, respectively uint8 _speedFactor; + bool _doSubtitles; + bool _noCd; Global(GobEngine *vm); diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 98d421a3fb..082345e675 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -214,10 +214,6 @@ bool GobEngine::isDemo() const { return (isSCNDemo() || isBATDemo()); } -bool GobEngine::subtitles() const { - return ConfMan.getBool("subtitles"); -} - Common::Error GobEngine::run() { if (!initGameParts()) { GUIErrorMessage("GobEngine::init(): Unknown version of game engine"); @@ -318,6 +314,12 @@ void GobEngine::pauseEngineIntern(bool pause) { _mixer->pauseAll(pause); } +void GobEngine::syncSoundSettings() { + Engine::syncSoundSettings(); + + _init->updateConfig(); +} + void GobEngine::pauseGame() { pauseEngineIntern(true); @@ -333,139 +335,138 @@ bool GobEngine::initGameParts() { _saveLoad = 0; - _global = new Global(this); - _util = new Util(this); - _dataIO = new DataIO(this); - _palAnim = new PalAnim(this); + _global = new Global(this); + _util = new Util(this); + _dataIO = new DataIO(this); + _palAnim = new PalAnim(this); _vidPlayer = new VideoPlayer(this); - _sound = new Sound(this); - _game = new Game(this); + _sound = new Sound(this); + _game = new Game(this); switch (_gameType) { case kGameTypeGeisha: case kGameTypeAdibouUnknown: case kGameTypeGob1: - _init = new Init_v1(this); - _video = new Video_v1(this); - _inter = new Inter_v1(this); - _mult = new Mult_v1(this); - _draw = new Draw_v1(this); - _map = new Map_v1(this); - _goblin = new Goblin_v1(this); - _scenery = new Scenery_v1(this); + _init = new Init_v1(this); + _video = new Video_v1(this); + _inter = new Inter_v1(this); + _mult = new Mult_v1(this); + _draw = new Draw_v1(this); + _map = new Map_v1(this); + _goblin = new Goblin_v1(this); + _scenery = new Scenery_v1(this); break; case kGameTypeFascination: - _init = new Init_v2(this); - _video = new Video_v2(this); - _inter = new Inter_Fascination(this); - _mult = new Mult_v2(this); - _draw = new Draw_v2(this); - _map = new Map_v2(this); - _goblin = new Goblin_v2(this); - _scenery = new Scenery_v2(this); + _init = new Init_v2(this); + _video = new Video_v2(this); + _inter = new Inter_Fascination(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _map = new Map_v2(this); + _goblin = new Goblin_v2(this); + _scenery = new Scenery_v2(this); _saveLoad = new SaveLoad_v2(this, _targetName.c_str()); break; case kGameTypeWeen: case kGameTypeGob2: - _init = new Init_v2(this); - _video = new Video_v2(this); - _inter = new Inter_v2(this); - _mult = new Mult_v2(this); - _draw = new Draw_v2(this); - _map = new Map_v2(this); - _goblin = new Goblin_v2(this); - _scenery = new Scenery_v2(this); + _init = new Init_v2(this); + _video = new Video_v2(this); + _inter = new Inter_v2(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _map = new Map_v2(this); + _goblin = new Goblin_v2(this); + _scenery = new Scenery_v2(this); _saveLoad = new SaveLoad_v2(this, _targetName.c_str()); break; case kGameTypeBargon: - _init = new Init_v2(this); - _video = new Video_v2(this); - _inter = new Inter_Bargon(this); - _mult = new Mult_v2(this); - _draw = new Draw_Bargon(this); - _map = new Map_v2(this); - _goblin = new Goblin_v2(this); - _scenery = new Scenery_v2(this); + _init = new Init_v2(this); + _video = new Video_v2(this); + _inter = new Inter_Bargon(this); + _mult = new Mult_v2(this); + _draw = new Draw_Bargon(this); + _map = new Map_v2(this); + _goblin = new Goblin_v2(this); + _scenery = new Scenery_v2(this); _saveLoad = new SaveLoad_v2(this, _targetName.c_str()); break; case kGameTypeGob3: case kGameTypeInca2: - _init = new Init_v3(this); - _video = new Video_v2(this); - _inter = new Inter_v3(this); - _mult = new Mult_v2(this); - _draw = new Draw_v2(this); - _map = new Map_v2(this); - _goblin = new Goblin_v3(this); - _scenery = new Scenery_v2(this); + _init = new Init_v3(this); + _video = new Video_v2(this); + _inter = new Inter_v3(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _map = new Map_v2(this); + _goblin = new Goblin_v3(this); + _scenery = new Scenery_v2(this); _saveLoad = new SaveLoad_v3(this, _targetName.c_str(), SaveLoad_v3::kScreenshotTypeGob3); break; case kGameTypeLostInTime: - _init = new Init_v3(this); - _video = new Video_v2(this); - _inter = new Inter_v3(this); - _mult = new Mult_v2(this); - _draw = new Draw_v2(this); - _map = new Map_v2(this); - _goblin = new Goblin_v3(this); - _scenery = new Scenery_v2(this); + _init = new Init_v3(this); + _video = new Video_v2(this); + _inter = new Inter_v3(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _map = new Map_v2(this); + _goblin = new Goblin_v3(this); + _scenery = new Scenery_v2(this); _saveLoad = new SaveLoad_v3(this, _targetName.c_str(), SaveLoad_v3::kScreenshotTypeLost); break; case kGameTypeWoodruff: - _init = new Init_v3(this); - _video = new Video_v2(this); - _inter = new Inter_v4(this); - _mult = new Mult_v2(this); - _draw = new Draw_v2(this); - _map = new Map_v2(this); - _goblin = new Goblin_v4(this); - _scenery = new Scenery_v2(this); + _init = new Init_v4(this); + _video = new Video_v2(this); + _inter = new Inter_v4(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _map = new Map_v2(this); + _goblin = new Goblin_v4(this); + _scenery = new Scenery_v2(this); _saveLoad = new SaveLoad_v4(this, _targetName.c_str()); break; case kGameTypeDynasty: - _init = new Init_v3(this); - _video = new Video_v2(this); - _inter = new Inter_v5(this); - _mult = new Mult_v2(this); - _draw = new Draw_v2(this); - _map = new Map_v2(this); - _goblin = new Goblin_v4(this); - _scenery = new Scenery_v2(this); + _init = new Init_v3(this); + _video = new Video_v2(this); + _inter = new Inter_v5(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _map = new Map_v2(this); + _goblin = new Goblin_v4(this); + _scenery = new Scenery_v2(this); _saveLoad = new SaveLoad(this); break; case kGameTypeAdibou4: case kGameTypeUrban: - _init = new Init_v6(this); - _video = new Video_v6(this); - _inter = new Inter_v6(this); - _mult = new Mult_v2(this); - _draw = new Draw_v2(this); - _map = new Map_v2(this); - _goblin = new Goblin_v4(this); - _scenery = new Scenery_v2(this); + _init = new Init_v6(this); + _video = new Video_v6(this); + _inter = new Inter_v6(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _map = new Map_v2(this); + _goblin = new Goblin_v4(this); + _scenery = new Scenery_v2(this); _saveLoad = new SaveLoad_v6(this, _targetName.c_str()); break; case kGameTypePlaytoon: case kGameTypePlaytnCk: case kGameTypeBambou: - _init = new Init_v2(this); - _video = new Video_v2(this); -// _inter = new Inter_Playtoons(this); - _inter = new Inter_v6(this); - _mult = new Mult_v2(this); - _draw = new Draw_v2(this); - _map = new Map_v2(this); - _goblin = new Goblin_v2(this); - _scenery = new Scenery_v2(this); + _init = new Init_v2(this); + _video = new Video_v2(this); + _inter = new Inter_v6(this); + _mult = new Mult_v2(this); + _draw = new Draw_v2(this); + _map = new Map_v2(this); + _goblin = new Goblin_v2(this); + _scenery = new Scenery_v2(this); _saveLoad = new SaveLoad_Playtoons(this); break; diff --git a/engines/gob/gob.h b/engines/gob/gob.h index 297b6b1b2b..5976924a12 100644 --- a/engines/gob/gob.h +++ b/engines/gob/gob.h @@ -165,6 +165,7 @@ private: virtual Common::Error run(); virtual bool hasFeature(EngineFeature f) const; virtual void pauseEngineIntern(bool pause); + virtual void syncSoundSettings(); bool initGameParts(); void deinitGameParts(); @@ -221,8 +222,6 @@ public: bool is800x600() const; bool isDemo() const; - bool subtitles() const; - GobEngine(OSystem *syst); virtual ~GobEngine(); diff --git a/engines/gob/init.cpp b/engines/gob/init.cpp index faf85a5b41..834e9b8553 100644 --- a/engines/gob/init.cpp +++ b/engines/gob/init.cpp @@ -49,6 +49,9 @@ Init::Init(GobEngine *vm) : _vm(vm) { _palDesc = 0; } +Init::~Init() { +} + void Init::cleanup() { _vm->_video->freeDriver(); _vm->_global->_primarySurfDesc.reset(); @@ -87,6 +90,7 @@ void Init::initGame() { char buffer[128]; initVideo(); + updateConfig(); if (!_vm->isDemo()) { if (_vm->_dataIO->existData(_vm->_startStk.c_str())) @@ -206,4 +210,7 @@ void Init::initGame() { cleanup(); } +void Init::updateConfig() { +} + } // End of namespace Gob diff --git a/engines/gob/init.h b/engines/gob/init.h index 60642d0189..c2784a59ac 100644 --- a/engines/gob/init.h +++ b/engines/gob/init.h @@ -32,12 +32,14 @@ namespace Gob { class Init { public: + Init(GobEngine *vm); + virtual ~Init(); + virtual void initGame(); virtual void initVideo() = 0; - Init(GobEngine *vm); - virtual ~Init() {} + virtual void updateConfig(); protected: Video::PalDesc *_palDesc; @@ -50,34 +52,42 @@ protected: class Init_v1 : public Init { public: - virtual void initVideo(); - Init_v1(GobEngine *vm); - virtual ~Init_v1() {} + ~Init_v1(); + + void initVideo(); }; class Init_v2 : public Init_v1 { public: - virtual void initVideo(); - Init_v2(GobEngine *vm); - virtual ~Init_v2() {} + ~Init_v2(); + + void initVideo(); }; class Init_v3 : public Init_v2 { public: - virtual void initVideo(); - Init_v3(GobEngine *vm); - virtual ~Init_v3() {} + ~Init_v3(); + + void initVideo(); }; -class Init_v6 : public Init_v3 { +class Init_v4 : public Init_v3 { public: - virtual void initGame(); + Init_v4(GobEngine *vm); + ~Init_v4(); + + void updateConfig(); +}; +class Init_v6 : public Init_v3 { +public: Init_v6(GobEngine *vm); - virtual ~Init_v6() {} + ~Init_v6(); + + void initGame(); }; } // End of namespace Gob diff --git a/engines/gob/init_v1.cpp b/engines/gob/init_v1.cpp index e482104ff9..50db774734 100644 --- a/engines/gob/init_v1.cpp +++ b/engines/gob/init_v1.cpp @@ -35,6 +35,9 @@ namespace Gob { Init_v1::Init_v1(GobEngine *vm) : Init(vm) { } +Init_v1::~Init_v1() { +} + void Init_v1::initVideo() { if (_vm->_global->_videoMode) _vm->validateVideoMode(_vm->_global->_videoMode); diff --git a/engines/gob/init_v2.cpp b/engines/gob/init_v2.cpp index 4c65b8102c..f89d5a8cfb 100644 --- a/engines/gob/init_v2.cpp +++ b/engines/gob/init_v2.cpp @@ -36,6 +36,9 @@ namespace Gob { Init_v2::Init_v2(GobEngine *vm) : Init_v1(vm) { } +Init_v2::~Init_v2() { +} + void Init_v2::initVideo() { if (_vm->_global->_videoMode) _vm->validateVideoMode(_vm->_global->_videoMode); diff --git a/engines/gob/init_v3.cpp b/engines/gob/init_v3.cpp index 67304b389a..c96005ed5a 100644 --- a/engines/gob/init_v3.cpp +++ b/engines/gob/init_v3.cpp @@ -34,6 +34,9 @@ namespace Gob { Init_v3::Init_v3(GobEngine *vm) : Init_v2(vm) { } +Init_v3::~Init_v3() { +} + void Init_v3::initVideo() { Init_v2::initVideo(); diff --git a/engines/gob/init_v4.cpp b/engines/gob/init_v4.cpp new file mode 100644 index 0000000000..3bd50a494d --- /dev/null +++ b/engines/gob/init_v4.cpp @@ -0,0 +1,45 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "common/endian.h" +#include "common/config-manager.h" + +#include "gob/gob.h" +#include "gob/init.h" +#include "gob/global.h" + +namespace Gob { + +Init_v4::Init_v4(GobEngine *vm) : Init_v3(vm) { +} + +Init_v4::~Init_v4() { +} + +void Init_v4::updateConfig() { + _vm->_global->_doSubtitles = ConfMan.getBool("subtitles"); +} + +} // End of namespace Gob diff --git a/engines/gob/init_v6.cpp b/engines/gob/init_v6.cpp index 4b14c8a29c..40b4769e78 100644 --- a/engines/gob/init_v6.cpp +++ b/engines/gob/init_v6.cpp @@ -34,6 +34,9 @@ namespace Gob { Init_v6::Init_v6(GobEngine *vm) : Init_v3(vm) { } +Init_v6::~Init_v6() { +} + void Init_v6::initGame() { _vm->_global->_noCd = false; diff --git a/engines/gob/module.mk b/engines/gob/module.mk index c3c2d2e0d0..26cc4e5d27 100644 --- a/engines/gob/module.mk +++ b/engines/gob/module.mk @@ -23,6 +23,7 @@ MODULE_OBJS := \ init_v1.o \ init_v2.o \ init_v3.o \ + init_v4.o \ init_v6.o \ inter.o \ inter_v1.o \ -- cgit v1.2.3