From a5b4fb7f181886ef63bc7982409a7505894ad64d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 12 May 2006 23:57:53 +0000 Subject: - little cleanups - adds kyra3 dummies svn-id: r22425 --- engines/kyra/kyra.h | 18 ++++++++++-- engines/kyra/kyra3.cpp | 68 ++++++++++++++++++++++++++++++++++++++++++++ engines/kyra/module.mk | 1 + engines/kyra/plugin.cpp | 31 +++++++++++++++++++- engines/kyra/resource.cpp | 19 ++++++++++--- engines/kyra/seqplayer.cpp | 4 +++ engines/kyra/sound_adlib.cpp | 1 + engines/kyra/staticres.cpp | 2 +- 8 files changed, 136 insertions(+), 8 deletions(-) create mode 100644 engines/kyra/kyra3.cpp (limited to 'engines') diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h index 3f273257ac..2cfe4b437c 100644 --- a/engines/kyra/kyra.h +++ b/engines/kyra/kyra.h @@ -56,13 +56,14 @@ enum { GF_SPANISH = 1 << 7, GF_ITALIAN = 1 << 8, // other languages here - GF_LNGUNK = 1 << 16, + GF_LNGUNK = 1 << 16, // also used for multi language in kyra3 GF_AMIGA = 1 << 17 // this is no special version flag yet! }; enum { GI_KYRA1 = 0, - GI_KYRA2 = 1 + GI_KYRA2 = 1, + GI_KYRA3 = 2 }; // TODO: this is just the start of makeing the debug output of the kyra engine a bit more useable @@ -1008,6 +1009,19 @@ public: int go(); }; +#ifdef ENABLE_KYRA3 +// maybe overload KyraEngine_v2 later +class KyraEngine_v3 : public KyraEngine { +public: + KyraEngine_v3(OSystem *system); + ~KyraEngine_v3(); + + int setupGameFlags() { return 0; } + + int go(); +}; +#endif + } // End of namespace Kyra #endif diff --git a/engines/kyra/kyra3.cpp b/engines/kyra/kyra3.cpp new file mode 100644 index 0000000000..4ac2810247 --- /dev/null +++ b/engines/kyra/kyra3.cpp @@ -0,0 +1,68 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2006 The ScummVM project + * + * 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 $ + * + */ + +#ifdef ENABLE_KYRA3 +#include "kyra/kyra.h" +#include "kyra/screen.h" +#include "kyra/wsamovie.h" + +#include "common/system.h" + +namespace Kyra { +KyraEngine_v3::KyraEngine_v3(OSystem *system) : KyraEngine(system) { +} + +KyraEngine_v3::~KyraEngine_v3() { +} + +int KyraEngine_v3::go() { + _screen->_curPage = 0; + _screen->clearPage(0); + + byte *pal = new byte[768]; + assert(pal); + memset(pal, 0, sizeof(byte)*768); + + /*Movie *logo = createWSAMovie(); + logo->open("REVENGE.WSA", 1, pal); + + pal[0] = pal[1] = pal[2] = 0; + + _screen->setScreenPalette(pal); + + // XXX + + logo->_x = logo->_y = 0; + logo->_drawPage = 0; + for (int i = 0; i < 64; ++i) { + uint32 nextRun = _system->getMillis() + 3 * _tickLength; + logo->displayFrame(i); + _screen->updateScreen(); + delayUntil(nextRun); + }*/ + + delete [] pal; + + return 0; +} +} +#endif // ENABLE_KYRA3 diff --git a/engines/kyra/module.mk b/engines/kyra/module.mk index 055e754942..b80399a806 100644 --- a/engines/kyra/module.mk +++ b/engines/kyra/module.mk @@ -6,6 +6,7 @@ MODULE_OBJS := \ gui.o \ items.o \ kyra.o \ + kyra3.o \ plugin.o \ resource.o \ saveload.o \ diff --git a/engines/kyra/plugin.cpp b/engines/kyra/plugin.cpp index 2941adfe5a..4d35f6ced0 100644 --- a/engines/kyra/plugin.cpp +++ b/engines/kyra/plugin.cpp @@ -94,13 +94,21 @@ const GameSettings kyra2_games[] = { { 0, 0, 0, 0, 0, 0 } }; +const GameSettings kyra3_games[] = { +#ifdef ENABLE_KYRA3 + { "kyra3", "The Legend of Kyrandia: Book Three", + GI_KYRA3, GF_LNGUNK, "3833ff312757b8e6147f464cca0a6587", "ONETIME.PAK" }, +#endif + { 0, 0, 0, 0, 0, 0 } +}; + // Keep list of different supported games const PlainGameDescriptor kyra_list[] = { { "kyra1", "The Legend of Kyrandia" }, #ifdef ENABLE_KYRA2 { "kyra2", "The Hand of Fate" }, #endif -#if 0 +#ifdef ENABLE_KYRA3 { "kyra3", "The Legend of Kyrandia: Book Three" }, #endif { 0, 0 } @@ -196,6 +204,14 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) { isFound = true; } + if (isFound) + break; + + for (g = kyra3_games; g->gameid; g++) { + if (scumm_stricmp(file->displayName().c_str(), g->checkFile) == 0) + isFound = true; + } + if (isFound) break; } @@ -229,6 +245,15 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) { detectedGames.push_back(dg); } } + + for (g = kyra3_games; g->gameid; g++) { + if (strcmp(g->md5sum, (char *)md5str) == 0) { + DetectedGame dg(*g, convertKyraLang(g->features), convertKyraPlatform(g->features)); + dg.updateDesc(getKyraVersion(g->features)); + + detectedGames.push_back(dg); + } + } if (detectedGames.empty()) { printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); @@ -251,6 +276,10 @@ PluginError Engine_KYRA_create(OSystem *syst, Engine **engine) { *engine = new KyraEngine_v1(syst); } else if (!scumm_stricmp("kyra2", gameid)) { *engine = new KyraEngine_v2(syst); +#ifdef ENABLE_KYRA3 + } else if (!scumm_stricmp("kyra3", gameid)) { + *engine = new KyraEngine_v3(syst); +#endif } else error("Kyra engine created with invalid gameid."); diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index 84dcf39efa..90fbdcf5a3 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -111,6 +111,12 @@ Resource::Resource(KyraEngine *engine) { "COST2_SH.PAK", "DINOC.PAK", "FOOT.PAK", "INJAIL.PAK", "MISC_CPS.PAK", "PHONE_A.PAK", "SKY.PAK", "VOC.PAK", "VOLC_K.PAK", 0 }; + + static const char *kyra3Filelist[] = { + // enough for now + "ONETIME.PAK", 0 + }; + const char **usedFilelist = 0; if (_engine->game() == GI_KYRA1) { @@ -120,8 +126,11 @@ Resource::Resource(KyraEngine *engine) { usedFilelist = kyra1Filelist; else if (_engine->features() & GF_TALKIE) usedFilelist = kyra1CDFilelist; - } else { + } else if (_engine->game() == GI_KYRA2) { + // TODO: add kyra2 floppy file list usedFilelist = kyra2CDFilelist; + } else if (_engine->game() == GI_KYRA3) { + usedFilelist = kyra3Filelist; } if (!usedFilelist) @@ -143,9 +152,11 @@ Resource::Resource(KyraEngine *engine) { } } - // we're loading KYRA.DAT here too - if (!loadPakFile("KYRA.DAT")) { - error("couldn't open Kyrandia resource file ('KYRA.DAT') make sure you got one file for your version"); + // we're loading KYRA.DAT here too (but just for Kyrandia 1) + if (_engine->game() == GI_KYRA1) { + if (!loadPakFile("KYRA.DAT")) { + error("couldn't open Kyrandia resource file ('KYRA.DAT') make sure you got one file for your version"); + } } } diff --git a/engines/kyra/seqplayer.cpp b/engines/kyra/seqplayer.cpp index 57cc2a173b..a7e206a998 100644 --- a/engines/kyra/seqplayer.cpp +++ b/engines/kyra/seqplayer.cpp @@ -51,12 +51,16 @@ SeqPlayer::SeqPlayer(KyraEngine* vm, OSystem* system) { for (int i = 0; i < ARRAYSIZE(_handShapes); ++i) _handShapes[i] = 0; + for (int i = 0; i < ARRAYSIZE(_seqMovies); ++i) + _seqMovies[i].movie = 0; } SeqPlayer::~SeqPlayer() { freeHandShapes(); for (int i = 0; i < ARRAYSIZE(_seqMovies); ++i) { + if (!_seqMovies[i].movie) + continue; _seqMovies[i].movie->close(); delete _seqMovies[i].movie; _seqMovies[i].movie = 0; diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index f870c668b8..aa5bbde0ee 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -396,6 +396,7 @@ AdlibDriver::AdlibDriver(Audio::Mixer *mixer) { _vibratoAndAMDepthBits = _curRegOffset = 0; _lastProcessed = _flagTrigger = _curChannel = _rhythmSectionBits = 0; + _soundsPlaying = 0; _rnd = 0x1234; _tempo = 0; diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index ffaf97a602..b710222dd8 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -140,7 +140,7 @@ bool StaticResource::init() { if (_engine->game() == GI_KYRA1) { _builtIn = 0; _filenameTable = kyra1StaticRes; - } else if (_engine->game() == GI_KYRA2) { + } else if (_engine->game() == GI_KYRA2 || _engine->game() == GI_KYRA3) { return true; } else { error("unknown game ID"); -- cgit v1.2.3