diff options
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/detection.cpp | 285 | ||||
-rw-r--r-- | engines/kyra/gui_lok.cpp | 7 | ||||
-rw-r--r-- | engines/kyra/gui_lok.h | 2 | ||||
-rw-r--r-- | engines/kyra/gui_v2.cpp | 1 | ||||
-rw-r--r-- | engines/kyra/gui_v2.h | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_hof.cpp | 48 | ||||
-rw-r--r-- | engines/kyra/kyra_hof.h | 27 | ||||
-rw-r--r-- | engines/kyra/kyra_lok.h | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_mr.cpp | 10 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.cpp | 12 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.h | 16 | ||||
-rw-r--r-- | engines/kyra/lol.cpp | 10 | ||||
-rw-r--r-- | engines/kyra/resource.cpp | 154 | ||||
-rw-r--r-- | engines/kyra/saveload.cpp | 15 | ||||
-rw-r--r-- | engines/kyra/scene_mr.cpp | 3 | ||||
-rw-r--r-- | engines/kyra/screen.cpp | 9 | ||||
-rw-r--r-- | engines/kyra/script_tim.cpp | 10 | ||||
-rw-r--r-- | engines/kyra/sequences_hof.cpp | 226 | ||||
-rw-r--r-- | engines/kyra/sound.cpp | 17 | ||||
-rw-r--r-- | engines/kyra/sound.h | 20 | ||||
-rw-r--r-- | engines/kyra/sound_adlib.cpp | 20 | ||||
-rw-r--r-- | engines/kyra/sound_towns.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 171 |
23 files changed, 843 insertions, 226 deletions
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index 2d592069d2..0c6eb29665 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -56,6 +56,7 @@ namespace { #define KYRA2_FLOPPY_FLAGS FLAGS(false, false, false, false, false, false, Kyra::GI_KYRA2) #define KYRA2_FLOPPY_CMP_FLAGS FLAGS(false, false, false, false, false, true, Kyra::GI_KYRA2) #define KYRA2_CD_FLAGS FLAGS(false, false, true, false, false, false, Kyra::GI_KYRA2) +#define KYRA2_CD_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, true, false, false, false, Kyra::GI_KYRA2) #define KYRA2_CD_DEMO_FLAGS FLAGS(true, false, true, false, false, false, Kyra::GI_KYRA2) #define KYRA2_DEMO_FLAGS FLAGS(true, false, false, false, false, false, Kyra::GI_KYRA2) #define KYRA2_TOWNS_FLAGS FLAGS(false, false, false, false, false, false, Kyra::GI_KYRA2) @@ -66,8 +67,14 @@ namespace { #define KYRA3_CD_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, true, false, true, false, Kyra::GI_KYRA3) #define LOL_CD_FLAGS FLAGS(false, false, true, false, false, false, Kyra::GI_LOL) +#define LOL_FLOPPY_FLAGS FLAGS(false, false, false, false, false, false, Kyra::GI_LOL) +#define LOL_FLOPPY_CMP_FLAGS FLAGS(false, false, false, false, false, true, Kyra::GI_LOL) +#define LOL_PC98_FLAGS FLAGS(false, false, false, false, false, false, Kyra::GI_LOL) +#define LOL_PC98_SJIS_FLAGS FLAGS(false, false, false, true, false, false, Kyra::GI_LOL) +#define LOL_DEMO_FLAGS FLAGS(true, false, false, false, false, false, Kyra::GI_KYRA2) const KYRAGameDescription adGameDescs[] = { + /* disable these targets until they get supported { { "kyra1", @@ -79,6 +86,7 @@ const KYRAGameDescription adGameDescs[] = { }, KYRA1_FLOPPY_CMP_FLAGS }, + { { "kyra1", @@ -90,6 +98,8 @@ const KYRAGameDescription adGameDescs[] = { }, KYRA1_FLOPPY_CMP_FLAGS }, + */ + { { "kyra1", @@ -210,7 +220,7 @@ const KYRAGameDescription adGameDescs[] = { { // FM-Towns version { "kyra1", - 0, + "CD", { { "EMC.PAK", 0, "a046bb0b422061aab8e4c4689400343a", -1 }, { "TWMUSIC.PAK", 0, "e53bca3a3e3fb49107d59463ec387a59", -1 }, @@ -218,14 +228,14 @@ const KYRAGameDescription adGameDescs[] = { }, Common::EN_ANY, Common::kPlatformFMTowns, - Common::ADGF_NO_FLAGS + Common::ADGF_CD }, KYRA1_TOWNS_FLAGS }, { { "kyra1", - 0, + "CD", { { "JMC.PAK", 0, "9c5707a2a478e8167e44283246612d2c", -1 }, { "TWMUSIC.PAK", 0, "e53bca3a3e3fb49107d59463ec387a59", -1 }, @@ -233,7 +243,7 @@ const KYRAGameDescription adGameDescs[] = { }, Common::JA_JPN, Common::kPlatformFMTowns, - Common::ADGF_NO_FLAGS + Common::ADGF_CD }, KYRA1_TOWNS_SJIS_FLAGS }, @@ -421,6 +431,77 @@ const KYRAGameDescription adGameDescs[] = { KYRA2_CD_FLAGS }, + // Italian fan translation, see fr#2003504 "KYRA: add support for Italian version of Kyrandia 2&3" + { // CD version + { + "kyra2", + "CD", + AD_ENTRY1("FATE.PAK", "30487f3b8d7790c7857f4769ff2dd125"), + Common::IT_ITA, + Common::kPlatformPC, + Common::ADGF_DROPLANGUAGE | Common::ADGF_CD + }, + KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY) + }, + { + { + "kyra2", + "CD", + AD_ENTRY1("FATE.PAK", "30487f3b8d7790c7857f4769ff2dd125"), + Common::DE_DEU, + Common::kPlatformPC, + Common::ADGF_DROPLANGUAGE | Common::ADGF_CD + }, + KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY) + }, + { + { + "kyra2", + "CD", + AD_ENTRY1("FATE.PAK", "30487f3b8d7790c7857f4769ff2dd125"), + Common::FR_FRA, + Common::kPlatformPC, + Common::ADGF_DROPLANGUAGE | Common::ADGF_CD + }, + KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY) + }, + + { + { + "kyra2", + "CD", + AD_ENTRY1("FATE.PAK", "39772ff82e42c4c520050518deb82e64"), + Common::IT_ITA, + Common::kPlatformPC, + Common::ADGF_DROPLANGUAGE | Common::ADGF_CD + }, + KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY) + }, + + { + { + "kyra2", + "CD", + AD_ENTRY1("FATE.PAK", "39772ff82e42c4c520050518deb82e64"), + Common::DE_DEU, + Common::kPlatformPC, + Common::ADGF_DROPLANGUAGE | Common::ADGF_CD + }, + KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY) + }, + + { + { + "kyra2", + "CD", + AD_ENTRY1("FATE.PAK", "39772ff82e42c4c520050518deb82e64"), + Common::FR_FRA, + Common::kPlatformPC, + Common::ADGF_DROPLANGUAGE | Common::ADGF_CD + }, + KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY) + }, + { // Interactive Demo { "kyra2", @@ -457,11 +538,11 @@ const KYRAGameDescription adGameDescs[] = { KYRA2_CD_DEMO_FLAGS }, - { // Non-Interactive Demo + { // Non-Interactive Demos { "kyra2", "Demo", - AD_ENTRY1("GENERAL.PAK", "35825783e5b60755fd520360079f9c15"), + AD_ENTRY1("VOC.PAK", "ecb3561b63749158172bf21528cf5f45"), Common::EN_ANY, Common::kPlatformPC, Common::ADGF_DEMO @@ -472,44 +553,44 @@ const KYRAGameDescription adGameDescs[] = { { // FM-Towns { "kyra2", - 0, + "CD", AD_ENTRY1("WSCORE.PAK", "c44de1302b67f27d4707409987b7a685"), Common::EN_ANY, Common::kPlatformFMTowns, - Common::ADGF_NO_FLAGS + Common::ADGF_CD }, KYRA2_TOWNS_FLAGS }, { { "kyra2", - 0, + "CD", AD_ENTRY1("WSCORE.PAK", "c44de1302b67f27d4707409987b7a685"), Common::JA_JPN, Common::kPlatformFMTowns, - Common::ADGF_NO_FLAGS + Common::ADGF_CD }, KYRA2_TOWNS_SJIS_FLAGS }, { // PC-9821 { "kyra2", - 0, + "CD", AD_ENTRY1("WSCORE.PAK", "c44de1302b67f27d4707409987b7a685"), Common::EN_ANY, Common::kPlatformPC98, - Common::ADGF_NO_FLAGS + Common::ADGF_CD }, KYRA2_TOWNS_FLAGS }, { { "kyra2", - 0, + "CD", AD_ENTRY1("WSCORE.PAK", "c44de1302b67f27d4707409987b7a685"), Common::JA_JPN, Common::kPlatformPC98, - Common::ADGF_NO_FLAGS + Common::ADGF_CD }, KYRA2_TOWNS_SJIS_FLAGS }, @@ -610,6 +691,53 @@ const KYRAGameDescription adGameDescs[] = { KYRA3_CD_INS_FLAGS }, + // Mac version + { + { + "kyra3", + 0, + { + { "ONETIME.PAK", 0, "3833ff312757b8e6147f464cca0a6587", -1 }, + { "AUD.PAK", 0, 0, -1 }, + { 0, 0, 0, 0 } + }, + Common::EN_ANY, + Common::kPlatformMacintosh, + Common::ADGF_DROPLANGUAGE + }, + KYRA3_CD_INS_FLAGS + }, + { + { + "kyra3", + 0, + { + { "ONETIME.PAK", 0, "3833ff312757b8e6147f464cca0a6587", -1 }, + { "AUD.PAK", 0, 0, -1 }, + { 0, 0, 0, 0 } + }, + Common::DE_DEU, + Common::kPlatformMacintosh, + Common::ADGF_DROPLANGUAGE + }, + KYRA3_CD_INS_FLAGS + }, + { + { + "kyra3", + 0, + { + { "ONETIME.PAK", 0, "3833ff312757b8e6147f464cca0a6587", -1 }, + { "AUD.PAK", 0, 0, -1 }, + { 0, 0, 0, 0 } + }, + Common::FR_FRA, + Common::kPlatformMacintosh, + Common::ADGF_DROPLANGUAGE + }, + KYRA3_CD_INS_FLAGS + }, + // Spanish fan translation, see fr#1994040 "KYRA3: Add support for Spanish fan translation" { { @@ -657,7 +785,7 @@ const KYRAGameDescription adGameDescs[] = { KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY) }, - // Itlian fan translation, see fr#2003504 "KYRA: add support for Italian version of Kyrandia 2&3" + // Italian fan translation, see fr#2003504 "KYRA: add support for Italian version of Kyrandia 2&3" { { "kyra3", @@ -752,7 +880,134 @@ const KYRAGameDescription adGameDescs[] = { }, LOL_CD_FLAGS }, + + { + { + "lol", + "CD", + { + { "GENERAL.PAK", 0, "9e4bab499b7ea9337b91ac29fcba6d13", -1 }, + { "L01.PAK", 0, "759a0ac26808d77ea968bd392355ba1d", -1 }, + { 0, 0, 0, 0 } + }, + Common::EN_ANY, + Common::kPlatformPC, + Common::ADGF_DROPLANGUAGE | Common::ADGF_CD + }, + LOL_CD_FLAGS + }, + + { + { + "lol", + "CD", + { + { "GENERAL.PAK", 0, "9e4bab499b7ea9337b91ac29fcba6d13", -1 }, + { "L01.PAK", 0, "759a0ac26808d77ea968bd392355ba1d", -1 }, + { 0, 0, 0, 0 } + }, + Common::DE_DEU, + Common::kPlatformPC, + Common::ADGF_DROPLANGUAGE | Common::ADGF_CD + }, + LOL_CD_FLAGS + }, + { + { + "lol", + "CD", + { + { "GENERAL.PAK", 0, "9e4bab499b7ea9337b91ac29fcba6d13", -1 }, + { "L01.PAK", 0, "759a0ac26808d77ea968bd392355ba1d", -1 }, + { 0, 0, 0, 0 } + }, + Common::FR_FRA, + Common::kPlatformPC, + Common::ADGF_DROPLANGUAGE | Common::ADGF_CD + }, + LOL_CD_FLAGS + }, + + { + { + "lol", + 0, + { + { "WESTWOOD.1", 0, "3c61cb7de5b2ec452f5851f5075207ee", -1 }, + { 0, 0, 0, 0 } + }, + Common::DE_DEU, + Common::kPlatformPC, + Common::ADGF_NO_FLAGS + }, + LOL_FLOPPY_CMP_FLAGS + }, + + { + { + "lol", + "Extracted", + { + { "GENERAL.PAK", 0, "996e66e81054d36249907a1d8158da3d", -1 }, + { "CHAPTER7.PAK", 0, "cabee57f00d6d84b65a732b6868a4959", -1 }, + { 0, 0, 0, 0 } + }, + Common::DE_DEU, + Common::kPlatformPC, + Common::ADGF_NO_FLAGS + }, + LOL_FLOPPY_FLAGS + }, + + /* disable these targets until they get supported + { + { + "lol", + 0, + { + { "GENERAL.PAK", 0, "3fe6539b9b09084c0984eaf7170464e9", -1 }, + { "MUS.PAK", 0, "008dc69d8cbcdb6bae30e270fab26e76", -1 }, + { 0, 0, 0, 0 } + }, + Common::EN_ANY, + Common::kPlatformPC98, + Common::ADGF_NO_FLAGS + }, + LOL_PC98_FLAGS + }, + + { + { + "lol", + 0, + { + { "GENERAL.PAK", 0, "3fe6539b9b09084c0984eaf7170464e9", -1 }, + { "MUS.PAK", 0, "008dc69d8cbcdb6bae30e270fab26e76", -1 }, + { 0, 0, 0, 0 } + }, + Common::JA_JPN, + Common::kPlatformPC98, + Common::ADGF_NO_FLAGS + }, + LOL_PC98_SJIS_FLAGS + },*/ + + { + { + "lol", + "Demo", + { + { "GENERAL.PAK", 0, "e94863d86c4597a2d581d05481c152ba", -1 }, + { 0, 0, 0, 0 } + }, + Common::EN_ANY, + Common::kPlatformPC, + Common::ADGF_NO_FLAGS + }, + LOL_DEMO_FLAGS + }, + { AD_TABLE_END_MARKER, FLAGS(0, 0, 0, 0, 0, 0, 0) } }; diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp index 35b343fc25..47ce698e50 100644 --- a/engines/kyra/gui_lok.cpp +++ b/engines/kyra/gui_lok.cpp @@ -530,7 +530,7 @@ int GUI_LoK::resumeGame(Button *button) { void GUI_LoK::setupSavegames(Menu &menu, int num) { Common::InSaveFile *in; - static char savenames[5][31]; + static char savenames[5][35]; uint8 startSlot; assert(num <= 5); @@ -549,7 +549,8 @@ void GUI_LoK::setupSavegames(Menu &menu, int num) { KyraEngine_v1::SaveHeader header; for (int i = startSlot; i < num && uint(_savegameOffset + i) < _saveSlots.size(); i++) { if ((in = _vm->openSaveForReading(_vm->getSavegameFilename(_saveSlots[i + _savegameOffset]), header))) { - strncpy(savenames[i], header.description.c_str(), 31); + strncpy(savenames[i], header.description.c_str(), ARRAYSIZE(savenames[0])); + savenames[i][34] = 0; menu.item[i].itemString = savenames[i]; menu.item[i].enabled = 1; menu.item[i].saveSlot = _saveSlots[i + _savegameOffset]; @@ -673,7 +674,7 @@ void GUI_LoK::updateSavegameString() { length = strlen(_savegameName); if (_keyPressed.ascii > 31 && _keyPressed.ascii < 127) { - if (length < 31) { + if (length < ARRAYSIZE(_savegameName)-1) { _savegameName[length] = _keyPressed.ascii; _savegameName[length+1] = 0; redrawTextfield(); diff --git a/engines/kyra/gui_lok.h b/engines/kyra/gui_lok.h index 49081c7ae2..16b7ef9183 100644 --- a/engines/kyra/gui_lok.h +++ b/engines/kyra/gui_lok.h @@ -162,7 +162,7 @@ private: bool _menuRestoreScreen; uint8 _toplevelMenu; int _savegameOffset; - char _savegameName[31]; + char _savegameName[35]; const char *_specialSavegameString; Common::KeyState _keyPressed; int8 _mouseWheel; diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp index 2819c4f077..e4cec760fa 100644 --- a/engines/kyra/gui_v2.cpp +++ b/engines/kyra/gui_v2.cpp @@ -456,6 +456,7 @@ void GUI_v2::setupSavegameNames(Menu &menu, int num) { for (int i = startSlot; i < num && uint(_savegameOffset + i) < _saveSlots.size(); ++i) { if ((in = _vm->openSaveForReading(_vm->getSavegameFilename(_saveSlots[i + _savegameOffset]), header)) != 0) { strncpy(getTableString(menu.item[i].itemId), header.description.c_str(), 80); + getTableString(menu.item[i].itemId)[79] = 0; menu.item[i].saveSlot = _saveSlots[i + _savegameOffset]; menu.item[i].enabled = true; delete in; diff --git a/engines/kyra/gui_v2.h b/engines/kyra/gui_v2.h index 161752627b..60b7f0ab86 100644 --- a/engines/kyra/gui_v2.h +++ b/engines/kyra/gui_v2.h @@ -188,7 +188,7 @@ protected: // save menu bool _noSaveProcess; int _saveSlot; - char _saveDescription[0x50]; + char _saveDescription[0x51]; int saveMenu(Button *caller); int clickSaveSlot(Button *caller); diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp index d3de621707..33a8af91f1 100644 --- a/engines/kyra/kyra_hof.cpp +++ b/engines/kyra/kyra_hof.cpp @@ -196,14 +196,18 @@ void KyraEngine_HoF::pauseEngineIntern(bool pause) { _seqWsaChatTimeout += pausedTime; _seqWsaChatFrameTimeout += pausedTime; - for (int x = 0; x < 10; x++) { - if (_activeText[x].duration != -1) - _activeText[x].startTime += pausedTime; + if (_activeText) { + for (int x = 0; x < 10; x++) { + if (_activeText[x].duration != -1) + _activeText[x].startTime += pausedTime; + } } - for (int x = 0; x < 8; x++) { - if (_activeWSA[x].flags != -1) - _activeWSA[x].nextFrame += pausedTime; + if (_activeWSA) { + for (int x = 0; x < 8; x++) { + if (_activeWSA[x].flags != -1) + _activeWSA[x].nextFrame += pausedTime; + } } _nextIdleAnim += pausedTime; @@ -251,7 +255,7 @@ int KyraEngine_HoF::init() { _abortIntroFlag = false; if (_sequenceStrings) { - for (int i = 0; i < 33; i++) + for (int i = 0; i < MIN(33, _sequenceStringsSize); i++) _sequenceStringsDuration[i] = (int) strlen(_sequenceStrings[i]) * 8; } @@ -278,7 +282,10 @@ int KyraEngine_HoF::go() { seq_showStarcraftLogo(); if (_flags.isDemo && !_flags.isTalkie) { - seq_playSequences(kSequenceDemoVirgin, kSequenceDemoFisher); + if (_flags.gameID == GI_LOL) + seq_playSequences(kSequenceLolDemoScene1, kSequenceLolDemoScene6); + else + seq_playSequences(kSequenceDemoVirgin, kSequenceDemoFisher); _menuChoice = 4; } else { seq_playSequences(kSequenceVirgin, kSequenceZanfaun); @@ -292,10 +299,12 @@ int KyraEngine_HoF::go() { if (_menuChoice != 4) { // load just the pak files needed for ingame _res->loadPakFile(StaticResource::staticDataFilename()); - if (_flags.platform == Common::kPlatformPC && _flags.isTalkie) - _res->loadFileList("FILEDATA.FDT"); - else + if (_flags.platform == Common::kPlatformPC && _flags.isTalkie) { + if (!_res->loadFileList("FILEDATA.FDT")) + error("couldn't load 'FILEDATA.FDT'"); + } else { _res->loadFileList(_ingamePakList, _ingamePakListSize); + } if (_flags.platform == Common::kPlatformPC98) _res->loadPakFile("AUDIO.PAK"); @@ -1501,15 +1510,19 @@ void KyraEngine_HoF::openTalkFile(int newFile) { _oldTalkFile = -1; } - if (newFile == 0) { + if (newFile == 0) strcpy(talkFilename, "ANYTALK.TLK"); - _res->loadPakFile(talkFilename); - } else { + else sprintf(talkFilename, "CH%dVOC.TLK", newFile); - _res->loadPakFile(talkFilename); - } _oldTalkFile = newFile; + + if (!_res->loadPakFile(talkFilename)) { + if (speechEnabled()) { + warning("Couldn't load file '%s' falling back to text only mode", talkFilename); + _configVoice = 0; + } + } } void KyraEngine_HoF::snd_playVoiceFile(int id) { @@ -1545,7 +1558,8 @@ void KyraEngine_HoF::playVoice(int high, int low) { if (!_flags.isTalkie) return; int vocFile = high * 10000 + low * 10; - snd_playVoiceFile(vocFile); + if (speechEnabled()) + snd_playVoiceFile(vocFile); } void KyraEngine_HoF::snd_playSoundEffect(int track, int volume) { diff --git a/engines/kyra/kyra_hof.h b/engines/kyra/kyra_hof.h index 866dd55d16..f6e887c648 100644 --- a/engines/kyra/kyra_hof.h +++ b/engines/kyra/kyra_hof.h @@ -97,6 +97,20 @@ enum kNestedSequencesDemo { kSequenceDemoDig }; +enum kSequencesLolDemo { + kSequenceLolDemoScene1 = 0, + kSequenceLolDemoText1, + kSequenceLolDemoScene2, + kSequenceLolDemoText2, + kSequenceLolDemoScene3, + kSequenceLolDemoText3, + kSequenceLolDemoScene4, + kSequenceLolDemoText4, + kSequenceLolDemoScene5, + kSequenceLolDemoText5, + kSequenceLolDemoScene6 +}; + class WSAMovie_v2; class KyraEngine_HoF; class TextDisplayer_HoF; @@ -242,6 +256,14 @@ protected: int seq_demoBail(WSAMovie_v2 *wsaObj, int x, int y, int frm); int seq_demoDig(WSAMovie_v2 *wsaObj, int x, int y, int frm); + int seq_lolDemoScene1(WSAMovie_v2 *wsaObj, int x, int y, int frm); + int seq_lolDemoScene2(WSAMovie_v2 *wsaObj, int x, int y, int frm); + int seq_lolDemoScene3(WSAMovie_v2 *wsaObj, int x, int y, int frm); + int seq_lolDemoScene4(WSAMovie_v2 *wsaObj, int x, int y, int frm); + int seq_lolDemoScene5(WSAMovie_v2 *wsaObj, int x, int y, int frm); + int seq_lolDemoText5(WSAMovie_v2 *wsaObj, int x, int y, int frm); + int seq_lolDemoScene6(WSAMovie_v2 *wsaObj, int x, int y, int frm); + void seq_sequenceCommand(int command); void seq_loadNestedSequence(int wsaNum, int seqNum); void seq_nestedSequenceFrame(int command, int wsaNum); @@ -264,7 +286,7 @@ protected: WSAMovie_v2 * wsa, int firstframe, int lastframe, int wsaXpos, int wsaYpos); void seq_finaleActorScreen(); void seq_displayScrollText(uint8 *data, const ScreenDim *d, int tempPage1, int tempPage2, int speed, int step, Screen::FontId fid1, Screen::FontId fid2, const uint8 *shapeData = 0, const char *const *specialData = 0); - void seq_scrollPage(); + void seq_scrollPage(int bottom, int top); void seq_showStarcraftLogo(); void seq_init(); @@ -280,8 +302,7 @@ protected: static const int8 _dosTrackMap[]; static const int _dosTrackMapSize; - const AudioDataStruct *_soundData; - + AudioDataStruct _soundData[3]; protected: // game initialization void startup(); diff --git a/engines/kyra/kyra_lok.h b/engines/kyra/kyra_lok.h index cb3062847e..1def95ddbf 100644 --- a/engines/kyra/kyra_lok.h +++ b/engines/kyra/kyra_lok.h @@ -633,7 +633,7 @@ protected: int _soundFilesIntroSize; const int32 *_cdaTrackTable; int _cdaTrackTableSize; - const AudioDataStruct * _soundData; + AudioDataStruct _soundData[3]; // positions of the inventory static const uint16 _itemPosX[]; diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp index a4e5b58364..a61253199b 100644 --- a/engines/kyra/kyra_mr.cpp +++ b/engines/kyra/kyra_mr.cpp @@ -508,7 +508,8 @@ void KyraEngine_MR::snd_playVoiceFile(int file) { char filename[16]; snprintf(filename, 16, "%.08u", (uint)file); - _voiceSoundChannel = _soundDigital->playSound(filename, 0xFE, Audio::Mixer::kSpeechSoundType, 255); + if (speechEnabled()) + _voiceSoundChannel = _soundDigital->playSound(filename, 0xFE, Audio::Mixer::kSpeechSoundType, 255); } bool KyraEngine_MR::snd_voiceIsPlaying() { @@ -802,7 +803,12 @@ void KyraEngine_MR::openTalkFile(int file) { } _currentTalkFile = file; - _res->loadPakFile(talkFilename); + if (!_res->loadPakFile(talkFilename)) { + if (speechEnabled()) { + warning("Couldn't load file '%s' falling back to text only mode", talkFilename); + _configVoice = 0; + } + } } #pragma mark - diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index 85c03dc1bb..bc46d8e1f5 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -114,7 +114,7 @@ int KyraEngine_v1::init() { _sound = new SoundTownsPC98_v2(this, _mixer); } else if (_flags.platform == Common::kPlatformPC98) { if (_flags.gameID == GI_KYRA1) - _sound = new SoundTowns/*SoundPC98*/(this, _mixer); + _sound = new SoundPC98(this, _mixer); else _sound = new SoundTownsPC98_v2(this, _mixer); } else if (midiDriver == MD_ADLIB) { @@ -152,6 +152,16 @@ int KyraEngine_v1::init() { _res = new Resource(this); assert(_res); _res->reset(); + + if (_flags.isDemo) { + // HACK: check whether this is the HOF demo or the LOL demo. + // The LOL demo needs to be detected and run as KyraEngine_HoF, + // but the static resource loader and the sequence player will + // need correct IDs. + if (_res->exists("scene1.cps")) + _flags.gameID = GI_LOL; + } + _staticres = new StaticResource(this); assert(_staticres); if (!_staticres->init()) diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index 50cabc421e..738a3fc8ec 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -34,8 +34,8 @@ #include "kyra/script.h" namespace Common { -class InSaveFile; -class OutSaveFile; +class SeekableReadStream; +class WriteStream; } // end of namespace Common class KyraMetaEngine; @@ -70,9 +70,9 @@ enum { struct AudioDataStruct { const char * const *_fileList; - const int _fileListLen; - const void * const _cdaTracks; - const int _cdaNumTracks; + int _fileListLen; + const void * _cdaTracks; + int _cdaNumTracks; }; // TODO: this is just the start of makeing the debug output of the kyra engine a bit more useable @@ -299,10 +299,10 @@ protected: kRSHEIoError = 3 }; - static kReadSaveHeaderError readSaveHeader(Common::InSaveFile *file, SaveHeader &header); + static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *file, SaveHeader &header); - Common::InSaveFile *openSaveForReading(const char *filename, SaveHeader &header); - Common::OutSaveFile *openSaveForWriting(const char *filename, const char *saveName) const; + Common::SeekableReadStream *openSaveForReading(const char *filename, SaveHeader &header); + Common::WriteStream *openSaveForWriting(const char *filename, const char *saveName) const; }; } // End of namespace Kyra diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index ef1121baa0..6624dd91ea 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -87,6 +87,9 @@ int LoLEngine::init() { _screen->setAnimBlockPtr(10000); _screen->setScreenDim(0); + if (!_sound->init()) + error("Couldn't init sound"); + return 0; } @@ -256,11 +259,14 @@ void LoLEngine::setupPrologueData(bool load) { "xxx/intro9.pak" }; - char filename[32]; + char filepath[32]; + char *filename = filepath; for (uint i = 0; i < ARRAYSIZE(fileList); ++i) { strcpy(filename, fileList[i]); memcpy(filename, _languageExt[_lang], 3); - + if (!_flags.isTalkie) + filename += 4; + if (load) { if (!_res->loadPakFile(filename)) error("Couldn't load file: '%s'", filename); diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index 92818aafe1..5da6bb3873 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -55,12 +55,10 @@ bool Resource::reset() { if (!dir.exists() || !dir.isDirectory()) error("invalid game path '%s'", dir.getPath().c_str()); - if (_vm->game() != GI_LOL) { - if (!loadPakFile(StaticResource::staticDataFilename()) || !StaticResource::checkKyraDat()) { - Common::String errorMessage = "You're missing the '" + StaticResource::staticDataFilename() + "' file or it got corrupted, (re)get it from the ScummVM website"; - _vm->GUIErrorMessage(errorMessage); - error(errorMessage.c_str()); - } + if (!loadPakFile(StaticResource::staticDataFilename()) || !StaticResource::checkKyraDat()) { + Common::String errorMessage = "You're missing the '" + StaticResource::staticDataFilename() + "' file or it got corrupted, (re)get it from the ScummVM website"; + _vm->GUIErrorMessage(errorMessage); + error(errorMessage.c_str()); } if (_vm->game() == GI_KYRA1) { @@ -91,17 +89,23 @@ bool Resource::reset() { return true; } else if (_vm->game() == GI_KYRA3) { - if (_vm->gameFlags().useInstallerPackage) - loadPakFile("WESTWOOD.001"); + if (_vm->gameFlags().useInstallerPackage) { + if (!loadPakFile("WESTWOOD.001")) + error("couldn't load file: 'WESTWOOD.001'"); + } // Add default file directories Common::File::addDefaultDirectory(ConfMan.get("path") + "malcolm"); Common::File::addDefaultDirectory(ConfMan.get("path") + "MALCOLM"); - loadFileList("FILEDATA.FDT"); + if (!loadFileList("FILEDATA.FDT")) + error("couldn't load file: 'FILEDATA.FDT'"); return true; } else if (_vm->game() == GI_LOL) { + if (_vm->gameFlags().useInstallerPackage) + tryLoadCompFiles(); + return true; } @@ -180,8 +184,14 @@ bool Resource::loadPakFile(const Common::String &filename) { for (ResArchiveLoader::FileList::iterator i = files.begin(); i != files.end(); ++i) { iter = _map.find(i->filename); if (iter == _map.end()) { + // We do an internal check for a file in gamepath with same filename to + // allow overwriting files inside archives with plain files inside the + // game directory + checkFile(i->filename); + // A new file entry, so we just insert it into the file map. - _map[i->filename] = i->entry; + if (_map.find(i->filename) == _map.end()) + _map[i->filename] = i->entry; } else if (!iter->_value.parent.empty()) { if (!iter->_value.parent.equalsIgnoreCase(filename)) { ResFileMap::iterator oldParent = _map.find(iter->_value.parent); @@ -349,7 +359,17 @@ bool Resource::loadFileToBuf(const char *file, void *buf, uint32 maxSize) { Common::SeekableReadStream *Resource::getFileStream(const Common::String &file) { CompFileMap::iterator compEntry; - if (Common::File::exists(file)) { + if ((compEntry = _compFiles.find(file)) != _compFiles.end()) + return new Common::MemoryReadStream(compEntry->_value.data, compEntry->_value.size, false); + + if (!isAccessable(file)) + return 0; + + ResFileMap::const_iterator iter = _map.find(file); + if (iter == _map.end()) + return 0; + + if (iter->_value.parent.empty()) { Common::File *stream = new Common::File(); if (!stream->open(file)) { delete stream; @@ -357,28 +377,15 @@ Common::SeekableReadStream *Resource::getFileStream(const Common::String &file) error("Couldn't open file '%s'", file.c_str()); } return stream; - } else if ((compEntry = _compFiles.find(file)) != _compFiles.end()) { - return new Common::MemoryReadStream(compEntry->_value.data, compEntry->_value.size, false); } else { - if (!isAccessable(file)) - return 0; - - ResFileMap::const_iterator iter = _map.find(file); - if (iter == _map.end()) - return 0; - - if (!iter->_value.parent.empty()) { - Common::SeekableReadStream *parent = getFileStream(iter->_value.parent); - assert(parent); + Common::SeekableReadStream *parent = getFileStream(iter->_value.parent); + assert(parent); - ResFileMap::const_iterator parentIter = _map.find(iter->_value.parent); - const ResArchiveLoader *loader = getLoader(parentIter->_value.type); - assert(loader); + ResFileMap::const_iterator parentIter = _map.find(iter->_value.parent); + const ResArchiveLoader *loader = getLoader(parentIter->_value.type); + assert(loader); - return loader->loadFileFromArchive(file, parent, iter->_value); - } else { - error("Couldn't open file '%s'", file.c_str()); - } + return loader->loadFileFromArchive(file, parent, iter->_value); } return 0; @@ -410,7 +417,19 @@ void Resource::checkFile(const Common::String &file) { if (_map.find(file) == _map.end()) { CompFileMap::const_iterator iter; - if (Common::File::exists(file)) { + if ((iter = _compFiles.find(file)) != _compFiles.end()) { + ResFileEntry entry; + entry.parent = ""; + entry.size = iter->_value.size; + entry.mounted = false; + entry.preload = false; + entry.prot = false; + entry.type = ResFileEntry::kAutoDetect; + entry.offset = 0; + _map[file] = entry; + + detectFileTypes(); + } else if (Common::File::exists(file)) { Common::File temp; if (temp.open(file)) { ResFileEntry entry; @@ -426,18 +445,6 @@ void Resource::checkFile(const Common::String &file) { detectFileTypes(); } - } else if ((iter = _compFiles.find(file)) != _compFiles.end()) { - ResFileEntry entry; - entry.parent = ""; - entry.size = iter->_value.size; - entry.mounted = false; - entry.preload = false; - entry.prot = false; - entry.type = ResFileEntry::kAutoDetect; - entry.offset = 0; - _map[file] = entry; - - detectFileTypes(); } } } @@ -1256,10 +1263,17 @@ uint8 FileExpander::calcCmdAndIndex(const uint8 *tbl, int16 ¶) { class CompLoaderInsHof : public CompArchiveLoader { public: - bool checkForFiles() const; - bool loadFile(CompFileMap &loadTo) const; + CompLoaderInsHof() { + _fileExtP = "%03d"; + _checkFile1 = "WESTWOOD.001"; + _checkFile2 = "WESTWOOD.002"; + _containerOffset = 6; + } -private: + virtual bool checkForFiles() const; + virtual bool loadFile(CompFileMap &loadTo) const; + +protected: struct Archive { Common::String filename; uint32 firstFile; @@ -1268,10 +1282,25 @@ private: uint32 endOffset; uint32 totalSize; }; + + const char *_fileExtP; + const char *_checkFile1; + const char *_checkFile2; + uint8 _containerOffset; +}; + +class CompLoaderInsLol : public CompLoaderInsHof { +public: + CompLoaderInsLol() { + _fileExtP = "%d"; + _checkFile1 = "WESTWOOD.1"; + _checkFile2 = "WESTWOOD.2"; + _containerOffset = 0; + } }; bool CompLoaderInsHof::checkForFiles() const { - return (Common::File::exists("WESTWOOD.001") && Common::File::exists("WESTWOOD.002")); + return (Common::File::exists(_checkFile1) && Common::File::exists(_checkFile2)); } bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const { @@ -1293,7 +1322,7 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const { Common::List<Archive> archives; for (int8 currentFile = 1; currentFile; currentFile++) { - sprintf(filenameExt, "%03d", currentFile); + sprintf(filenameExt, _fileExtP, currentFile); filenameTemp = filenameBase + Common::String(filenameExt); if (!tmpFile.open(filenameTemp)) { @@ -1309,9 +1338,9 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const { if (startFile) { size -= 4; if (fileId == currentFile) { - size -= 6; - pos += 6; - tmpFile.seek(6, SEEK_CUR); + size -= _containerOffset; + pos += _containerOffset; + tmpFile.seek(_containerOffset, SEEK_CUR); } else { size = size + 1 - pos; } @@ -1355,6 +1384,7 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const { uint8 *outbuffer = 0; uint32 inPart1 = 0; uint32 inPart2 = 0; + uint8 compressionType = 0; Common::String entryStr; pos = 0; @@ -1366,7 +1396,7 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const { for (Common::List<Archive>::iterator a = archives.begin(); a != archives.end(); ++a) { startFile = true; for (uint32 i = a->firstFile; i != (a->lastFile + 1); i++) { - sprintf(filenameExt, "%03d", i); + sprintf(filenameExt, _fileExtP, i); filenameTemp = a->filename + Common::String(filenameExt); if (!tmpFile.open(filenameTemp)) { @@ -1389,7 +1419,12 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const { tmpFile.seek(1); tmpFile.read(inbuffer + inPart1, inPart2); inPart2 = 0; - exp.process(outbuffer, inbuffer, outsize, insize); + + if (compressionType > 0) + exp.process(outbuffer, inbuffer, outsize, insize); + else + memcpy(outbuffer, inbuffer, outsize); + delete[] inbuffer; inbuffer = 0; newEntry.data = outbuffer; @@ -1418,7 +1453,7 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const { } } - sprintf(filenameExt, "%03d", i + 1); + sprintf(filenameExt, _fileExtP, i + 1); filenameTemp = a->filename + Common::String(filenameExt); Common::File tmpFile2; @@ -1434,8 +1469,7 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const { uint32 id = READ_LE_UINT32(hdr); if (id == 0x04034B50) { - if (hdr[8] != 8) - error("compression type not implemented"); + compressionType = hdr[8]; insize = READ_LE_UINT32(hdr + 18); outsize = READ_LE_UINT32(hdr + 22); @@ -1463,7 +1497,12 @@ bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const { } else { tmpFile.read(inbuffer, insize); inPart2 = 0; - exp.process(outbuffer, inbuffer, outsize, insize); + + if (compressionType > 0) + exp.process(outbuffer, inbuffer, outsize, insize); + else + memcpy(outbuffer, inbuffer, outsize); + delete[] inbuffer; inbuffer = 0; newEntry.data = outbuffer; @@ -1497,6 +1536,7 @@ void Resource::initializeLoaders() { _loaders.push_back(LoaderList::value_type(new ResLoaderTlk())); _compLoaders.push_back(CompLoaderList::value_type(new CompLoaderInsHof())); + _compLoaders.push_back(CompLoaderList::value_type(new CompLoaderInsLol())); } const ResArchiveLoader *Resource::getLoader(ResFileEntry::kType type) const { diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp index 22f934ba69..31c5e15fa6 100644 --- a/engines/kyra/saveload.cpp +++ b/engines/kyra/saveload.cpp @@ -37,7 +37,7 @@ namespace Kyra { -KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::InSaveFile *in, SaveHeader &header) { +KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::SeekableReadStream *in, SaveHeader &header) { uint32 type = in->readUint32BE(); header.originalSave = false; header.oldHeader = false; @@ -95,6 +95,9 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::InSave if (header.version <= 8) { char buffer[31]; in->read(buffer, 31); + // WORKAROUND: Old savegames could contain a missing termination 0 at the + // end so we manually add it. + buffer[30] = 0; header.description = buffer; } else { header.description = ""; @@ -108,10 +111,10 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::InSave return (in->ioFailed() ? kRSHEIoError : kRSHENoError); } -Common::InSaveFile *KyraEngine_v1::openSaveForReading(const char *filename, SaveHeader &header) { +Common::SeekableReadStream *KyraEngine_v1::openSaveForReading(const char *filename, SaveHeader &header) { debugC(9, kDebugLevelMain, "KyraEngine_v1::openSaveForReading('%s', -)", filename); - Common::InSaveFile *in = 0; + Common::SeekableReadStream *in = 0; if (!(in = _saveFileMan->openForLoading(filename))) return 0; @@ -159,12 +162,12 @@ Common::InSaveFile *KyraEngine_v1::openSaveForReading(const char *filename, Save return in; } -Common::OutSaveFile *KyraEngine_v1::openSaveForWriting(const char *filename, const char *saveName) const { +Common::WriteStream *KyraEngine_v1::openSaveForWriting(const char *filename, const char *saveName) const { debugC(9, kDebugLevelMain, "KyraEngine_v1::openSaveForWriting('%s', '%s')", filename, saveName); if (_quitFlag) return 0; - Common::OutSaveFile *out = 0; + Common::WriteStream *out = 0; if (!(out = _saveFileMan->openForSaving(filename))) { warning("Can't create file '%s', game not saved", filename); return 0; @@ -209,7 +212,7 @@ bool KyraEngine_v1::saveFileLoadable(int slot) { return false; SaveHeader header; - Common::InSaveFile *in = openSaveForReading(getSavegameFilename(slot), header); + Common::SeekableReadStream *in = openSaveForReading(getSavegameFilename(slot), header); if (in) { delete in; diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp index e4a3a5c54e..53c0cb5380 100644 --- a/engines/kyra/scene_mr.cpp +++ b/engines/kyra/scene_mr.cpp @@ -378,10 +378,11 @@ void KyraEngine_MR::loadSceneMsc() { _screen->loadBitmap(filename, 5, 5, 0, true); // HACK - uint8 data[320*200]; + uint8 *data = new uint8[320*200]; _screen->copyRegionToBuffer(5, 0, 0, 320, 200, data); _screen->clearPage(5); _screen->copyBlockToPage(5, 0, _maskPageMinY, 320, height, data); + delete[] data; musicUpdate(0); } diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 74f7bc6de9..0cde066cc0 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -413,7 +413,9 @@ void Screen::fadePalette(const uint8 *palData, int delay, const UpdateFunctor *u void Screen::getFadeParams(const uint8 *palette, int delay, int &delayInc, int &diff) { debugC(9, kDebugLevelScreen, "Screen::getFadeParams(%p, %d, %p, %p)", (const void *)palette, delay, (const void *)&delayInc, (const void *)&diff); uint8 maxDiff = 0; - for (int i = 0; i < 768; ++i) { + + const int colors = (_vm->gameFlags().platform == Common::kPlatformAmiga ? 32 : 256) * 3; + for (int i = 0; i < colors; ++i) { diff = ABS(palette[i] - _screenPalette[i]); maxDiff = MAX<uint8>(maxDiff, diff); } @@ -438,7 +440,8 @@ int Screen::fadePalStep(const uint8 *palette, int diff) { memcpy(fadePal, _screenPalette, 768); bool needRefresh = false; - for (int i = 0; i < 768; ++i) { + const int colors = (_vm->gameFlags().platform == Common::kPlatformAmiga ? 32 : 256) * 3; + for (int i = 0; i < colors; ++i) { int c1 = palette[i]; int c2 = fadePal[i]; if (c1 != c2) { @@ -476,7 +479,7 @@ void Screen::setPaletteIndex(uint8 index, uint8 red, uint8 green, uint8 blue) { void Screen::setScreenPalette(const uint8 *palData) { debugC(9, kDebugLevelScreen, "Screen::setScreenPalette(%p)", (const void *)palData); - int colors = (_vm->gameFlags().platform == Common::kPlatformAmiga ? 32 : 256); + const int colors = (_vm->gameFlags().platform == Common::kPlatformAmiga ? 32 : 256); if (palData != _screenPalette) memcpy(_screenPalette, palData, colors*3); diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp index 7993fb8de6..9b215b2c03 100644 --- a/engines/kyra/script_tim.cpp +++ b/engines/kyra/script_tim.cpp @@ -559,15 +559,7 @@ int TIMInterpreter::cmd_playVocFile(const uint16 *param) { int TIMInterpreter::cmd_loadSoundFile(const uint16 *param) { const char *file = (const char *)(_currentTim->text + READ_LE_UINT16(_currentTim->text + (param[0]<<1))); - - static char * fileList[] = { 0 }; - fileList[0] = _audioFilename; - static AudioDataStruct audioList = { fileList, 1, 0, 0 }; - - strncpy(_audioFilename, file, sizeof(_audioFilename)); - - _vm->sound()->setSoundList(&audioList); - _vm->sound()->loadSoundFile(0); + _vm->sound()->loadSoundFile(file); return 1; } diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp index 169c319347..635db3629c 100644 --- a/engines/kyra/sequences_hof.cpp +++ b/engines/kyra/sequences_hof.cpp @@ -50,7 +50,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) { _sound->setSoundList(&_soundData[(startSeq > kSequenceZanfaun) ? kMusicFinale : kMusicIntro]); _sound->loadSoundFile(0); - _screen->_charWidth = -2; + _screen->_charWidth = (_flags.gameID == GI_LOL) ? 0 : -2; memset(_activeWSA, 0, sizeof(ActiveWSA) * 8); for (int i = 0; i < 8; ++i) @@ -300,8 +300,8 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) { _eventList.clear(); seqNum = kSequenceFirates; } - } else if (seqNum == kSequenceDemoFisher && !(_abortIntroFlag || skipFlag())) { - seqNum = kSequenceDemoVirgin; + } else if (seqNum == endSeq && !(_abortIntroFlag || skipFlag())) { + seqNum = 0; } if (_menuChoice) { @@ -1722,7 +1722,7 @@ int KyraEngine_HoF::seq_demoFisher(WSAMovie_v2 *wsaObj, int x, int y, int frm) { _seqScrollTextCounter = 0; } - seq_scrollPage(); + seq_scrollPage(24, 144); _seqFrameCounter++; if (_seqFrameCounter < 0x256 || _seqFrameCounter > 0x31c) { if (_seqFrameCounter < 0x174 || _seqFrameCounter > 0x1d7) { @@ -1740,7 +1740,7 @@ int KyraEngine_HoF::seq_demoFisher(WSAMovie_v2 *wsaObj, int x, int y, int frm) { } } else { - seq_scrollPage(); + seq_scrollPage(24, 144); } return 0; } @@ -1796,6 +1796,182 @@ int KyraEngine_HoF::seq_demoDig(WSAMovie_v2 *wsaObj, int x, int y, int frm) { return frm; } +int KyraEngine_HoF::seq_lolDemoScene1(WSAMovie_v2 *wsaObj, int x, int y, int frm) { + uint8 *tmpPal = _screen->getPalette(2); + + if (!(_seqFrameCounter % 100)) { + if (_seqFrameCounter == 0) { + _sound->haltTrack(); + _sound->playTrack(6); + } + memcpy(tmpPal, _screen->getPalette(0), 0x300); + for (int i = 3; i < 0x300; i++) { + tmpPal[i] = ((int)tmpPal[i] * 120) / 64; + if (tmpPal[i] > 0x3f) + tmpPal[i] = 0x3f; + } + seq_playTalkText(_rnd.getRandomBit()); + _screen->setScreenPalette(tmpPal); + _screen->updateScreen(); + delay(8); + } else { + _screen->setScreenPalette(_screen->getPalette(0)); + _screen->updateScreen(); + if (_seqFrameCounter == 40) + seq_playTalkText(3); + } + + _seqFrameCounter++; + return frm; +} + +int KyraEngine_HoF::seq_lolDemoScene2(WSAMovie_v2 *wsaObj, int x, int y, int frm) { + switch (_seqFrameCounter - 17) { + case 0: + _seqFrameDelay = 8; + break; + case 3: + case 6: + case 9: + seq_playTalkText(8); + break; + case 15: + seq_playTalkText(9); + break; + case 18: + seq_playTalkText(2); + break; + default: + break; + } + _seqFrameCounter++; + return frm; +} + +int KyraEngine_HoF::seq_lolDemoScene3(WSAMovie_v2 *wsaObj, int x, int y, int frm) { + if (_seqFrameCounter == 1) + seq_playTalkText(6); + else if (frm == 26) + seq_playTalkText(7); + + _seqFrameCounter++; + return frm; +} + +int KyraEngine_HoF::seq_lolDemoScene4(WSAMovie_v2 *wsaObj, int x, int y, int frm) { + switch (_seqFrameCounter) { + case 11: + case 14: + case 17: + case 20: + seq_playTalkText(8); + break; + case 22: + seq_playTalkText(11); + break; + case 24: + seq_playTalkText(8); + break; + case 30: + seq_playTalkText(15); + break; + case 34: + seq_playTalkText(14); + break; + case 38: + seq_playTalkText(13); + break; + case 42: + seq_playTalkText(12); + break; + default: + break; + } + + _seqFrameCounter++; + return frm; +} + +int KyraEngine_HoF::seq_lolDemoScene5(WSAMovie_v2 *wsaObj, int x, int y, int frm) { + switch (_seqFrameCounter++) { + case 0: + case 4: + case 6: + case 8: + case 10: + case 14: + case 16: + case 18: + case 20: + case 22: + case 24: + case 26: + case 28: + case 30: + seq_playTalkText(15); + break; + case 32: + seq_playTalkText(16); + break; + case 42: + seq_playTalkText(6); + break; + default: + break; + } + return frm; +} + +int KyraEngine_HoF::seq_lolDemoText5(WSAMovie_v2 *wsaObj, int x, int y, int frm) { + if (_seqFrameCounter++ == 100) + seq_playTalkText(5); + return frm; +} + +int KyraEngine_HoF::seq_lolDemoScene6(WSAMovie_v2 *wsaObj, int x, int y, int frm) { + while (_seqScrollTextCounter < 0x122) { + _seqEndTime = _system->getMillis() + 6 * _tickLength; + if (!_seqFrameCounter) { + _screen->loadBitmap("adtext.cps", 4, 4, 0); + _screen->loadBitmap("adtext2.cps", 6, 6, 0); + _screen->copyPageMemory(6, 0, 4, 64000, 1024); + _screen->copyPageMemory(6, 1023, 6, 0, 64000); + _seqScrollTextCounter = 0; + } + + if (_seqFrameCounter % 175) { + _screen->setScreenPalette(_screen->getPalette(0)); + } else { + uint8 *tmpPal = _screen->getPalette(2); + memcpy(tmpPal, _screen->getPalette(0), 0x300); + for (int i = 3; i < 0x300; i++) { + tmpPal[i] = ((int)tmpPal[i] * 120) / 64; + if (tmpPal[i] > 0x3f) + tmpPal[i] = 0x3f; + } + seq_playTalkText(_rnd.getRandomBit()); + _screen->setScreenPalette(tmpPal); + _screen->updateScreen(); + delay(8); + } + + if (_seqFrameCounter == 40 || _seqFrameCounter == 80 || _seqFrameCounter == 150 || _seqFrameCounter == 300) + seq_playTalkText(3); + + _screen->copyPage(12, 2); + seq_scrollPage(70, 130); + _screen->copyPage(2, 0); + _screen->updateScreen(); + _seqFrameCounter++; + if (_seqFrameCounter < 128 || _seqFrameCounter > 207) + _seqScrollTextCounter++; + delayUntil(_seqEndTime); + } + _screen->copyPage(2, 12); + + return 0; +} + uint32 KyraEngine_HoF::seq_activeTextsTimeLeft() { uint32 res = 0; @@ -1892,16 +2068,14 @@ void KyraEngine_HoF::seq_sequenceCommand(int command) { switch (command) { case 0: memset(pal, 0, 0x300); - _screen->fadePalette(pal, 16); + _screen->fadePalette(pal, 36); memcpy (_screen->getPalette(0), pal, 0x300); memcpy (_screen->getPalette(1), pal, 0x300); break; case 1: memset(pal, 0x3F, 0x300); - //////////XXX - //////////Unused anyway (at least by fm-towns intro/outro) - + seq_playTalkText(_rnd.getRandomBit()); _screen->fadePalette(pal, 16); memcpy (_screen->getPalette(0), pal, 0x300); memcpy (_screen->getPalette(1), pal, 0x300); @@ -2575,32 +2749,34 @@ void KyraEngine_HoF::seq_displayScrollText(uint8 *data, const ScreenDim *d, int delete[] textData; } -void KyraEngine_HoF::seq_scrollPage() { +void KyraEngine_HoF::seq_scrollPage(int bottom, int top) { int dstY, dstH, srcH; static const ScreenDim d = { 0x00, 0x00, 0x28, 0x320, 0xFF, 0xFE, 0x00, 0x00 }; - if (_seqScrollTextCounter - 143 < 0) { - dstY = 144 - _seqScrollTextCounter; + if (_seqScrollTextCounter - (top - 1) < 0) { + dstY = top - _seqScrollTextCounter; dstH = _seqScrollTextCounter; srcH = 0; } else { dstY = 0; - srcH = _seqScrollTextCounter - 144; - dstH = (400 - srcH <= 144) ? 400 - srcH : 144; + srcH = _seqScrollTextCounter - top; + dstH = (400 - srcH <= top) ? 400 - srcH : top; } if (dstH > 0) { - for (int i = 0; i < 4; i++) { - const ItemAnimData_v1 *def = &_demoAnimData[i]; - ActiveItemAnim *a = &_activeItemAnim[i]; - - _screen->fillRect(12, def->y - 8, 28, def->y + 8, 0, 4); - _screen->drawShape(4, getShapePtr(def->itemIndex + def->frames[a->currentFrame]), 12, def->y - 8, 0, 0); - if(_seqFrameCounter % 2 == 0) - a->currentFrame = ++a->currentFrame % 20; + if (_demoAnimData) { + for (int i = 0; i < 4; i++) { + const ItemAnimData_v1 *def = &_demoAnimData[i]; + ActiveItemAnim *a = &_activeItemAnim[i]; + + _screen->fillRect(12, def->y - 8, 28, def->y + 8, 0, 4); + _screen->drawShape(4, getShapePtr(def->itemIndex + def->frames[a->currentFrame]), 12, def->y - 8, 0, 0); + if(_seqFrameCounter % 2 == 0) + a->currentFrame = ++a->currentFrame % 20; + } } - _screen->copyRegionEx(4, 0, srcH, 2, 2, dstY + 24, 320, dstH, &d); + _screen->copyRegionEx(4, 0, srcH, 2, 2, dstY + bottom, 320, dstH, &d); } } @@ -2656,6 +2832,10 @@ void KyraEngine_HoF::seq_init() { _res->loadFileList(_sequencePakList, _sequencePakListSize); int numShp = -1; + + if (_flags.gameID == GI_LOL) + return; + if (_flags.isDemo && !_flags.isTalkie) { _demoAnimData = _staticres->loadShapeAnimData_v1(k2SeqplayShapeAnimData, _itemAnimDataSize); uint8 *shp = _res->fileData("icons.shp", 0); diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp index c8749dc06b..073639e4ca 100644 --- a/engines/kyra/sound.cpp +++ b/engines/kyra/sound.cpp @@ -104,6 +104,11 @@ int32 Sound::voicePlay(const char *file, bool isSfx) { fileSize = 0; } + if (!audioStream) { + warning("Couldn't load sound file '%s'", file); + return 0; + } + _soundChannels[h].file = file; _mixer->playInputStream(isSfx ? Audio::Mixer::kSFXSoundType : Audio::Mixer::kSpeechSoundType, &_soundChannels[h].channelHandle, audioStream); @@ -323,7 +328,17 @@ struct DeleterArray { void SoundMidiPC::loadSoundFile(uint file) { Common::StackLock lock(_mutex); - Common::String filename = fileListEntry(file); + internalLoadFile(fileListEntry(file)); +} + +void SoundMidiPC::loadSoundFile(Common::String file) { + Common::StackLock lock(_mutex); + + internalLoadFile(file); +} + +void SoundMidiPC::internalLoadFile(Common::String file) { + Common::String filename = file; filename += "."; filename += _useC55 ? "C55" : "XMI"; diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index cebfdf491f..e5294eb15d 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -120,6 +120,12 @@ public: virtual void loadSoundFile(uint file) = 0; /** + * Load a sound file for playing music + * and sound effects from. + */ + virtual void loadSoundFile(Common::String file) = 0; + + /** * Plays the specified track. * * @param track track number @@ -215,8 +221,6 @@ protected: int _musicEnabled; bool _sfxEnabled; - int _currentTheme; - KyraEngine_v1 *_vm; Audio::Mixer *_mixer; @@ -260,6 +264,7 @@ public: void process(); void loadSoundFile(uint file); + void loadSoundFile(Common::String file); void playTrack(uint8 track); void haltTrack(); @@ -269,6 +274,8 @@ public: void beginFadeOut(); private: + void internalLoadFile(Common::String file); + void play(uint8 track); void unk1(); @@ -280,7 +287,8 @@ private: uint8 _trackEntries[500]; uint8 *_soundDataPtr; int _sfxPlayingSound; - uint _soundFileLoaded; + + Common::String _soundFileLoaded; uint8 _sfxPriority; uint8 _sfxFourthByteOfSong; @@ -316,6 +324,7 @@ public: void updateVolumeSettings(); void loadSoundFile(uint file); + void loadSoundFile(Common::String file); void playTrack(uint8 track); void haltTrack(); @@ -343,6 +352,7 @@ public: bool isMT32() const { return _nativeMT32; } private: + void internalLoadFile(Common::String file); void updateChannelVolume(uint8 vol); static void onTimer(void *data); @@ -397,6 +407,7 @@ public: void process(); void loadSoundFile(uint file); + void loadSoundFile(Common::String) {} void playTrack(uint8 track); void haltTrack(); @@ -454,6 +465,7 @@ public: void process() {} void loadSoundFile(uint file) {} + void loadSoundFile(Common::String) {} void playTrack(uint8 track); void haltTrack(); @@ -480,6 +492,7 @@ public: void process(); void loadSoundFile(uint file) {} + void loadSoundFile(Common::String) {} void playTrack(uint8 track); void haltTrack(); @@ -513,6 +526,7 @@ public: void setSoundList(const AudioDataStruct * list) { _music->setSoundList(list); _sfx->setSoundList(list); } bool hasSoundFile(uint file) const { return _music->hasSoundFile(file) && _sfx->hasSoundFile(file); } void loadSoundFile(uint file) { _music->loadSoundFile(file); _sfx->loadSoundFile(file); } + void loadSoundFile(Common::String file) { _music->loadSoundFile(file); _sfx->loadSoundFile(file); } void playTrack(uint8 track) { _music->playTrack(track); } void haltTrack() { _music->haltTrack(); } diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index 0ceb288b8a..62551d2b09 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -2225,7 +2225,7 @@ SoundAdlibPC::SoundAdlibPC(KyraEngine_v1 *vm, Audio::Mixer *mixer) assert(_driver); _sfxPlayingSound = -1; - _soundFileLoaded = (uint)-1; + _soundFileLoaded.clear(); if (_v2) { // TODO: Figure out if Kyra 2 uses sound triggers at all. @@ -2269,7 +2269,7 @@ void SoundAdlibPC::playTrack(uint8 track) { // sync for each loop. To avoid that, we declare that all four // of the song channels have to jump "in sync". - if (track == 4 && scumm_stricmp(fileListEntry(_soundFileLoaded), "KYRA1B") == 0) + if (track == 4 && _soundFileLoaded.equalsIgnoreCase("KYRA1B.ADL")) _driver->setSyncJumpMask(0x000F); else _driver->setSyncJumpMask(0); @@ -2348,6 +2348,15 @@ void SoundAdlibPC::beginFadeOut() { } void SoundAdlibPC::loadSoundFile(uint file) { + internalLoadFile(fileListEntry(file)); +} + +void SoundAdlibPC::loadSoundFile(Common::String file) { + internalLoadFile(file); +} + +void SoundAdlibPC::internalLoadFile(Common::String file) { + file += ".ADL"; if (_soundFileLoaded == file) return; @@ -2356,12 +2365,9 @@ void SoundAdlibPC::loadSoundFile(uint file) { uint8 *file_data = 0; uint32 file_size = 0; - char filename[25]; - sprintf(filename, "%s.ADL", fileListEntry(file)); - - file_data = _vm->resource()->fileData(filename, &file_size); + file_data = _vm->resource()->fileData(file.c_str(), &file_size); if (!file_data) { - warning("Couldn't find music file: '%s'", filename); + warning("Couldn't find music file: '%s'", file.c_str()); return; } diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index 0f2b916c9d..ec1962a58f 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -2363,7 +2363,7 @@ TownsPC98_OpnDriver::TownsPC98_OpnDriver(Audio::Mixer *mixer, OpnType type) : _numSSG(type == OD_TOWNS ? 0 : 3), _hasADPCM(type == OD_TYPE86 ? true : false), _numChan(type == OD_TYPE26 ? 3 : 6), _hasStereo(type == OD_TYPE26 ? false : true) { setTempo(84); - _baserate = (double)getRate() / 10368.0; + _baserate = (486202500.0 / (double)getRate()) / 10368.0; } TownsPC98_OpnDriver::~TownsPC98_OpnDriver() { diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 9a4b40902e..bb63c24c36 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -43,7 +43,7 @@ namespace Kyra { -#define RESFILE_VERSION 28 +#define RESFILE_VERSION 31 bool StaticResource::checkKyraDat() { Common::File kyraDat; @@ -279,6 +279,16 @@ bool StaticResource::init() { { 0, 0, 0 } }; + static const FilenameTable lolStaticRes[] = { + // Demo Sequence Player + { k2SeqplayPakFiles, kStringList, "S_PAKFILES.TXT" }, + { k2SeqplayStrings, kLanguageList, "S_STRINGS." }, + { k2SeqplaySfxFiles, kStringList, "S_SFXFILES.TXT" }, + { k2SeqplaySeqData, k2SeqData, "S_DATA.SEQ" }, + { k2SeqplayIntroTracks, kStringList, "S_INTRO.TRA" }, + { 0, 0, 0 } + }; + if (_vm->game() == GI_KYRA1) { _builtIn = 0; _filenameTable = kyra1StaticRes; @@ -289,7 +299,10 @@ bool StaticResource::init() { _builtIn = 0; _filenameTable = kyra3StaticRes; } else if (_vm->game() == GI_LOL) { - return true; + if (!_vm->gameFlags().isDemo) + return true; + _builtIn = 0; + _filenameTable = lolStaticRes; } else { error("StaticResource: Unknown game ID"); } @@ -920,6 +933,8 @@ const char *StaticResource::getFilename(const char *name) { filename += ".K2"; else if (_vm->gameFlags().gameID == GI_KYRA3) filename += ".K3"; + else if (_vm->gameFlags().gameID == GI_LOL) + filename += ".LOL"; if (_vm->gameFlags().isTalkie && _vm->gameFlags().gameID != GI_KYRA3) filename += ".CD"; @@ -1037,38 +1052,51 @@ void KyraEngine_LoK::initStaticResource() { } // audio data tables -#if 0 static const char *tIntro98[] = { "intro%d.dat" }; static const char *tIngame98[] = { "kyram%d.dat" }; -#endif - - static const AudioDataStruct soundData_PC[] = { - { _soundFilesIntro, _soundFilesIntroSize, 0, 0 }, - { _soundFiles, _soundFilesSize, 0, 0 }, - { 0, 0, 0, 0} - }; - - static const AudioDataStruct soundData_TOWNS[] = { - { _soundFiles, _soundFilesSize, _cdaTrackTable, _cdaTrackTableSize }, - { _soundFiles, _soundFilesSize, _cdaTrackTable, _cdaTrackTableSize }, - { 0, 0, 0, 0} - }; - -#if 0 - static const AudioDataStruct soundData_PC98[] = { - { tIntro98, 1, 0, 0 }, - { tIngame98, 1, 0, 0 }, - { 0, 0, 0, 0} - }; -#endif - - if (_flags.platform == Common::kPlatformPC) - _soundData = soundData_PC; - else if (_flags.platform == Common::kPlatformFMTowns) - _soundData = soundData_TOWNS; - else if (_flags.platform == Common::kPlatformPC98) - _soundData = soundData_TOWNS/*soundData_PC98*/; + if (_flags.platform == Common::kPlatformPC) { + _soundData[0]._fileList = _soundFilesIntro; + _soundData[0]._fileListLen = _soundFilesIntroSize; + _soundData[0]._cdaTracks = 0; + _soundData[0]._cdaNumTracks = 0; + _soundData[1]._fileList = _soundFiles; + _soundData[1]._fileListLen = _soundFilesSize; + _soundData[1]._cdaTracks = 0; + _soundData[1]._cdaNumTracks = 0; + _soundData[2]._fileList = 0; + _soundData[2]._fileListLen = 0; + _soundData[2]._cdaTracks = 0; + _soundData[2]._cdaNumTracks = 0; + } else if (_flags.platform == Common::kPlatformFMTowns) { + _soundData[0]._fileList = _soundFiles; + _soundData[0]._fileListLen = _soundFilesSize; + _soundData[0]._cdaTracks = _cdaTrackTable; + _soundData[0]._cdaNumTracks = _cdaTrackTableSize; + _soundData[1]._fileList = _soundFiles; + _soundData[1]._fileListLen = _soundFilesSize; + _soundData[1]._cdaTracks = _cdaTrackTable; + _soundData[1]._cdaNumTracks = _cdaTrackTableSize; + _soundData[2]._fileList = 0; + _soundData[2]._fileListLen = 0; + _soundData[2]._cdaTracks = 0; + _soundData[2]._cdaNumTracks = 0; + } else if (_flags.platform == Common::kPlatformPC98) { + _soundData[0]._fileList = tIntro98; + _soundData[0]._fileListLen = 1; + _soundData[0]._cdaTracks = 0; + _soundData[0]._cdaNumTracks = 0; + _soundData[1]._fileList = tIngame98; + _soundData[1]._fileListLen = 1; + _soundData[1]._cdaTracks = 0; + _soundData[1]._cdaNumTracks = 0; + _soundData[2]._fileList = 0; + _soundData[2]._fileListLen = 0; + _soundData[2]._cdaTracks = 0; + _soundData[2]._cdaNumTracks = 0; + } else { + memset(_soundData, 0, sizeof(_soundData)); + } } void KyraEngine_LoK::loadMouseShapes() { @@ -1266,38 +1294,50 @@ void KyraEngine_HoF::initStaticResource() { static const char *fmtMusicFileListFinale[] = { "finale%d.twn" }; static const char *fmtMusicFileListIngame[] = { "km%02d.twn" }; -#if 0 static const char *pc98MusicFileListIntro[] = { "intro%d.86" }; static const char *pc98MusicFileListFinale[] = { "finale%d.86" }; static const char *pc98MusicFileListIngame[] = { "km%02d.86" }; -#endif - - static const AudioDataStruct soundData_PC[] = { - { _musicFileListIntro, _musicFileListIntroSize, 0, 0 }, - { _musicFileListIngame, _musicFileListIngameSize, 0, 0}, - { _musicFileListFinale, _musicFileListIntroSize, 0, 0 } - }; - static const AudioDataStruct soundData_TOWNS[] = { - { fmtMusicFileListIntro, 1, _cdaTrackTableIntro, _cdaTrackTableIntroSize >> 1 }, - { fmtMusicFileListIngame, 1, _cdaTrackTableIngame, _cdaTrackTableIngameSize >> 1 }, - { fmtMusicFileListFinale, 1, _cdaTrackTableFinale, _cdaTrackTableFinaleSize >> 1 } - }; - -#if 0 - static const AudioDataStruct soundData_PC98[] = { - { pc98MusicFileListIntro, 1, 0, 0 }, - { pc98MusicFileListIngame, 1, 0, 0 }, - { pc98MusicFileListFinale, 1, 0, 0 } - }; -#endif - - if (_flags.platform == Common::kPlatformPC) - _soundData = soundData_PC; - else if (_flags.platform == Common::kPlatformFMTowns) - _soundData = soundData_TOWNS; - else if (_flags.platform == Common::kPlatformPC98) - _soundData = soundData_TOWNS/*soundData_PC98*/; + if (_flags.platform == Common::kPlatformPC) { + _soundData[0]._fileList = _musicFileListIntro; + _soundData[0]._fileListLen = _musicFileListIntroSize; + _soundData[0]._cdaTracks = 0; + _soundData[0]._cdaNumTracks = 0; + _soundData[1]._fileList = _musicFileListIngame; + _soundData[1]._fileListLen = _musicFileListIngameSize; + _soundData[1]._cdaTracks = 0; + _soundData[1]._cdaNumTracks = 0; + _soundData[2]._fileList = _musicFileListFinale; + _soundData[2]._fileListLen = _musicFileListIntroSize; + _soundData[2]._cdaTracks = 0; + _soundData[2]._cdaNumTracks = 0; + } else if (_flags.platform == Common::kPlatformFMTowns) { + _soundData[0]._fileList = fmtMusicFileListIntro; + _soundData[0]._fileListLen = 1; + _soundData[0]._cdaTracks = _cdaTrackTableIntro; + _soundData[0]._cdaNumTracks = _cdaTrackTableIntroSize >> 1; + _soundData[1]._fileList = fmtMusicFileListIngame; + _soundData[1]._fileListLen = 1; + _soundData[1]._cdaTracks = _cdaTrackTableIngame; + _soundData[1]._cdaNumTracks = _cdaTrackTableIngameSize >> 1; + _soundData[2]._fileList = fmtMusicFileListFinale; + _soundData[2]._fileListLen = 1; + _soundData[2]._cdaTracks = _cdaTrackTableFinale; + _soundData[2]._cdaNumTracks = _cdaTrackTableFinaleSize >> 1; + } else if (_flags.platform == Common::kPlatformPC98) { + _soundData[0]._fileList = pc98MusicFileListIntro; + _soundData[0]._fileListLen = 1; + _soundData[0]._cdaTracks = 0; + _soundData[0]._cdaNumTracks = 0; + _soundData[1]._fileList = pc98MusicFileListIngame; + _soundData[1]._fileListLen = 1; + _soundData[1]._cdaTracks = 0; + _soundData[1]._cdaNumTracks = 0; + _soundData[2]._fileList = pc98MusicFileListFinale; + _soundData[2]._fileListLen = 1; + _soundData[2]._cdaTracks = 0; + _soundData[2]._cdaNumTracks = 0; + } // setup sequence data _sequences = _staticres->loadHofSequenceData(k2SeqplaySeqData, tmpSize); @@ -1336,8 +1376,17 @@ void KyraEngine_HoF::initStaticResource() { &KyraEngine_HoF::seq_demoDig, 0 }; - _callbackS = (_flags.isDemo && !_flags.isTalkie) ? hofDemoSequenceCallbacks : hofSequenceCallbacks; - _callbackN = (_flags.isDemo && !_flags.isTalkie) ? hofDemoNestedSequenceCallbacks : hofNestedSequenceCallbacks; + static const SeqProc lolDemoSequenceCallbacks[] = { + &KyraEngine_HoF::seq_lolDemoScene1, 0, &KyraEngine_HoF::seq_lolDemoScene2, 0, + &KyraEngine_HoF::seq_lolDemoScene3, 0, &KyraEngine_HoF::seq_lolDemoScene4, 0, + &KyraEngine_HoF::seq_lolDemoScene5, &KyraEngine_HoF::seq_lolDemoText5, + &KyraEngine_HoF::seq_lolDemoScene6, 0 + }; + + static const SeqProc lolDemoNestedSequenceCallbacks[] = { 0 }; + + _callbackS = _flags.gameID == GI_LOL ? lolDemoSequenceCallbacks : ((_flags.isDemo && !_flags.isTalkie) ? hofDemoSequenceCallbacks : hofSequenceCallbacks); + _callbackN = _flags.gameID == GI_LOL ? lolDemoNestedSequenceCallbacks : ((_flags.isDemo && !_flags.isTalkie) ? hofDemoNestedSequenceCallbacks : hofNestedSequenceCallbacks); } void KyraEngine_MR::initStaticResource() { |