From 9d7111006dcdbbe0465b95d5c5adb2c5affe790c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 8 Mar 2009 15:39:19 +0000 Subject: - Reworked the different file types a bit - Some initial work on Dinotopia's intro sequence svn-id: r39234 --- engines/saga/detection_tables.h | 33 +++++++-- engines/saga/interface.cpp | 30 +++++++-- engines/saga/introproc_fta2.cpp | 119 -------------------------------- engines/saga/introproc_saga2.cpp | 142 +++++++++++++++++++++++++++++++++++++++ engines/saga/module.mk | 2 +- engines/saga/music.cpp | 2 +- engines/saga/resource.cpp | 13 ++-- engines/saga/saga.cpp | 6 ++ engines/saga/saga.h | 28 ++++---- engines/saga/scene.cpp | 2 +- engines/saga/scene.h | 1 + 11 files changed, 230 insertions(+), 148 deletions(-) delete mode 100644 engines/saga/introproc_fta2.cpp create mode 100644 engines/saga/introproc_saga2.cpp diff --git a/engines/saga/detection_tables.h b/engines/saga/detection_tables.h index d52ab34ff0..aa2a2871dd 100644 --- a/engines/saga/detection_tables.h +++ b/engines/saga/detection_tables.h @@ -784,8 +784,31 @@ static const SAGAGameDescription gameDescriptions[] = { #ifdef ENABLE_SAGA2 // Dinotopia Section ////////////////////////////////////////////////////////////////////////////////////// - - // TODO + { + { + "dino", + "", + { + {"dino.hrs", GAME_RESOURCEFILE, "7cf3665887a4a18e2fff6938a954c050", 66018}, + {"scripts.hrs", GAME_SCRIPTFILE, "d405841a249a365cf92fc65dd52fb953", 164181}, + {"dinosnd.hrs", GAME_SOUNDFILE | GAME_VOICEFILE, "dcf4ade416614b8a64f99dacfd3bd071", 199163997}, + {"dinoimag.hrs", GAME_IMAGEFILE, "d24d80676f7afcfaca0b61c95056044f", 42342931}, + // TODO: dinodata.hrs + { NULL, 0, NULL, 0} + }, + Common::EN_ANY, + Common::kPlatformPC, + ADGF_NO_FLAGS + }, + GID_DINO, + 0, + // TODO: fill out the data below + -1, // default scene + NULL, // game resources + 0, // number of fonts + NULL, // font array + NULL, + }, // Faery Tale Adventure II: Halls of the Dead Section ///////////////////////////////////////////////////// @@ -795,11 +818,11 @@ static const SAGAGameDescription gameDescriptions[] = { "fta2", "", { - // TODO: this is still quite incomplete - {"fta.hrs", GAME_RESOURCEFILE, "c34a5ee5f1a14a87712a35c4a209a033", 213376}, - {"scripts.hrs", GAME_SCRIPTFILE, "95f33928f6c4f02ee04d2ec5c3314c30", 1041948}, + {"fta.hrs", GAME_RESOURCEFILE, "c34a5ee5f1a14a87712a35c4a209a033", 213376}, + {"scripts.hrs", GAME_SCRIPTFILE, "95f33928f6c4f02ee04d2ec5c3314c30", 1041948}, {"ftasound.hrs", GAME_SOUNDFILE, "ce930cb38922e6a03461f55d51b4e165", 12403350}, {"ftaimage.hrs", GAME_IMAGEFILE, "09bb003733b20f924e2e373d2ddcd394", 21127397}, + // TODO: ftadata.hrs { NULL, 0, NULL, 0} }, Common::EN_ANY, diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp index 7a08a0e6c9..ded7faa260 100644 --- a/engines/saga/interface.cpp +++ b/engines/saga/interface.cpp @@ -120,17 +120,42 @@ static const int IHNMTextStringIdsLUT[56] = { 31 // Both }; +#define buttonRes0 0x42544E00 +#define buttonRes1 0x42544E01 + Interface::Interface(SagaEngine *vm) : _vm(vm) { byte *resource; size_t resourceLength; int i; +#if 0 + // FTA2 related test code + + // TODO: this will probably have to be moved to a new class + // It's left here for now till the code differences are figured out + if (_vm->getGameId() == GID_FTA2) { + _interfaceContext = _vm->_resource->getContext(GAME_IMAGEFILE); + _vm->_resource->loadResource(_interfaceContext, 22, resource, resourceLength); // Julian's portrait + + _vm->decodeBGImage(resource, resourceLength, &_mainPanel.image, + &_mainPanel.imageLength, &_mainPanel.imageWidth, &_mainPanel.imageHeight); + + free(resource); + return; + } +#endif + // Load interface module resource file context _interfaceContext = _vm->_resource->getContext(GAME_RESOURCEFILE); if (_interfaceContext == NULL) { error("Interface::Interface() resource context not found"); } + // Do nothing for SAGA2 games for now + if (_vm->isSaga2()) { + return; + } + // Main panel _mainPanel.buttons = _vm->getDisplayInfo().mainPanelButtons; _mainPanel.buttonsCount = _vm->getDisplayInfo().mainPanelButtonsCount; @@ -139,11 +164,6 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) { _verbTypeToPanelButton[i] = NULL; } - // Do nothing for SAGA2 games for now - if (_vm->isSaga2()) { - return; - } - for (i = 0; i < _mainPanel.buttonsCount; i++) { if (_mainPanel.buttons[i].type == kPanelButtonVerb) { _verbTypeToPanelButton[_mainPanel.buttons[i].id] = &_mainPanel.buttons[i]; diff --git a/engines/saga/introproc_fta2.cpp b/engines/saga/introproc_fta2.cpp deleted file mode 100644 index f8c61a8568..0000000000 --- a/engines/saga/introproc_fta2.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* 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$ - * - */ - -#ifdef ENABLE_SAGA2 - -// "Faery Tale Adventure II: Halls of the Dead" Intro sequence scene procedures - -#include "saga/saga.h" -#include "saga/scene.h" -#include "saga/gfx.h" - -#include "sound/mixer.h" -#include "graphics/surface.h" -#include "graphics/video/smk_player.h" - -#include "common/events.h" -#include "common/system.h" -#include "common/list.h" - -namespace Saga { - -Common::List stopEvents; - -int Scene::FTA2StartProc() { - _vm->_gfx->showCursor(false); - - Common::Event stopEvent; - stopEvents.clear(); - stopEvent.type = Common::EVENT_KEYDOWN; - stopEvent.kbd = Common::KEYCODE_ESCAPE; - stopEvents.push_back(stopEvent); - - Graphics::SMKPlayer *smkDecoder = new Graphics::SMKPlayer(_vm->_mixer); - Graphics::VideoPlayer *player = new Graphics::VideoPlayer(smkDecoder); - if (smkDecoder->loadFile("trimark.smk")) - player->playVideo(&stopEvents); // Show Ignite logo - smkDecoder->closeFile(); - if (smkDecoder->loadFile("intro.smk")) - player->playVideo(&stopEvents); // Play introduction - smkDecoder->closeFile(); - delete player; - delete smkDecoder; - - // HACK: Forcibly quit here - _vm->quitGame(); - - return SUCCESS; -} - -int Scene::FTA2EndProc(FTA2Endings whichEnding) { - char videoName[20]; - - switch (whichEnding) { - case kFta2BadEndingLaw: - strcpy(videoName, "end_1.smk"); - break; - case kFta2BadEndingChaos: - strcpy(videoName, "end_2.smk"); - break; - case kFta2GoodEnding1: - strcpy(videoName, "end_3a.smk"); - break; - case kFta2GoodEnding2: - strcpy(videoName, "end_3b.smk"); - break; - case kFta2BadEndingDeath: - strcpy(videoName, "end_4.smk"); - break; - default: - error("Unknown FTA2 ending"); - } - - _vm->_gfx->showCursor(false); - - - Common::Event stopEvent; - stopEvents.clear(); - stopEvent.type = Common::EVENT_KEYDOWN; - stopEvent.kbd = Common::KEYCODE_ESCAPE; - stopEvents.push_back(stopEvent); - - // Play ending - Graphics::SMKPlayer *smkDecoder = new Graphics::SMKPlayer(_vm->_mixer); - Graphics::VideoPlayer *player = new Graphics::VideoPlayer(smkDecoder); - if (smkDecoder->loadFile(videoName)) { - player->playVideo(&stopEvents); - smkDecoder->closeFile(); - } - delete player; - delete smkDecoder; - - return SUCCESS; -} - -} // End of namespace Saga - -#endif diff --git a/engines/saga/introproc_saga2.cpp b/engines/saga/introproc_saga2.cpp new file mode 100644 index 0000000000..99e0c2cddd --- /dev/null +++ b/engines/saga/introproc_saga2.cpp @@ -0,0 +1,142 @@ +/* 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$ + * + */ + +#ifdef ENABLE_SAGA2 + +// "Dinotopia" and "Faery Tale Adventure II: Halls of the Dead" Intro sequence scene procedures + +#include "saga/saga.h" +#include "saga/scene.h" +#include "saga/gfx.h" + +#include "sound/mixer.h" +#include "graphics/surface.h" +#include "graphics/video/smk_player.h" + +#include "common/events.h" +#include "common/system.h" +#include "common/list.h" + +namespace Saga { + +Common::List stopEvents; + +int Scene::DinoStartProc() { + _vm->_gfx->showCursor(false); + + Common::Event stopEvent; + stopEvents.clear(); + stopEvent.type = Common::EVENT_KEYDOWN; + stopEvent.kbd = Common::KEYCODE_ESCAPE; + stopEvents.push_back(stopEvent); + + Graphics::SMKPlayer *smkDecoder = new Graphics::SMKPlayer(_vm->_mixer); + Graphics::VideoPlayer *player = new Graphics::VideoPlayer(smkDecoder); + if (smkDecoder->loadFile("testvid.smk")) + player->playVideo(&stopEvents); // Play introduction + smkDecoder->closeFile(); + delete player; + delete smkDecoder; + + // HACK: Forcibly quit here + _vm->quitGame(); + + return SUCCESS; +} + +int Scene::FTA2StartProc() { + _vm->_gfx->showCursor(false); + + Common::Event stopEvent; + stopEvents.clear(); + stopEvent.type = Common::EVENT_KEYDOWN; + stopEvent.kbd = Common::KEYCODE_ESCAPE; + stopEvents.push_back(stopEvent); + + Graphics::SMKPlayer *smkDecoder = new Graphics::SMKPlayer(_vm->_mixer); + Graphics::VideoPlayer *player = new Graphics::VideoPlayer(smkDecoder); + if (smkDecoder->loadFile("trimark.smk")) + player->playVideo(&stopEvents); // Show Ignite logo + smkDecoder->closeFile(); + if (smkDecoder->loadFile("intro.smk")) + player->playVideo(&stopEvents); // Play introduction + smkDecoder->closeFile(); + delete player; + delete smkDecoder; + + // HACK: Forcibly quit here + _vm->quitGame(); + + return SUCCESS; +} + +int Scene::FTA2EndProc(FTA2Endings whichEnding) { + char videoName[20]; + + switch (whichEnding) { + case kFta2BadEndingLaw: + strcpy(videoName, "end_1.smk"); + break; + case kFta2BadEndingChaos: + strcpy(videoName, "end_2.smk"); + break; + case kFta2GoodEnding1: + strcpy(videoName, "end_3a.smk"); + break; + case kFta2GoodEnding2: + strcpy(videoName, "end_3b.smk"); + break; + case kFta2BadEndingDeath: + strcpy(videoName, "end_4.smk"); + break; + default: + error("Unknown FTA2 ending"); + } + + _vm->_gfx->showCursor(false); + + + Common::Event stopEvent; + stopEvents.clear(); + stopEvent.type = Common::EVENT_KEYDOWN; + stopEvent.kbd = Common::KEYCODE_ESCAPE; + stopEvents.push_back(stopEvent); + + // Play ending + Graphics::SMKPlayer *smkDecoder = new Graphics::SMKPlayer(_vm->_mixer); + Graphics::VideoPlayer *player = new Graphics::VideoPlayer(smkDecoder); + if (smkDecoder->loadFile(videoName)) { + player->playVideo(&stopEvents); + smkDecoder->closeFile(); + } + delete player; + delete smkDecoder; + + return SUCCESS; +} + +} // End of namespace Saga + +#endif diff --git a/engines/saga/module.mk b/engines/saga/module.mk index 0c9c219621..c1c29d2a79 100644 --- a/engines/saga/module.mk +++ b/engines/saga/module.mk @@ -43,7 +43,7 @@ endif ifdef ENABLE_SAGA2 MODULE_OBJS += \ - introproc_fta2.o \ + introproc_saga2.o \ resource_hrs.o endif diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index 09d7f8fd2e..27566de2c3 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -351,7 +351,7 @@ Music::Music(SagaEngine *vm, Audio::Mixer *mixer, MidiDriver *driver) : _vm(vm), xmidiParser = MidiParser::createParser_XMIDI(); smfParser = MidiParser::createParser_SMF(); - _digitalMusicContext = _vm->_resource->getContext(GAME_MUSICFILE); + _digitalMusicContext = _vm->_resource->getContext(GAME_DIGITALMUSICFILE); _songTableLen = 0; _songTable = 0; diff --git a/engines/saga/resource.cpp b/engines/saga/resource.cpp index 981238d3a3..6ab4fc878e 100644 --- a/engines/saga/resource.cpp +++ b/engines/saga/resource.cpp @@ -251,6 +251,10 @@ bool Resource::createContexts() { SoundFileInfo sfxFilesFTA2[] = { { "ftasound.hrs", false } }; + + SoundFileInfo sfxFilesDino[] = { + { "dinosnd.hrs", false }, + }; #endif if (!soundFileInArray) { @@ -270,9 +274,8 @@ bool Resource::createContexts() { #endif #ifdef ENABLE_SAGA2 case GID_DINO: - // TODO - curSoundfiles = NULL; - maxFile = 0; + curSoundfiles = sfxFilesDino; + maxFile = 1; break; case GID_FTA2: curSoundfiles = sfxFilesFTA2; @@ -343,11 +346,13 @@ bool Resource::createContexts() { break; #endif #ifdef ENABLE_SAGA2 + /* case GID_DINO: // TODO curSoundfiles = NULL; maxFile = 0; break; + */ case GID_FTA2: curSoundfiles = voiceFilesFTA2; maxFile = 1; @@ -447,7 +452,7 @@ bool Resource::createContexts() { // For ITE, add the digital music file and sfx file information here if (_vm->getGameId() == GID_ITE && digitalMusic && i == _contextsCount - 1) { context->fileName = musicFileName; - context->fileType = GAME_MUSICFILE; + context->fileType = GAME_DIGITALMUSICFILE; context->isCompressed = compressedMusic; } else if (!soundFileInArray && i == soundFileIndex) { context->fileName = soundFileName; diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp index 1fede4b662..4acf93d030 100644 --- a/engines/saga/saga.cpp +++ b/engines/saga/saga.cpp @@ -107,6 +107,12 @@ SagaEngine::SagaEngine(OSystem *syst, const SAGAGameDescription *gameDesc) // Mac CD Wyrmkeep Common::File::addDefaultDirectory(_gameDataDir.getChild("patch")); + // Dinotopia + Common::File::addDefaultDirectory(_gameDataDir.getChild("smack")); + + // FTA2 + Common::File::addDefaultDirectory(_gameDataDir.getChild("video")); + _displayClip.left = _displayClip.top = 0; syst->getEventManager()->registerRandomSource(_rnd, "saga"); } diff --git a/engines/saga/saga.h b/engines/saga/saga.h index f37e4a59f4..946ce69995 100644 --- a/engines/saga/saga.h +++ b/engines/saga/saga.h @@ -99,18 +99,22 @@ enum GameIds { }; enum GameFileTypes { - GAME_IMAGEFILE = 1 << 0, - GAME_RESOURCEFILE = 1 << 1, - GAME_SCRIPTFILE = 1 << 2, - GAME_SOUNDFILE = 1 << 3, - GAME_VOICEFILE = 1 << 4, - GAME_DEMOFILE = 1 << 5, - GAME_MUSICFILE = 1 << 6, - GAME_MUSICFILE_GM = 1 << 7, - GAME_MUSICFILE_FM = 1 << 8, - GAME_PATCHFILE = 1 << 9, - GAME_MACBINARY = 1 << 10, - GAME_SWAPENDIAN = 1 << 11 + // Common + GAME_RESOURCEFILE = 1 << 0, // Game resources + GAME_SCRIPTFILE = 1 << 1, // Game scripts + GAME_SOUNDFILE = 1 << 2, // SFX (also contains voices and MIDI music in SAGA 2 games) + GAME_VOICEFILE = 1 << 3, // Voices (also contains SFX in the ITE floppy version) + // ITE specific + GAME_DIGITALMUSICFILE = 1 << 4, // ITE digital music, added by Wyrmkeep + GAME_MACBINARY = 1 << 5, // ITE Mac CD Guild + GAME_DEMOFILE = 1 << 6, // Early ITE demo + GAME_SWAPENDIAN = 1 << 7, // Used to identify the BE voice file in the ITE combined version + // IHNM specific + GAME_MUSICFILE_FM = 1 << 8, // IHNM + GAME_MUSICFILE_GM = 1 << 9, // IHNM, ITE Mac CD Guild + GAME_PATCHFILE = 1 << 10, // IHNM patch file (patch.re_/patch.res) + // SAGA 2 (Dinotopia, FTA2) + GAME_IMAGEFILE = 1 << 11 }; enum GameFeatures { diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp index b5b9aaa2ea..86500467d0 100644 --- a/engines/saga/scene.cpp +++ b/engines/saga/scene.cpp @@ -297,7 +297,7 @@ void Scene::startScene() { #endif #ifdef ENABLE_SAGA2 case GID_DINO: - // TODO + DinoStartProc(); break; case GID_FTA2: FTA2StartProc(); diff --git a/engines/saga/scene.h b/engines/saga/scene.h index 169af0bb0c..90be245437 100644 --- a/engines/saga/scene.h +++ b/engines/saga/scene.h @@ -422,6 +422,7 @@ class Scene { int ITEStartProc(); int IHNMStartProc(); int IHNMCreditsProc(); + int DinoStartProc(); int FTA2StartProc(); int FTA2EndProc(FTA2Endings whichEnding); -- cgit v1.2.3