2007-05-30 21:56:52 +00:00
|
|
|
/* 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.
|
2005-04-05 15:07:40 +00:00
|
|
|
*
|
|
|
|
* 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
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2005-04-05 15:07:40 +00:00
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2005-04-09 19:19:54 +00:00
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-04-05 15:07:40 +00:00
|
|
|
*
|
2006-02-11 10:11:37 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2005-04-05 15:07:40 +00:00
|
|
|
*
|
|
|
|
*/
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2006-11-19 17:52:52 +00:00
|
|
|
#include "common/endian.h"
|
2008-10-06 12:48:52 +00:00
|
|
|
#include "common/events.h"
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
#include "base/plugins.h"
|
2006-02-17 08:44:16 +00:00
|
|
|
#include "common/config-manager.h"
|
2005-05-06 17:04:33 +00:00
|
|
|
#include "common/md5.h"
|
2007-03-20 14:51:57 +00:00
|
|
|
#include "sound/mididrv.h"
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
#include "gob/gob.h"
|
|
|
|
#include "gob/global.h"
|
2007-03-20 14:51:57 +00:00
|
|
|
#include "gob/util.h"
|
|
|
|
#include "gob/dataio.h"
|
2005-04-05 15:07:40 +00:00
|
|
|
#include "gob/game.h"
|
2008-05-08 00:47:23 +00:00
|
|
|
#include "gob/sound/sound.h"
|
2005-04-05 15:07:40 +00:00
|
|
|
#include "gob/init.h"
|
2006-01-03 23:14:39 +00:00
|
|
|
#include "gob/inter.h"
|
|
|
|
#include "gob/draw.h"
|
|
|
|
#include "gob/goblin.h"
|
|
|
|
#include "gob/map.h"
|
|
|
|
#include "gob/mult.h"
|
|
|
|
#include "gob/palanim.h"
|
|
|
|
#include "gob/parse.h"
|
|
|
|
#include "gob/scenery.h"
|
2007-07-30 15:53:38 +00:00
|
|
|
#include "gob/videoplayer.h"
|
2009-05-31 02:15:43 +00:00
|
|
|
#include "gob/save/saveload.h"
|
2006-11-27 14:19:30 +00:00
|
|
|
|
2006-02-18 00:36:45 +00:00
|
|
|
namespace Gob {
|
|
|
|
|
2006-01-05 16:06:55 +00:00
|
|
|
#define MAX_TIME_DELTA 100
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
const Common::Language GobEngine::_gobToScummVMLang[] = {
|
|
|
|
Common::FR_FRA,
|
|
|
|
Common::DE_DEU,
|
|
|
|
Common::EN_GRB,
|
|
|
|
Common::ES_ESP,
|
|
|
|
Common::IT_ITA,
|
|
|
|
Common::EN_USA,
|
|
|
|
Common::NL_NLD,
|
|
|
|
Common::KO_KOR,
|
2008-08-30 23:59:46 +00:00
|
|
|
Common::HB_ISR,
|
|
|
|
Common::PT_BRA,
|
|
|
|
Common::JA_JPN
|
2007-03-20 14:51:57 +00:00
|
|
|
};
|
|
|
|
|
2007-01-30 02:17:46 +00:00
|
|
|
GobEngine::GobEngine(OSystem *syst) : Engine(syst) {
|
2008-05-08 00:47:23 +00:00
|
|
|
_sound = 0; _mult = 0; _game = 0;
|
|
|
|
_global = 0; _dataIO = 0; _goblin = 0;
|
|
|
|
_vidPlayer = 0; _init = 0; _inter = 0;
|
|
|
|
_map = 0; _palAnim = 0; _parse = 0;
|
|
|
|
_scenery = 0; _draw = 0; _util = 0;
|
|
|
|
_video = 0; _saveLoad = 0;
|
2007-07-24 23:24:40 +00:00
|
|
|
|
2008-05-23 20:40:28 +00:00
|
|
|
_pauseStart = 0;
|
|
|
|
|
2006-01-05 16:06:55 +00:00
|
|
|
// Setup mixer
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
|
|
|
|
|
2006-01-14 09:57:20 +00:00
|
|
|
_copyProtection = ConfMan.getBool("copy_protection");
|
2006-02-24 23:31:31 +00:00
|
|
|
|
2009-01-30 05:10:24 +00:00
|
|
|
Common::addDebugChannel(kDebugFuncOp, "FuncOpcodes", "Script FuncOpcodes debug level");
|
|
|
|
Common::addDebugChannel(kDebugDrawOp, "DrawOpcodes", "Script DrawOpcodes debug level");
|
|
|
|
Common::addDebugChannel(kDebugGobOp, "GoblinOpcodes", "Script GoblinOpcodes debug level");
|
|
|
|
Common::addDebugChannel(kDebugSound, "Sound", "Sound output debug level");
|
|
|
|
Common::addDebugChannel(kDebugParser, "Parser", "Parser debug level");
|
|
|
|
Common::addDebugChannel(kDebugGameFlow, "Gameflow", "Gameflow debug level");
|
|
|
|
Common::addDebugChannel(kDebugFileIO, "FileIO", "File Input/Output debug level");
|
|
|
|
Common::addDebugChannel(kDebugSaveLoad, "SaveLoad", "Saving/Loading debug level");
|
|
|
|
Common::addDebugChannel(kDebugGraphics, "Graphics", "Graphics debug level");
|
|
|
|
Common::addDebugChannel(kDebugVideo, "Video", "IMD/VMD video debug level");
|
|
|
|
Common::addDebugChannel(kDebugCollisions, "Collisions", "Collisions debug level");
|
2009-04-24 22:29:17 +00:00
|
|
|
Common::addDebugChannel(kDebugDemo, "Demo", "Demo script debug level");
|
2007-09-19 13:55:05 +00:00
|
|
|
|
|
|
|
syst->getEventManager()->registerRandomSource(_rnd, "gob");
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GobEngine::~GobEngine() {
|
2008-05-13 15:40:29 +00:00
|
|
|
deinitGameParts();
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2008-05-08 00:47:23 +00:00
|
|
|
const char *GobEngine::getLangDesc(int16 language) const {
|
2008-08-30 23:59:46 +00:00
|
|
|
if ((language < 0) || (language > 10))
|
2008-05-08 00:47:23 +00:00
|
|
|
language = 2;
|
|
|
|
return Common::getLanguageDescription(_gobToScummVMLang[language]);
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void GobEngine::validateLanguage() {
|
2009-05-31 22:29:50 +00:00
|
|
|
if (_global->_languageWanted != _global->_language) {
|
2007-07-27 16:23:06 +00:00
|
|
|
warning("Your game version doesn't support the requested language %s",
|
2009-05-31 22:29:50 +00:00
|
|
|
getLangDesc(_global->_languageWanted));
|
2007-07-27 16:23:06 +00:00
|
|
|
|
2009-05-31 22:29:50 +00:00
|
|
|
if (((_global->_languageWanted == 2) && (_global->_language == 5)) ||
|
|
|
|
((_global->_languageWanted == 5) && (_global->_language == 2)))
|
|
|
|
warning("Using %s instead", getLangDesc(_global->_language));
|
2007-07-27 16:23:06 +00:00
|
|
|
else
|
|
|
|
warning("Using the first language available: %s",
|
2009-05-31 22:29:50 +00:00
|
|
|
getLangDesc(_global->_language));
|
2007-07-27 16:23:06 +00:00
|
|
|
|
2009-05-31 22:29:50 +00:00
|
|
|
_global->_languageWanted = _global->_language;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void GobEngine::validateVideoMode(int16 videoMode) {
|
2007-08-03 15:18:00 +00:00
|
|
|
if ((videoMode != 0x10) && (videoMode != 0x13) &&
|
|
|
|
(videoMode != 0x14) && (videoMode != 0x18))
|
2009-05-31 10:02:16 +00:00
|
|
|
error("Video mode 0x%X is not supported", videoMode);
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2008-07-23 02:41:02 +00:00
|
|
|
Endianness GobEngine::getEndianness() const {
|
2009-05-31 22:29:50 +00:00
|
|
|
if ((getPlatform() == Common::kPlatformAmiga) ||
|
|
|
|
(getPlatform() == Common::kPlatformMacintosh) ||
|
|
|
|
(getPlatform() == Common::kPlatformAtariST))
|
2008-07-23 02:41:02 +00:00
|
|
|
return kEndiannessBE;
|
|
|
|
|
|
|
|
return kEndiannessLE;
|
|
|
|
}
|
|
|
|
|
2008-05-08 00:47:23 +00:00
|
|
|
Common::Platform GobEngine::getPlatform() const {
|
|
|
|
return _platform;
|
|
|
|
}
|
|
|
|
|
|
|
|
GameType GobEngine::getGameType() const {
|
|
|
|
return _gameType;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GobEngine::isCD() const {
|
|
|
|
return (_features & kFeaturesCD) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GobEngine::isEGA() const {
|
|
|
|
return (_features & kFeaturesEGA) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GobEngine::is640() const {
|
|
|
|
return (_features & kFeatures640) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GobEngine::hasAdlib() const {
|
|
|
|
return (_features & kFeaturesAdlib) != 0;
|
|
|
|
}
|
|
|
|
|
2009-04-24 18:23:17 +00:00
|
|
|
bool GobEngine::isSCNDemo() const {
|
|
|
|
return (_features & kFeaturesSCNDemo) != 0;
|
|
|
|
}
|
|
|
|
|
2009-04-24 22:29:17 +00:00
|
|
|
bool GobEngine::isBATDemo() const {
|
|
|
|
return (_features & kFeaturesBATDemo) != 0;
|
|
|
|
}
|
|
|
|
|
2009-05-20 23:13:44 +00:00
|
|
|
bool GobEngine::isDemo() const {
|
|
|
|
return (isSCNDemo() || isBATDemo());
|
|
|
|
}
|
|
|
|
|
2009-03-01 04:42:46 +00:00
|
|
|
Common::Error GobEngine::run() {
|
2007-07-24 23:24:40 +00:00
|
|
|
if (!initGameParts()) {
|
|
|
|
GUIErrorMessage("GobEngine::init(): Unknown version of game engine");
|
2008-11-06 17:05:54 +00:00
|
|
|
return Common::kUnknownError;
|
2007-07-24 23:24:40 +00:00
|
|
|
}
|
2007-02-17 09:56:09 +00:00
|
|
|
|
2008-05-03 20:08:46 +00:00
|
|
|
_video->setSize(is640());
|
2009-05-31 16:59:45 +00:00
|
|
|
_video->init();
|
2005-04-19 08:29:43 +00:00
|
|
|
|
2005-11-01 11:18:50 +00:00
|
|
|
// On some systems it's not safe to run CD audio games from the CD.
|
2007-07-24 23:24:40 +00:00
|
|
|
if (isCD())
|
2005-11-01 11:18:50 +00:00
|
|
|
checkCD();
|
|
|
|
|
2005-04-22 08:39:51 +00:00
|
|
|
int cd_num = ConfMan.getInt("cdrom");
|
|
|
|
if (cd_num >= 0)
|
|
|
|
_system->openCD(cd_num);
|
|
|
|
|
2006-01-04 01:48:15 +00:00
|
|
|
_global->_debugFlag = 1;
|
2007-03-20 14:51:57 +00:00
|
|
|
_video->_doRangeClamp = true;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2007-02-12 19:30:52 +00:00
|
|
|
// WORKAROUND: Some versions check the video mode to detect the system
|
|
|
|
if (_platform == Common::kPlatformAmiga)
|
|
|
|
_global->_fakeVideoMode = 0x11;
|
|
|
|
else if (_platform == Common::kPlatformAtariST)
|
|
|
|
_global->_fakeVideoMode = 0x10;
|
|
|
|
else
|
|
|
|
_global->_fakeVideoMode = 0x13;
|
2007-02-12 12:53:28 +00:00
|
|
|
|
2006-01-04 01:48:15 +00:00
|
|
|
_global->_videoMode = 0x13;
|
|
|
|
_global->_useMouse = 1;
|
2007-01-30 22:19:55 +00:00
|
|
|
_global->_soundFlags = MIDI_FLAG | SPEAKER_FLAG | BLASTER_FLAG | ADLIB_FLAG;
|
2005-04-26 06:29:53 +00:00
|
|
|
|
2006-04-18 12:39:02 +00:00
|
|
|
if (ConfMan.hasKey("language"))
|
|
|
|
_language = Common::parseLanguage(ConfMan.get("language"));
|
|
|
|
|
|
|
|
switch (_language) {
|
2005-04-26 06:29:53 +00:00
|
|
|
case Common::FR_FRA:
|
2006-04-18 12:39:02 +00:00
|
|
|
case Common::RU_RUS:
|
2006-01-04 01:48:15 +00:00
|
|
|
_global->_language = 0;
|
2005-04-26 06:29:53 +00:00
|
|
|
break;
|
|
|
|
case Common::DE_DEU:
|
2006-01-04 01:48:15 +00:00
|
|
|
_global->_language = 1;
|
2005-04-26 06:29:53 +00:00
|
|
|
break;
|
2007-02-01 21:59:51 +00:00
|
|
|
case Common::EN_ANY:
|
2006-04-18 12:39:02 +00:00
|
|
|
case Common::EN_GRB:
|
|
|
|
_global->_language = 2;
|
|
|
|
break;
|
2005-04-26 06:29:53 +00:00
|
|
|
case Common::ES_ESP:
|
2006-01-04 01:48:15 +00:00
|
|
|
_global->_language = 3;
|
2005-04-26 06:29:53 +00:00
|
|
|
break;
|
|
|
|
case Common::IT_ITA:
|
2006-01-04 01:48:15 +00:00
|
|
|
_global->_language = 4;
|
2005-04-26 06:29:53 +00:00
|
|
|
break;
|
2006-04-18 12:39:02 +00:00
|
|
|
case Common::EN_USA:
|
|
|
|
_global->_language = 5;
|
|
|
|
break;
|
|
|
|
case Common::NL_NLD:
|
|
|
|
_global->_language = 6;
|
|
|
|
break;
|
|
|
|
case Common::KO_KOR:
|
|
|
|
_global->_language = 7;
|
|
|
|
break;
|
|
|
|
case Common::HB_ISR:
|
|
|
|
_global->_language = 8;
|
|
|
|
break;
|
2008-08-30 23:59:46 +00:00
|
|
|
case Common::PT_BRA:
|
|
|
|
_global->_language = 9;
|
|
|
|
break;
|
|
|
|
case Common::JA_JPN:
|
|
|
|
_global->_language = 10;
|
|
|
|
break;
|
2005-04-26 06:29:53 +00:00
|
|
|
default:
|
|
|
|
// Default to English
|
2006-01-04 01:48:15 +00:00
|
|
|
_global->_language = 2;
|
2005-04-26 06:29:53 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-02-12 14:37:27 +00:00
|
|
|
_global->_languageWanted = _global->_language;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2009-04-21 21:44:37 +00:00
|
|
|
_init->initGame();
|
2009-03-01 04:42:46 +00:00
|
|
|
|
2008-11-06 17:05:54 +00:00
|
|
|
return Common::kNoError;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2008-05-23 20:40:28 +00:00
|
|
|
void GobEngine::pauseEngineIntern(bool pause) {
|
|
|
|
if (pause) {
|
|
|
|
_pauseStart = _system->getMillis();
|
|
|
|
} else {
|
|
|
|
uint32 duration = _system->getMillis() - _pauseStart;
|
|
|
|
|
2009-05-31 22:29:50 +00:00
|
|
|
_vidPlayer->notifyPaused(duration);
|
|
|
|
_util->notifyPaused(duration);
|
2008-05-23 20:40:28 +00:00
|
|
|
|
2009-05-31 22:29:50 +00:00
|
|
|
_game->_startTimeKey += duration;
|
|
|
|
_draw->_cursorTimeKey += duration;
|
|
|
|
if (_inter->_soundEndTimeKey != 0)
|
|
|
|
_inter->_soundEndTimeKey += duration;
|
2008-05-23 20:40:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_mixer->pauseAll(pause);
|
|
|
|
}
|
|
|
|
|
2007-07-24 23:24:40 +00:00
|
|
|
bool GobEngine::initGameParts() {
|
2008-05-08 00:47:23 +00:00
|
|
|
_noMusic = MidiDriver::parseMusicDriver(ConfMan.get("music_driver")) == MD_NULL;
|
|
|
|
|
2007-07-24 23:24:40 +00:00
|
|
|
_saveLoad = 0;
|
|
|
|
|
|
|
|
_global = new Global(this);
|
|
|
|
_util = new Util(this);
|
|
|
|
_dataIO = new DataIO(this);
|
|
|
|
_palAnim = new PalAnim(this);
|
2007-07-30 15:53:38 +00:00
|
|
|
_vidPlayer = new VideoPlayer(this);
|
2008-05-08 00:47:23 +00:00
|
|
|
_sound = new Sound(this);
|
2007-07-24 23:24:40 +00:00
|
|
|
|
|
|
|
switch (_gameType) {
|
2009-04-21 21:44:37 +00:00
|
|
|
case kGameTypeGeisha:
|
2009-04-29 16:36:08 +00:00
|
|
|
case kGameTypeAdibouUnknown:
|
2009-04-21 21:44:37 +00:00
|
|
|
case kGameTypeGob1:
|
|
|
|
_init = new Init_v1(this);
|
|
|
|
_video = new Video_v1(this);
|
|
|
|
_inter = new Inter_v1(this);
|
|
|
|
_parse = new Parse_v1(this);
|
|
|
|
_mult = new Mult_v1(this);
|
|
|
|
_draw = new Draw_v1(this);
|
|
|
|
_game = new Game_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);
|
|
|
|
_parse = new Parse_v1(this);
|
|
|
|
_mult = new Mult_v2(this);
|
|
|
|
_draw = new Draw_v2(this);
|
2009-04-29 16:36:08 +00:00
|
|
|
_game = new Game_Fascination(this);
|
2009-04-21 21:44:37 +00:00
|
|
|
_map = new Map_v2(this);
|
|
|
|
_goblin = new Goblin_v2(this);
|
|
|
|
_scenery = new Scenery_v2(this);
|
|
|
|
_saveLoad = new SaveLoad_v2(this, _targetName.c_str());
|
|
|
|
break;
|
|
|
|
|
2009-04-29 16:36:08 +00:00
|
|
|
case kGameTypeWeen:
|
2009-04-21 21:44:37 +00:00
|
|
|
case kGameTypeGob2:
|
|
|
|
_init = new Init_v2(this);
|
|
|
|
_video = new Video_v2(this);
|
|
|
|
_inter = new Inter_v2(this);
|
|
|
|
_parse = new Parse_v2(this);
|
|
|
|
_mult = new Mult_v2(this);
|
|
|
|
_draw = new Draw_v2(this);
|
|
|
|
_game = new Game_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);
|
|
|
|
_parse = new Parse_v2(this);
|
|
|
|
_mult = new Mult_v2(this);
|
|
|
|
_draw = new Draw_Bargon(this);
|
|
|
|
_game = new Game_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 kGameTypeGob3:
|
|
|
|
case kGameTypeInca2:
|
|
|
|
_init = new Init_v3(this);
|
|
|
|
_video = new Video_v2(this);
|
|
|
|
_inter = new Inter_v3(this);
|
|
|
|
_parse = new Parse_v2(this);
|
|
|
|
_mult = new Mult_v2(this);
|
|
|
|
_draw = new Draw_v2(this);
|
|
|
|
_game = new Game_v2(this);
|
|
|
|
_map = new Map_v2(this);
|
|
|
|
_goblin = new Goblin_v3(this);
|
|
|
|
_scenery = new Scenery_v2(this);
|
2009-05-31 02:15:43 +00:00
|
|
|
_saveLoad = new SaveLoad_v3(this, _targetName.c_str(), SaveLoad_v3::kScreenshotTypeGob3);
|
2009-04-21 21:44:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case kGameTypeLostInTime:
|
|
|
|
_init = new Init_v3(this);
|
|
|
|
_video = new Video_v2(this);
|
|
|
|
_inter = new Inter_v3(this);
|
|
|
|
_parse = new Parse_v2(this);
|
|
|
|
_mult = new Mult_v2(this);
|
|
|
|
_draw = new Draw_v2(this);
|
|
|
|
_game = new Game_v2(this);
|
|
|
|
_map = new Map_v2(this);
|
|
|
|
_goblin = new Goblin_v3(this);
|
|
|
|
_scenery = new Scenery_v2(this);
|
2009-05-31 02:15:43 +00:00
|
|
|
_saveLoad = new SaveLoad_v3(this, _targetName.c_str(), SaveLoad_v3::kScreenshotTypeLost);
|
2009-04-21 21:44:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case kGameTypeWoodruff:
|
|
|
|
_init = new Init_v3(this);
|
|
|
|
_video = new Video_v2(this);
|
|
|
|
_inter = new Inter_v4(this);
|
|
|
|
_parse = new Parse_v2(this);
|
|
|
|
_mult = new Mult_v2(this);
|
|
|
|
_draw = new Draw_v2(this);
|
|
|
|
_game = new Game_v2(this);
|
|
|
|
_map = new Map_v4(this);
|
|
|
|
_goblin = new Goblin_v4(this);
|
|
|
|
_scenery = new Scenery_v2(this);
|
|
|
|
_saveLoad = new SaveLoad_v4(this, _targetName.c_str());
|
|
|
|
break;
|
|
|
|
|
2009-05-29 14:42:34 +00:00
|
|
|
case kGameTypePlaytoon:
|
|
|
|
case kGameTypePlaytnCk:
|
|
|
|
case kGameTypeBambou:
|
2009-04-21 21:44:37 +00:00
|
|
|
case kGameTypeDynasty:
|
|
|
|
_init = new Init_v3(this);
|
|
|
|
_video = new Video_v2(this);
|
|
|
|
_inter = new Inter_v5(this);
|
|
|
|
_parse = new Parse_v2(this);
|
|
|
|
_mult = new Mult_v2(this);
|
|
|
|
_draw = new Draw_v2(this);
|
|
|
|
_game = new Game_v2(this);
|
|
|
|
_map = new Map_v4(this);
|
|
|
|
_goblin = new Goblin_v4(this);
|
|
|
|
_scenery = new Scenery_v2(this);
|
2009-05-31 16:59:45 +00:00
|
|
|
_saveLoad = new SaveLoad(this);
|
2009-04-21 21:44:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case kGameTypeAdibou4:
|
|
|
|
case kGameTypeUrban:
|
|
|
|
_init = new Init_v3(this);
|
|
|
|
_video = new Video_v6(this);
|
|
|
|
_inter = new Inter_v6(this);
|
|
|
|
_parse = new Parse_v2(this);
|
|
|
|
_mult = new Mult_v2(this);
|
|
|
|
_draw = new Draw_v2(this);
|
|
|
|
_game = new Game_v6(this);
|
|
|
|
_map = new Map_v4(this);
|
|
|
|
_goblin = new Goblin_v4(this);
|
|
|
|
_scenery = new Scenery_v2(this);
|
|
|
|
_saveLoad = new SaveLoad_v6(this, _targetName.c_str());
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
deinitGameParts();
|
|
|
|
return false;
|
|
|
|
break;
|
2007-07-24 23:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (is640()) {
|
|
|
|
_video->_surfWidth = _width = 640;
|
|
|
|
_video->_surfHeight = _video->_splitHeight1 = _height = 480;
|
2008-05-03 20:08:46 +00:00
|
|
|
_global->_mouseMaxX = 640;
|
|
|
|
_global->_mouseMaxY = 480;
|
2007-07-24 23:24:40 +00:00
|
|
|
_mode = 0x18;
|
|
|
|
_global->_primarySurfDesc = new SurfaceDesc(0x18, 640, 480);
|
|
|
|
} else {
|
|
|
|
_video->_surfWidth = _width = 320;
|
|
|
|
_video->_surfHeight = _video->_splitHeight1 = _height = 200;
|
2008-05-03 20:08:46 +00:00
|
|
|
_global->_mouseMaxX = 320;
|
|
|
|
_global->_mouseMaxY = 200;
|
2007-07-24 23:24:40 +00:00
|
|
|
_mode = 0x14;
|
|
|
|
_global->_primarySurfDesc = new SurfaceDesc(0x14, 320, 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GobEngine::deinitGameParts() {
|
2008-05-08 18:39:13 +00:00
|
|
|
delete _saveLoad; _saveLoad = 0;
|
2007-07-24 23:24:40 +00:00
|
|
|
delete _mult; _mult = 0;
|
2008-05-08 18:39:13 +00:00
|
|
|
delete _vidPlayer; _vidPlayer = 0;
|
2007-07-24 23:24:40 +00:00
|
|
|
delete _game; _game = 0;
|
|
|
|
delete _global; _global = 0;
|
|
|
|
delete _goblin; _goblin = 0;
|
|
|
|
delete _init; _init = 0;
|
|
|
|
delete _inter; _inter = 0;
|
|
|
|
delete _map; _map = 0;
|
|
|
|
delete _palAnim; _palAnim = 0;
|
|
|
|
delete _parse; _parse = 0;
|
|
|
|
delete _scenery; _scenery = 0;
|
|
|
|
delete _draw; _draw = 0;
|
|
|
|
delete _util; _util = 0;
|
|
|
|
delete _video; _video = 0;
|
2008-05-08 00:47:23 +00:00
|
|
|
delete _sound; _sound = 0;
|
2008-05-08 18:39:13 +00:00
|
|
|
delete _dataIO; _dataIO = 0;
|
2007-07-24 23:24:40 +00:00
|
|
|
}
|
|
|
|
|
2005-04-05 15:07:40 +00:00
|
|
|
} // End of namespace Gob
|