diff options
author | Johannes Schickel | 2008-01-27 02:05:37 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-01-27 02:05:37 +0000 |
commit | 33a90c1e009cf93e9f135817b8fdb12706811972 (patch) | |
tree | d244fae31db60daab36f68ec679e4ceab2fdbf4c /engines/kyra | |
parent | 223f22c7730fe857cf6587e4c1ea6def6e458096 (diff) | |
download | scummvm-rg350-33a90c1e009cf93e9f135817b8fdb12706811972.tar.gz scummvm-rg350-33a90c1e009cf93e9f135817b8fdb12706811972.tar.bz2 scummvm-rg350-33a90c1e009cf93e9f135817b8fdb12706811972.zip |
Commit patch #1869752 "KYRA: HoF startup patch for towns and floppy". (Slightly modified)
svn-id: r30645
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/kyra.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/kyra_v2.cpp | 91 | ||||
-rw-r--r-- | engines/kyra/kyra_v2.h | 6 | ||||
-rw-r--r-- | engines/kyra/resource.h | 2 | ||||
-rw-r--r-- | engines/kyra/scene_v2.cpp | 10 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 12 |
6 files changed, 90 insertions, 35 deletions
diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp index 2d84a781e5..d7dcab7da8 100644 --- a/engines/kyra/kyra.cpp +++ b/engines/kyra/kyra.cpp @@ -162,6 +162,10 @@ int KyraEngine::init() { _lang = 2; break; + case Common::JA_JPN: + _lang = 3; + break; + default: warning("unsupported language, switching back to English"); _lang = 0; diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 5577079f01..dedf81f979 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -67,6 +67,7 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags) : KyraEngi _newChapterFile = 1; _oldTalkFile = -1; _currentTalkFile = 0; + _lastSfxTrack = -1; _handItemSet = -1; _lastProcessedSceneScript = 0; _specialSceneScriptRunFlag = false; @@ -212,18 +213,20 @@ void KyraEngine_v2::startup() { _screen->setMouseCursor(0, 0, getShapePtr(0)); _screenBuffer = new uint8[64000]; - - loadCCodeBuffer("C_CODE.XXX"); - loadOptionsBuffer("OPTIONS.XXX"); - loadChapterBuffer(_newChapterFile); - _unkBuf200kByte = new uint8[200000]; - showMessageFromCCode(265, 150, 0); + loadChapterBuffer(_newChapterFile); - openTalkFile(0); - _currentTalkFile = 1; - openTalkFile(1); + loadCCodeBuffer("C_CODE.XXX"); + + if (_flags.isTalkie) { + loadOptionsBuffer("OPTIONS.XXX"); + + showMessageFromCCode(265, 150, 0); + openTalkFile(0); + _currentTalkFile = 1; + openTalkFile(1); + } showMessage(0, 207); @@ -806,7 +809,7 @@ const uint8 *KyraEngine_v2::getTableEntry(const uint8 *buffer, int id) { const char *KyraEngine_v2::getTableString(int id, const uint8 *buffer, int decode) { const char *string = (const char*)getTableEntry(buffer, id); - if (decode) { + if (decode && _flags.lang != Common::JA_JPN) { decodeString1(string, _internStringBuf); decodeString2(_internStringBuf, _internStringBuf); string = _internStringBuf; @@ -920,15 +923,18 @@ void KyraEngine_v2::updateCommandLineEx(int str1, int str2, int16 palIndex) { strcpy(src, getTableString(str1, _cCodeBuffer, 1)); - while (*src != 0x20) + if (_flags.lang != Common::JA_JPN) { + while (*src != 0x20) + ++src; ++src; - ++src; - - *src = toupper(*src); + *src = toupper(*src); + } + strcpy((char*)_unkBuf500Bytes, src); if (str2 > 0) { - strcat((char*)_unkBuf500Bytes, " "); + if (_flags.lang != Common::JA_JPN) + strcat((char*)_unkBuf500Bytes, " "); strcat((char*)_unkBuf500Bytes, getTableString(str2, _cCodeBuffer, 1)); } @@ -1013,22 +1019,28 @@ void KyraEngine_v2::loadNPCScript() { char filename[12]; strcpy(filename, "_NPC.EMC"); - switch (_lang) { - case 0: - filename[5] = 'E'; - break; + if (_flags.platform != Common::kPlatformPC || _flags.isTalkie) { + switch (_lang) { + case 0: + filename[5] = 'E'; + break; - case 1: - filename[5] = 'F'; - break; + case 1: + filename[5] = 'F'; + break; - case 2: - filename[5] = 'G'; - break; + case 2: + filename[5] = 'G'; + break; - default: - break; - }; + case 3: + filename[5] = 'J'; + break; + + default: + break; + }; + } _scriptInterpreter->loadScript(filename, &_npcScriptData, &_opcodes); } @@ -1552,10 +1564,33 @@ void KyraEngine_v2::snd_loadSoundFile(int id) { } void KyraEngine_v2::playVoice(int high, int low) { + if (!_flags.isTalkie) + return; int vocFile = high * 10000 + low * 10; snd_playVoiceFile(vocFile); } +void KyraEngine_v2::snd_playSoundEffect(int track) { + debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v2::snd_playSoundEffect(%d)", track); + + if (track == 10) + track = _lastSfxTrack; + + if (track == 10 || track == -1) + return; + + _lastSfxTrack = track; + + int16 vocIndex = (int16) READ_LE_UINT16(&_ingameSoundIndex[track * 2]); + if (vocIndex != -1) + _sound->voicePlay(_ingameSoundList[vocIndex]); + else if (_flags.platform == Common::kPlatformPC) + // TODO ?? Maybe there is a way to let users select whether they want + // voc, midi or adl sfx (even though it makes no sense to choose anything but voc). + // For now this is used as a fallback only (if no voc file exists). + KyraEngine::snd_playSoundEffect(track); +} + #pragma mark - void KyraEngine_v2::loadInvWsa(const char *filename, int run, int delayTime, int page, int sfx, int sFrame, int flags) { diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index 7b7f61b3d5..db415aaffb 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -642,11 +642,13 @@ protected: int _oldTalkFile; int _currentTalkFile; void openTalkFile(int newFile); + int _lastSfxTrack; virtual void snd_playVoiceFile(int id); void snd_loadSoundFile(int id); void playVoice(int high, int low); + void snd_playSoundEffect(int track); // timer void timerFunc2(int); @@ -869,6 +871,10 @@ protected: int _cdaTrackTableFinaleSize; const char *const *_sequenceSoundList; int _sequenceSoundListSize; + const char *const *_ingameSoundList; + int _ingameSoundListSize; + const uint16 *_ingameSoundIndex; + int _ingameSoundIndexSize; const char *const *_sequenceStrings; int _sequenceStringsSize; int _sequenceStringsDuration[33]; diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h index f6a81d3d35..c237051703 100644 --- a/engines/kyra/resource.h +++ b/engines/kyra/resource.h @@ -236,6 +236,8 @@ enum kKyraResources { k2SeqplayFinaleCDA, k2IngamePakFiles, + k2IngameSfxFiles, + k2IngameSfxIndex, k2IngameTracks, k2IngameCDA, diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp index dd1dd1c8b0..b9ed041206 100644 --- a/engines/kyra/scene_v2.cpp +++ b/engines/kyra/scene_v2.cpp @@ -35,9 +35,11 @@ namespace Kyra { void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk2, int unk3) { if (_newChapterFile != _currentTalkFile) { _currentTalkFile = _newChapterFile; - showMessageFromCCode(265, 150, 0); - _screen->updateScreen(); - openTalkFile(_currentTalkFile); + if (_flags.isTalkie) { + showMessageFromCCode(265, 150, 0); + _screen->updateScreen(); + openTalkFile(_currentTalkFile); + } showMessage(0, 207); _screen->updateScreen(); } @@ -425,7 +427,7 @@ void KyraEngine_v2::startSceneScript(int unk1) { strcpy(filename, _sceneList[sceneId].filename); strcat(filename, "."); - strcat(filename, _scriptLangExt[_lang]); + strcat(filename, _scriptLangExt[(_flags.platform == Common::kPlatformPC && !_flags.isTalkie) ? 0 : _lang]); assert(_res->getFileSize(filename)); _scriptInterpreter->loadScript(filename, &_sceneScriptData, &_opcodes); diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index f829e28a14..ea73882d43 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -35,7 +35,7 @@ namespace Kyra { -#define RESFILE_VERSION 18 +#define RESFILE_VERSION 19 bool StaticResource::checkKyraDat() { Common::File kyraDat; @@ -239,6 +239,8 @@ bool StaticResource::init() { // Ingame { k2IngamePakFiles, kStringList, "I_PAKFILES.TXT" }, + { k2IngameSfxFiles, kStringList, "I_SFXFILES.TXT" }, + { k2IngameSfxIndex, kRawData, "I_SFXINDEX.TRA" }, { k2IngameTracks, kStringList, "I_TRACKS.TRA" }, { k2IngameCDA, kRawData, "I_TRACKS.CDA" }, @@ -914,6 +916,8 @@ void KyraEngine_v2::initStaticResource() { _ingamePakList = _staticres->loadStrings(k2IngamePakFiles, _ingamePakListSize); _sequenceStrings = _staticres->loadStrings(k2SeqplayStrings, _sequenceStringsSize); _sequenceSoundList = _staticres->loadStrings(k2SeqplaySfxFiles, _sequenceSoundListSize); + _ingameSoundList = _staticres->loadStrings(k2IngameSfxFiles, _ingameSoundListSize); + _ingameSoundIndex = (const uint16*) _staticres->loadRawData(k2IngameSfxIndex, _ingameSoundIndexSize); _musicFileListIntro = _staticres->loadStrings(k2SeqplayIntroTracks, _musicFileListIntroSize); _musicFileListIngame = _staticres->loadStrings(k2IngameTracks, _musicFileListIngameSize); _musicFileListFinale = _staticres->loadStrings(k2SeqplayFinaleTracks, _musicFileListFinaleSize); @@ -1340,17 +1344,19 @@ const uint8 KyraEngine_v2::_seqTextColorPresets[] = { 0x01, 0x01, 0x00, 0x3f, 0x const char *KyraEngine_v2::_languageExtension[] = { "ENG", "FRE", - "GER"/*, + "GER",/*, "ITA", Italian and Spanish was never included "SPA"*/ + "JPN" }; const char *KyraEngine_v2::_scriptLangExt[] = { "EMC", "FMC", - "GMC"/*, + "GMC",/*, "IMC", Italian and Spanish was never included "SMC"*/ + "JMC" }; const int KyraEngine_v2::_characterFrameTable[] = { |