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
|
|
|
|
2010-05-04 11:59:22 +00:00
|
|
|
#include "common/debug-channels.h"
|
2006-11-19 17:52:52 +00:00
|
|
|
#include "common/endian.h"
|
2008-10-06 12:48:52 +00:00
|
|
|
#include "common/events.h"
|
2009-07-25 12:59:46 +00:00
|
|
|
#include "common/EventRecorder.h"
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2010-11-08 23:07:42 +00:00
|
|
|
#include "backends/audiocd/audiocd.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"
|
2011-02-09 01:09:01 +00:00
|
|
|
#include "audio/mididrv.h"
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2010-11-16 10:19:01 +00:00
|
|
|
#include "gui/gui-manager.h"
|
2009-12-09 18:15:04 +00:00
|
|
|
#include "gui/dialog.h"
|
2009-06-06 16:47:21 +00:00
|
|
|
#include "gui/widget.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/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,
|
2010-04-12 21:21:06 +00:00
|
|
|
Common::HE_ISR,
|
2008-08-30 23:59:46 +00:00
|
|
|
Common::PT_BRA,
|
|
|
|
Common::JA_JPN
|
2007-03-20 14:51:57 +00:00
|
|
|
};
|
|
|
|
|
2009-06-06 16:47:21 +00:00
|
|
|
|
2009-12-09 18:15:04 +00:00
|
|
|
class PauseDialog : public GUI::Dialog {
|
|
|
|
public:
|
|
|
|
PauseDialog();
|
|
|
|
|
2010-02-03 03:25:50 +00:00
|
|
|
virtual void reflowLayout();
|
2009-12-09 18:15:04 +00:00
|
|
|
virtual void handleKeyDown(Common::KeyState state);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Common::String _message;
|
|
|
|
GUI::StaticTextWidget *_text;
|
|
|
|
};
|
|
|
|
|
2010-02-19 14:16:43 +00:00
|
|
|
PauseDialog::PauseDialog() : GUI::Dialog(0, 0, 0, 0) {
|
2009-06-06 16:47:21 +00:00
|
|
|
_backgroundType = GUI::ThemeEngine::kDialogBackgroundSpecial;
|
|
|
|
|
|
|
|
_message = "Game paused. Press Ctrl+p again to continue.";
|
|
|
|
_text = new GUI::StaticTextWidget(this, 4, 0, 10, 10,
|
|
|
|
_message, Graphics::kTextAlignCenter);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PauseDialog::reflowLayout() {
|
|
|
|
const int screenW = g_system->getOverlayWidth();
|
|
|
|
const int screenH = g_system->getOverlayHeight();
|
|
|
|
|
|
|
|
int width = g_gui.getStringWidth(_message) + 16;
|
|
|
|
int height = g_gui.getFontHeight() + 8;
|
|
|
|
|
|
|
|
_w = width;
|
|
|
|
_h = height;
|
|
|
|
_x = (screenW - width) / 2;
|
|
|
|
_y = (screenH - height) / 2;
|
|
|
|
|
|
|
|
_text->setSize(_w - 8, _h);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PauseDialog::handleKeyDown(Common::KeyState state) {
|
|
|
|
// Close on CTRL+p
|
2010-02-21 04:04:13 +00:00
|
|
|
if ((state.hasFlags(Common::KBD_CTRL)) && (state.keycode == Common::KEYCODE_p))
|
2009-06-06 16:47:21 +00:00
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-30 02:17:46 +00:00
|
|
|
GobEngine::GobEngine(OSystem *syst) : Engine(syst) {
|
2009-06-22 10:29:48 +00:00
|
|
|
_sound = 0; _mult = 0; _game = 0;
|
|
|
|
_global = 0; _dataIO = 0; _goblin = 0;
|
|
|
|
_vidPlayer = 0; _init = 0; _inter = 0;
|
|
|
|
_map = 0; _palAnim = 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
|
2010-07-27 17:14:33 +00:00
|
|
|
bool muteSFX = ConfMan.getBool("mute") || ConfMan.getBool("sfx_mute");
|
|
|
|
bool muteMusic = ConfMan.getBool("mute") || ConfMan.getBool("music_mute");
|
|
|
|
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType,
|
|
|
|
muteSFX ? 0 : ConfMan.getInt("sfx_volume"));
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType,
|
|
|
|
muteMusic ? 0 : ConfMan.getInt("music_volume"));
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2006-01-14 09:57:20 +00:00
|
|
|
_copyProtection = ConfMan.getBool("copy_protection");
|
2006-02-24 23:31:31 +00:00
|
|
|
|
2010-10-13 03:49:54 +00:00
|
|
|
_console = new GobConsole(this);
|
|
|
|
|
2010-04-27 21:40:52 +00:00
|
|
|
DebugMan.addDebugChannel(kDebugFuncOp, "FuncOpcodes", "Script FuncOpcodes debug level");
|
|
|
|
DebugMan.addDebugChannel(kDebugDrawOp, "DrawOpcodes", "Script DrawOpcodes debug level");
|
|
|
|
DebugMan.addDebugChannel(kDebugGobOp, "GoblinOpcodes", "Script GoblinOpcodes debug level");
|
|
|
|
DebugMan.addDebugChannel(kDebugSound, "Sound", "Sound output debug level");
|
|
|
|
DebugMan.addDebugChannel(kDebugExpression, "Expression", "Expression parser debug level");
|
|
|
|
DebugMan.addDebugChannel(kDebugGameFlow, "Gameflow", "Gameflow debug level");
|
|
|
|
DebugMan.addDebugChannel(kDebugFileIO, "FileIO", "File Input/Output debug level");
|
|
|
|
DebugMan.addDebugChannel(kDebugSaveLoad, "SaveLoad", "Saving/Loading debug level");
|
|
|
|
DebugMan.addDebugChannel(kDebugGraphics, "Graphics", "Graphics debug level");
|
|
|
|
DebugMan.addDebugChannel(kDebugVideo, "Video", "IMD/VMD video debug level");
|
|
|
|
DebugMan.addDebugChannel(kDebugHotspots, "Hotspots", "Hotspots debug level");
|
|
|
|
DebugMan.addDebugChannel(kDebugDemo, "Demo", "Demo script debug level");
|
2007-09-19 13:55:05 +00:00
|
|
|
|
2009-07-25 12:59:46 +00:00
|
|
|
g_eventRec.registerRandomSource(_rnd, "gob");
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GobEngine::~GobEngine() {
|
2010-10-13 03:49:54 +00:00
|
|
|
delete _console;
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2010-01-12 21:07:56 +00:00
|
|
|
bool GobEngine::hasAdLib() const {
|
|
|
|
return (_features & kFeaturesAdLib) != 0;
|
2008-05-08 00:47:23 +00:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2010-09-30 12:58:52 +00:00
|
|
|
bool GobEngine::is640x480() const {
|
|
|
|
return (_features & kFeatures640x480) != 0;
|
|
|
|
}
|
|
|
|
|
2009-07-07 17:11:29 +00:00
|
|
|
bool GobEngine::is800x600() const {
|
|
|
|
return (_features & kFeatures800x600) != 0;
|
2009-07-07 12:51:21 +00:00
|
|
|
}
|
|
|
|
|
2010-09-30 12:59:18 +00:00
|
|
|
bool GobEngine::isTrueColor() const {
|
|
|
|
return (_features & kFeaturesTrueColor) != 0;
|
|
|
|
}
|
|
|
|
|
2009-05-20 23:13:44 +00:00
|
|
|
bool GobEngine::isDemo() const {
|
|
|
|
return (isSCNDemo() || isBATDemo());
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:45:51 +00:00
|
|
|
bool GobEngine::isCurrentTot(const Common::String &tot) const {
|
|
|
|
return _game->_curTotFile.equalsIgnoreCase(tot);
|
|
|
|
}
|
|
|
|
|
2010-09-30 13:00:30 +00:00
|
|
|
const Graphics::PixelFormat &GobEngine::getPixelFormat() const {
|
|
|
|
return _pixelFormat;
|
|
|
|
}
|
|
|
|
|
2011-01-16 16:28:47 +00:00
|
|
|
void GobEngine::setTrueColor(bool trueColor) {
|
|
|
|
if (isTrueColor() == trueColor)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_features = (_features & ~kFeaturesTrueColor) | (trueColor ? kFeaturesTrueColor : 0);
|
|
|
|
|
|
|
|
_video->setSize(is640x480());
|
|
|
|
|
|
|
|
_pixelFormat = g_system->getScreenFormat();
|
|
|
|
|
|
|
|
Common::Array<SurfacePtr>::iterator surf;
|
|
|
|
for (surf = _draw->_spritesArray.begin(); surf != _draw->_spritesArray.end(); ++surf)
|
|
|
|
if (*surf)
|
|
|
|
(*surf)->setBPP(_pixelFormat.bytesPerPixel);
|
|
|
|
|
|
|
|
if (_draw->_backSurface)
|
|
|
|
_draw->_backSurface->setBPP(_pixelFormat.bytesPerPixel);
|
|
|
|
if (_draw->_frontSurface)
|
|
|
|
_draw->_frontSurface->setBPP(_pixelFormat.bytesPerPixel);
|
|
|
|
if (_draw->_cursorSprites)
|
|
|
|
_draw->_cursorSprites->setBPP(_pixelFormat.bytesPerPixel);
|
|
|
|
if (_draw->_cursorSpritesBack)
|
|
|
|
_draw->_cursorSpritesBack->setBPP(_pixelFormat.bytesPerPixel);
|
|
|
|
if (_draw->_scummvmCursor)
|
|
|
|
_draw->_scummvmCursor->setBPP(_pixelFormat.bytesPerPixel);
|
|
|
|
SurfacePtr _scummvmCursor;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2010-09-30 12:59:48 +00:00
|
|
|
if (!initGraphics()) {
|
|
|
|
GUIErrorMessage("GobEngine::init(): Failed to set up graphics");
|
|
|
|
return Common::kUnknownError;
|
|
|
|
}
|
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)
|
2010-06-15 04:13:12 +00:00
|
|
|
_system->getAudioCDManager()->openCD(cd_num);
|
2005-04-22 08:39:51 +00:00
|
|
|
|
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:
|
2009-06-24 21:49:37 +00:00
|
|
|
_global->_language = kLanguageFrench;
|
2005-04-26 06:29:53 +00:00
|
|
|
break;
|
|
|
|
case Common::DE_DEU:
|
2009-06-24 21:49:37 +00:00
|
|
|
_global->_language = kLanguageGerman;
|
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:
|
2009-06-23 17:55:27 +00:00
|
|
|
case Common::HU_HUN:
|
2009-06-24 21:49:37 +00:00
|
|
|
_global->_language = kLanguageBritish;
|
2006-04-18 12:39:02 +00:00
|
|
|
break;
|
2005-04-26 06:29:53 +00:00
|
|
|
case Common::ES_ESP:
|
2009-06-24 21:49:37 +00:00
|
|
|
_global->_language = kLanguageSpanish;
|
2005-04-26 06:29:53 +00:00
|
|
|
break;
|
|
|
|
case Common::IT_ITA:
|
2009-06-24 21:49:37 +00:00
|
|
|
_global->_language = kLanguageItalian;
|
2005-04-26 06:29:53 +00:00
|
|
|
break;
|
2006-04-18 12:39:02 +00:00
|
|
|
case Common::EN_USA:
|
2009-06-24 21:49:37 +00:00
|
|
|
_global->_language = kLanguageAmerican;
|
2006-04-18 12:39:02 +00:00
|
|
|
break;
|
|
|
|
case Common::NL_NLD:
|
2009-06-24 21:49:37 +00:00
|
|
|
_global->_language = kLanguageDutch;
|
2006-04-18 12:39:02 +00:00
|
|
|
break;
|
|
|
|
case Common::KO_KOR:
|
2009-06-24 21:49:37 +00:00
|
|
|
_global->_language = kLanguageKorean;
|
2006-04-18 12:39:02 +00:00
|
|
|
break;
|
2010-04-12 21:21:06 +00:00
|
|
|
case Common::HE_ISR:
|
2009-06-24 21:49:37 +00:00
|
|
|
_global->_language = kLanguageHebrew;
|
2006-04-18 12:39:02 +00:00
|
|
|
break;
|
2008-08-30 23:59:46 +00:00
|
|
|
case Common::PT_BRA:
|
2009-06-24 21:49:37 +00:00
|
|
|
_global->_language = kLanguagePortuguese;
|
2008-08-30 23:59:46 +00:00
|
|
|
break;
|
|
|
|
case Common::JA_JPN:
|
2009-06-24 21:49:37 +00:00
|
|
|
_global->_language = kLanguageJapanese;
|
2008-08-30 23:59:46 +00:00
|
|
|
break;
|
2005-04-26 06:29:53 +00:00
|
|
|
default:
|
2009-06-24 21:49:37 +00:00
|
|
|
_global->_language = kLanguageBritish;
|
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
|
|
|
_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
|
|
|
}
|
|
|
|
|
2011-01-23 15:33:30 +00:00
|
|
|
_vidPlayer->pauseAll(pause);
|
2008-05-23 20:40:28 +00:00
|
|
|
_mixer->pauseAll(pause);
|
|
|
|
}
|
|
|
|
|
2009-07-25 16:08:31 +00:00
|
|
|
void GobEngine::syncSoundSettings() {
|
|
|
|
Engine::syncSoundSettings();
|
|
|
|
|
|
|
|
_init->updateConfig();
|
|
|
|
}
|
|
|
|
|
2009-06-06 16:47:21 +00:00
|
|
|
void GobEngine::pauseGame() {
|
|
|
|
pauseEngineIntern(true);
|
|
|
|
|
|
|
|
PauseDialog pauseDialog;
|
|
|
|
|
|
|
|
pauseDialog.runModal();
|
|
|
|
|
|
|
|
pauseEngineIntern(false);
|
|
|
|
}
|
|
|
|
|
2007-07-24 23:24:40 +00:00
|
|
|
bool GobEngine::initGameParts() {
|
2010-06-21 21:36:36 +00:00
|
|
|
// just detect some devices some of which will be always there if the music is not disabled
|
2010-06-25 18:47:52 +00:00
|
|
|
_noMusic = MidiDriver::getMusicType(MidiDriver::detectDevice(MDT_PCSPK | MDT_MIDI | MDT_ADLIB)) == MT_NULL ? true : false;
|
2007-07-24 23:24:40 +00:00
|
|
|
_saveLoad = 0;
|
|
|
|
|
2009-07-25 16:08:31 +00:00
|
|
|
_global = new Global(this);
|
|
|
|
_util = new Util(this);
|
2010-10-31 20:07:14 +00:00
|
|
|
_dataIO = new DataIO();
|
2009-07-25 16:08:31 +00:00
|
|
|
_palAnim = new PalAnim(this);
|
2007-07-30 15:53:38 +00:00
|
|
|
_vidPlayer = new VideoPlayer(this);
|
2009-07-25 16:08:31 +00:00
|
|
|
_sound = new Sound(this);
|
|
|
|
_game = new Game(this);
|
2007-07-24 23:24:40 +00:00
|
|
|
|
|
|
|
switch (_gameType) {
|
2009-04-21 21:44:37 +00:00
|
|
|
case kGameTypeGeisha:
|
|
|
|
case kGameTypeGob1:
|
2009-07-25 16:08:31 +00:00
|
|
|
_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);
|
2009-04-21 21:44:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case kGameTypeFascination:
|
2010-08-17 07:41:15 +00:00
|
|
|
_init = new Init_Fascination(this);
|
2009-07-25 16:08:31 +00:00
|
|
|
_video = new Video_v2(this);
|
|
|
|
_inter = new Inter_Fascination(this);
|
|
|
|
_mult = new Mult_v2(this);
|
2009-09-29 22:43:30 +00:00
|
|
|
_draw = new Draw_Fascination(this);
|
2009-07-25 16:08:31 +00:00
|
|
|
_map = new Map_v2(this);
|
|
|
|
_goblin = new Goblin_v2(this);
|
|
|
|
_scenery = new Scenery_v2(this);
|
2010-02-03 09:32:16 +00:00
|
|
|
_saveLoad = new SaveLoad_Fascination(this, _targetName.c_str());
|
2009-04-21 21:44:37 +00:00
|
|
|
break;
|
|
|
|
|
2009-04-29 16:36:08 +00:00
|
|
|
case kGameTypeWeen:
|
2009-04-21 21:44:37 +00:00
|
|
|
case kGameTypeGob2:
|
2009-07-25 16:08:31 +00:00
|
|
|
_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);
|
2009-04-21 21:44:37 +00:00
|
|
|
_saveLoad = new SaveLoad_v2(this, _targetName.c_str());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kGameTypeBargon:
|
2009-07-25 16:08:31 +00:00
|
|
|
_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);
|
2009-04-21 21:44:37 +00:00
|
|
|
_saveLoad = new SaveLoad_v2(this, _targetName.c_str());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kGameTypeGob3:
|
2009-07-25 16:08:31 +00:00
|
|
|
_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);
|
2011-01-18 11:52:24 +00:00
|
|
|
_saveLoad = new SaveLoad_v3(this, _targetName.c_str(), SaveLoad_v3::kScreenshotTypeGob3);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kGameTypeInca2:
|
|
|
|
_init = new Init_v3(this);
|
|
|
|
_video = new Video_v2(this);
|
|
|
|
_inter = new Inter_Inca2(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);
|
2011-01-18 11:53:21 +00:00
|
|
|
_saveLoad = new SaveLoad_Inca2(this, _targetName.c_str());
|
2009-04-21 21:44:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case kGameTypeLostInTime:
|
2009-07-25 16:08:31 +00:00
|
|
|
_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);
|
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:
|
2009-07-25 16:08:31 +00:00
|
|
|
_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);
|
2009-04-21 21:44:37 +00:00
|
|
|
_saveLoad = new SaveLoad_v4(this, _targetName.c_str());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kGameTypeDynasty:
|
2009-07-25 16:08:31 +00:00
|
|
|
_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);
|
2009-05-31 16:59:45 +00:00
|
|
|
_saveLoad = new SaveLoad(this);
|
2009-04-21 21:44:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case kGameTypeUrban:
|
2009-07-25 16:08:31 +00:00
|
|
|
_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);
|
2009-04-21 21:44:37 +00:00
|
|
|
_saveLoad = new SaveLoad_v6(this, _targetName.c_str());
|
|
|
|
break;
|
|
|
|
|
2009-08-28 18:14:55 +00:00
|
|
|
case kGameTypePlaytoons:
|
2009-07-07 11:58:22 +00:00
|
|
|
case kGameTypeBambou:
|
2009-07-25 16:08:31 +00:00
|
|
|
_init = new Init_v2(this);
|
2009-08-13 09:59:44 +00:00
|
|
|
_video = new Video_v6(this);
|
|
|
|
_inter = new Inter_Playtoons(this);
|
2009-07-25 16:08:31 +00:00
|
|
|
_mult = new Mult_v2(this);
|
2009-09-15 12:15:22 +00:00
|
|
|
_draw = new Draw_Playtoons(this);
|
2009-07-25 16:08:31 +00:00
|
|
|
_map = new Map_v2(this);
|
2009-08-13 09:59:44 +00:00
|
|
|
_goblin = new Goblin_v4(this);
|
2009-07-25 16:08:31 +00:00
|
|
|
_scenery = new Scenery_v2(this);
|
2009-08-13 09:59:44 +00:00
|
|
|
_saveLoad = new SaveLoad_Playtoons(this, _targetName.c_str());
|
2009-07-07 11:58:22 +00:00
|
|
|
break;
|
|
|
|
|
2009-11-16 17:21:18 +00:00
|
|
|
case kGameTypeAdibou2:
|
2009-08-24 21:54:16 +00:00
|
|
|
case kGameTypeAdi2:
|
2011-01-25 02:52:19 +00:00
|
|
|
case kGameTypeAdi4:
|
2011-02-04 15:55:54 +00:00
|
|
|
_init = new Init_v7(this);
|
2009-08-24 21:54:16 +00:00
|
|
|
_video = new Video_v6(this);
|
2011-01-25 00:50:26 +00:00
|
|
|
_inter = new Inter_v7(this);
|
2009-08-24 21:54:16 +00:00
|
|
|
_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);
|
2011-01-25 12:14:31 +00:00
|
|
|
_saveLoad = new SaveLoad_v7(this, _targetName.c_str());
|
2009-08-24 21:54:16 +00:00
|
|
|
break;
|
|
|
|
|
2010-01-22 23:44:43 +00:00
|
|
|
case kGameTypeAdibou1:
|
|
|
|
_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;
|
2009-04-21 21:44:37 +00:00
|
|
|
default:
|
|
|
|
deinitGameParts();
|
|
|
|
return false;
|
2007-07-24 23:24:40 +00:00
|
|
|
}
|
|
|
|
|
2009-06-17 04:16:51 +00:00
|
|
|
_inter->setupOpcodes();
|
|
|
|
|
2007-07-24 23:24:40 +00:00
|
|
|
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 _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
|
|
|
}
|
|
|
|
|
2010-09-30 12:59:48 +00:00
|
|
|
bool GobEngine::initGraphics() {
|
|
|
|
if (is800x600()) {
|
|
|
|
warning("GobEngine::initGraphics(): 800x600 games currently unsupported");
|
|
|
|
return false;
|
|
|
|
} else if (is640x480()) {
|
|
|
|
_width = 640;
|
|
|
|
_height = 480;
|
|
|
|
_mode = 0x18;
|
|
|
|
} else {
|
|
|
|
_width = 320;
|
|
|
|
_height = 200;
|
|
|
|
_mode = 0x14;
|
|
|
|
}
|
|
|
|
|
|
|
|
_video->setSize(is640x480());
|
|
|
|
|
|
|
|
_pixelFormat = g_system->getScreenFormat();
|
|
|
|
|
|
|
|
_video->_surfWidth = _width;
|
|
|
|
_video->_surfHeight = _height;
|
|
|
|
_video->_splitHeight1 = _height;
|
|
|
|
|
|
|
|
_global->_mouseMaxX = _width;
|
|
|
|
_global->_mouseMaxY = _height;
|
|
|
|
|
2010-09-30 13:03:22 +00:00
|
|
|
_global->_primarySurfDesc = SurfacePtr(new Surface(_width, _height, _pixelFormat.bytesPerPixel));
|
2010-09-30 12:59:48 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-04-05 15:07:40 +00:00
|
|
|
} // End of namespace Gob
|