Ticket #8782: hofStartupFix_V2 plus ingame sfx.patch
File hofStartupFix_V2 plus ingame sfx.patch, 7.6 KB (added by , 13 years ago) |
---|
-
kyra.cpp
162 162 _lang = 2; 163 163 break; 164 164 165 case Common::JA_JPN: 166 _lang = 3; 167 break; 168 165 169 default: 166 170 warning("unsupported language, switching back to English"); 167 171 _lang = 0; -
kyra_v2.cpp
67 67 _newChapterFile = 1; 68 68 _oldTalkFile = -1; 69 69 _currentTalkFile = 0; 70 _lastSfxTrack = -1; 70 71 _handItemSet = -1; 71 72 _lastProcessedSceneScript = 0; 72 73 _specialSceneScriptRunFlag = false; … … 212 213 _screen->setMouseCursor(0, 0, getShapePtr(0)); 213 214 214 215 _screenBuffer = new uint8[64000]; 216 _unkBuf200kByte = new uint8[200000]; 215 217 218 loadChapterBuffer(_newChapterFile); 219 216 220 loadCCodeBuffer("C_CODE.XXX"); 217 loadOptionsBuffer("OPTIONS.XXX"); 218 loadChapterBuffer(_newChapterFile); 221 222 if (_flags.isTalkie) { 223 loadOptionsBuffer("OPTIONS.XXX"); 219 224 220 _unkBuf200kByte = new uint8[200000]; 225 showMessageFromCCode(265, 150, 0); 226 openTalkFile(0); 227 _currentTalkFile = 1; 228 openTalkFile(1); 229 } 221 230 222 showMessageFromCCode(265, 150, 0);223 224 openTalkFile(0);225 _currentTalkFile = 1;226 openTalkFile(1);227 228 231 showMessage(0, 207); 229 232 230 233 _screen->setShapePages(5, 3); … … 806 809 const char *KyraEngine_v2::getTableString(int id, const uint8 *buffer, int decode) { 807 810 const char *string = (const char*)getTableEntry(buffer, id); 808 811 809 if (decode ) {812 if (decode && _flags.lang != Common::JA_JPN) { 810 813 decodeString1(string, _internStringBuf); 811 814 decodeString2(_internStringBuf, _internStringBuf); 812 815 string = _internStringBuf; … … 920 923 921 924 strcpy(src, getTableString(str1, _cCodeBuffer, 1)); 922 925 923 while (*src != 0x20) 926 if (_flags.lang != Common::JA_JPN) { 927 while (*src != 0x20) 928 ++src; 924 929 ++src; 925 ++src;926 927 *src = toupper(*src);930 *src = toupper(*src); 931 } 932 928 933 strcpy((char*)_unkBuf500Bytes, src); 929 934 930 935 if (str2 > 0) { 931 strcat((char*)_unkBuf500Bytes, " "); 936 if (_flags.lang != Common::JA_JPN) 937 strcat((char*)_unkBuf500Bytes, " "); 932 938 strcat((char*)_unkBuf500Bytes, getTableString(str2, _cCodeBuffer, 1)); 933 939 } 934 940 … … 1013 1019 char filename[12]; 1014 1020 strcpy(filename, "_NPC.EMC"); 1015 1021 1016 switch (_lang) { 1017 case 0: 1018 filename[5] = 'E'; 1019 break; 1022 if (_flags.platform != Common::kPlatformPC || _flags.isTalkie) { 1023 switch (_lang) { 1024 case 0: 1025 filename[5] = 'E'; 1026 break; 1020 1027 1021 case 1:1022 filename[5] = 'F';1023 break;1028 case 1: 1029 filename[5] = 'F'; 1030 break; 1024 1031 1025 case 2:1026 filename[5] = 'G';1027 break;1032 case 2: 1033 filename[5] = 'G'; 1034 break; 1028 1035 1029 default:1030 break;1031 };1036 case 3: 1037 filename[5] = 'J'; 1038 break; 1032 1039 1040 default: 1041 break; 1042 }; 1043 } 1044 1033 1045 _scriptInterpreter->loadScript(filename, &_npcScriptData, &_opcodes); 1034 1046 } 1035 1047 … … 1552 1564 } 1553 1565 1554 1566 void KyraEngine_v2::playVoice(int high, int low) { 1567 if (!_flags.isTalkie) 1568 return; 1555 1569 int vocFile = high * 10000 + low * 10; 1556 1570 snd_playVoiceFile(vocFile); 1557 1571 } 1558 1572 1573 void KyraEngine_v2::snd_playSoundEffect(int track) { 1574 debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v2::snd_playSoundEffect(%d)", track); 1575 1576 if (track == 10) 1577 track = _lastSfxTrack; 1578 1579 if (track == 10 || track == -1) 1580 return; 1581 1582 _lastSfxTrack = track; 1583 1584 int16 vocIndex = (int16) READ_LE_UINT16(&_ingameSoundIndex[track * 2]); 1585 if (vocIndex != -1) 1586 _sound->voicePlay(_ingameSoundList[vocIndex]); 1587 else if (_flags.platform == Common::kPlatformPC) 1588 // TODO ?? Maybe there is a way to let users select whether they want 1589 // voc, midi or adl sfx (even though it makes no sense to choose anything but voc). 1590 // For now this is used as a fallback only (if no voc file exists). 1591 KyraEngine::snd_playSoundEffect(track); 1592 } 1593 1559 1594 #pragma mark - 1560 1595 1561 1596 void KyraEngine_v2::loadInvWsa(const char *filename, int run, int delayTime, int page, int sfx, int sFrame, int flags) { -
kyra_v2.h
642 642 int _oldTalkFile; 643 643 int _currentTalkFile; 644 644 void openTalkFile(int newFile); 645 int _lastSfxTrack; 645 646 646 647 virtual void snd_playVoiceFile(int id); 647 648 void snd_loadSoundFile(int id); 648 649 649 650 void playVoice(int high, int low); 651 void snd_playSoundEffect(int track); 650 652 651 653 // timer 652 654 void timerFunc2(int); … … 869 871 int _cdaTrackTableFinaleSize; 870 872 const char *const *_sequenceSoundList; 871 873 int _sequenceSoundListSize; 874 const char *const *_ingameSoundList; 875 int _ingameSoundListSize; 876 const uint16 *_ingameSoundIndex; 877 int _ingameSoundIndexSize; 872 878 const char *const *_sequenceStrings; 873 879 int _sequenceStringsSize; 874 880 int _sequenceStringsDuration[33]; -
resource.h
236 236 k2SeqplayFinaleCDA, 237 237 238 238 k2IngamePakFiles, 239 k2IngameSfxFiles, 240 k2IngameSfxIndex, 239 241 k2IngameTracks, 240 242 k2IngameCDA, 241 243 -
scene_v2.cpp
35 35 void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk2, int unk3) { 36 36 if (_newChapterFile != _currentTalkFile) { 37 37 _currentTalkFile = _newChapterFile; 38 showMessageFromCCode(265, 150, 0); 39 _screen->updateScreen(); 40 openTalkFile(_currentTalkFile); 38 if (_flags.isTalkie) { 39 showMessageFromCCode(265, 150, 0); 40 _screen->updateScreen(); 41 openTalkFile(_currentTalkFile); 42 } 41 43 showMessage(0, 207); 42 44 _screen->updateScreen(); 43 45 } … … 425 427 426 428 strcpy(filename, _sceneList[sceneId].filename); 427 429 strcat(filename, "."); 428 strcat(filename, _scriptLangExt[ _lang]);430 strcat(filename, _scriptLangExt[(_flags.platform == Common::kPlatformPC && !_flags.isTalkie) ? 0 : _lang]); 429 431 430 432 assert(_res->getFileSize(filename)); 431 433 _scriptInterpreter->loadScript(filename, &_sceneScriptData, &_opcodes); -
staticres.cpp
239 239 240 240 // Ingame 241 241 { k2IngamePakFiles, kStringList, "I_PAKFILES.TXT" }, 242 { k2IngameSfxFiles, kStringList, "I_SFXFILES.TXT" }, 243 { k2IngameSfxIndex, kRawData, "I_SFXINDEX.TRA" }, 242 244 { k2IngameTracks, kStringList, "I_TRACKS.TRA" }, 243 245 { k2IngameCDA, kRawData, "I_TRACKS.CDA" }, 244 246 … … 914 916 _ingamePakList = _staticres->loadStrings(k2IngamePakFiles, _ingamePakListSize); 915 917 _sequenceStrings = _staticres->loadStrings(k2SeqplayStrings, _sequenceStringsSize); 916 918 _sequenceSoundList = _staticres->loadStrings(k2SeqplaySfxFiles, _sequenceSoundListSize); 919 _ingameSoundList = _staticres->loadStrings(k2IngameSfxFiles, _ingameSoundListSize); 920 _ingameSoundIndex = (const uint16*) _staticres->loadRawData(k2IngameSfxIndex, _ingameSoundIndexSize); 917 921 _musicFileListIntro = _staticres->loadStrings(k2SeqplayIntroTracks, _musicFileListIntroSize); 918 922 _musicFileListIngame = _staticres->loadStrings(k2IngameTracks, _musicFileListIngameSize); 919 923 _musicFileListFinale = _staticres->loadStrings(k2SeqplayFinaleTracks, _musicFileListFinaleSize); … … 1340 1344 const char *KyraEngine_v2::_languageExtension[] = { 1341 1345 "ENG", 1342 1346 "FRE", 1343 "GER" /*,1347 "GER",/*, 1344 1348 "ITA", Italian and Spanish was never included 1345 1349 "SPA"*/ 1350 "JPN" 1346 1351 }; 1347 1352 1348 1353 const char *KyraEngine_v2::_scriptLangExt[] = { 1349 1354 "EMC", 1350 1355 "FMC", 1351 "GMC" /*,1356 "GMC",/*, 1352 1357 "IMC", Italian and Spanish was never included 1353 1358 "SMC"*/ 1359 "JMC" 1354 1360 }; 1355 1361 1356 1362 const int KyraEngine_v2::_characterFrameTable[] = {