From 7e11c18fa2dfa8d4b6d6916b02af84043151a6d2 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 5 Jul 2009 11:29:54 +0000 Subject: Putting the Urban noCD check into Init_v6::initGame() svn-id: r42130 --- engines/gob/game.cpp | 2 -- engines/gob/game.h | 6 +----- engines/gob/game_v6.cpp | 11 ----------- engines/gob/global.cpp | 2 ++ engines/gob/global.h | 2 ++ engines/gob/gob.cpp | 2 +- engines/gob/init.h | 10 +++++++++- engines/gob/init_v6.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ engines/gob/inter_v6.cpp | 2 +- engines/gob/module.mk | 1 + 10 files changed, 65 insertions(+), 21 deletions(-) create mode 100644 engines/gob/init_v6.cpp (limited to 'engines') diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 731a76e712..d201019d08 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -186,8 +186,6 @@ Game::Game(GobEngine *vm) : _vm(vm) { _preventScroll = false; _scrollHandleMouse = false; - _noCd = false; - _tempStr[0] = 0; _numEnvironments = 0; diff --git a/engines/gob/game.h b/engines/gob/game.h index 4a8008a504..dc6db1ed98 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -84,15 +84,13 @@ public: bool _preventScroll; bool _scrollHandleMouse; - bool _noCd; - byte _handleMouse; char _forceHandleMouse; Game(GobEngine *vm); virtual ~Game(); - virtual void prepareStart(); + void prepareStart(); void playTot(int16 skipPlay); @@ -145,8 +143,6 @@ class Game_v6 : public Game_v2 { public: Game_v6(GobEngine *vm); virtual ~Game_v6() {} - - virtual void prepareStart(); }; } // End of namespace Gob diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index 814b973ed9..e5bed75725 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -42,15 +42,4 @@ namespace Gob { Game_v6::Game_v6(GobEngine *vm) : Game_v2(vm) { } -void Game_v6::prepareStart() { - _noCd = false; - - if (Common::File::exists("cd1.itk") && Common::File::exists("cd2.itk") && - Common::File::exists("cd3.itk") && Common::File::exists("cd4.itk")) { - _noCd = true; - } - - Game::prepareStart(); -} - } // End of namespace Gob diff --git a/engines/gob/global.cpp b/engines/gob/global.cpp index 4165938966..2969ed0870 100644 --- a/engines/gob/global.cpp +++ b/engines/gob/global.cpp @@ -123,6 +123,8 @@ Global::Global(GobEngine *vm) : _vm(vm) { _inter_mouseY = 0; _speedFactor = 1; + + _noCd = false; } Global::~Global() { diff --git a/engines/gob/global.h b/engines/gob/global.h index 982ce113cb..7849490107 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 _noCd; + Global(GobEngine *vm); ~Global(); diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 9e1dfb0738..0835979289 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -445,7 +445,7 @@ bool GobEngine::initGameParts() { case kGameTypeAdibou4: case kGameTypeUrban: - _init = new Init_v3(this); + _init = new Init_v6(this); _video = new Video_v6(this); _inter = new Inter_v6(this); _mult = new Mult_v2(this); diff --git a/engines/gob/init.h b/engines/gob/init.h index a8d4b9833e..60642d0189 100644 --- a/engines/gob/init.h +++ b/engines/gob/init.h @@ -32,7 +32,7 @@ namespace Gob { class Init { public: - void initGame(); + virtual void initGame(); virtual void initVideo() = 0; @@ -72,6 +72,14 @@ public: virtual ~Init_v3() {} }; +class Init_v6 : public Init_v3 { +public: + virtual void initGame(); + + Init_v6(GobEngine *vm); + virtual ~Init_v6() {} +}; + } // End of namespace Gob #endif // GOB_INIT_H diff --git a/engines/gob/init_v6.cpp b/engines/gob/init_v6.cpp new file mode 100644 index 0000000000..4b14c8a29c --- /dev/null +++ b/engines/gob/init_v6.cpp @@ -0,0 +1,48 @@ +/* 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 "gob/gob.h" +#include "gob/init.h" +#include "gob/global.h" + +namespace Gob { + +Init_v6::Init_v6(GobEngine *vm) : Init_v3(vm) { +} + +void Init_v6::initGame() { + _vm->_global->_noCd = false; + + if (Common::File::exists("cd1.itk") && Common::File::exists("cd2.itk") && + Common::File::exists("cd3.itk") && Common::File::exists("cd4.itk")) { + _vm->_global->_noCd = true; + } + + Init::initGame(); +} + +} // End of namespace Gob diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index b366d39d0d..3c71b3cd91 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -189,7 +189,7 @@ void Inter_v6::o6_openItk() { // (it checks CD1.ITK - CD4.ITK and the first that's found determines // the CD number), while its NO_CD modus wants everything in CD1.ITK. // So we just open the other ITKs, too. - if (_vm->_game->_noCd && !scumm_stricmp(fileName, "CD1.ITK")) { + if (_vm->_global->_noCd && !scumm_stricmp(fileName, "CD1.ITK")) { _vm->_dataIO->openDataFile("CD2.ITK", true); _vm->_dataIO->openDataFile("CD3.ITK", true); _vm->_dataIO->openDataFile("CD4.ITK", true); diff --git a/engines/gob/module.mk b/engines/gob/module.mk index 33d8f642b4..80a4218514 100644 --- a/engines/gob/module.mk +++ b/engines/gob/module.mk @@ -26,6 +26,7 @@ MODULE_OBJS := \ init_v1.o \ init_v2.o \ init_v3.o \ + init_v6.o \ inter.o \ inter_v1.o \ inter_v2.o \ -- cgit v1.2.3