Ticket #8739: kyra2sequence.patch
File kyra2sequence.patch, 93.6 KB (added by , 16 years ago) |
---|
-
kyra_v2.cpp
45 45 _screen = 0; 46 46 _text = 0; 47 47 48 _pageBuffer1 = _pageBuffer2 = 0;49 48 _seqProcessedString = 0; 50 49 _activeWSA = 0; 51 50 _activeText = 0; 52 51 _seqWsa = 0; 53 52 54 53 _gamePlayBuffer = 0; 55 54 _cCodeBuffer = _optionsBuffer = _chapterBuffer = 0; 56 55 57 56 _overwriteSceneFacing = false; 58 57 _mainCharX = _mainCharY = -1; 59 58 _drawNoShapeFlag = false; … … 80 79 _chatVocLow = -1; 81 80 _chatText = 0; 82 81 _chatObject = -1; 83 82 84 83 _currentTalkSections.STATim = NULL; 85 84 _currentTalkSections.TLKTim = NULL; 86 85 _currentTalkSections.ENDTim = NULL; 87 86 88 87 memset(&_sceneScriptData, 0, sizeof(_sceneScriptData)); 89 88 } 90 89 … … 114 113 assert(_debugger); 115 114 _text = new TextDisplayer_v2(this, _screen); 116 115 assert(_text); 117 116 118 117 setupTimers(); 119 118 120 119 _screen->loadFont(_screen->FID_6_FNT, "6.FNT"); … … 123 122 _screen->loadFont(_screen->FID_BOOKFONT_FNT, "BOOKFONT.FNT"); 124 123 _screen->setAnimBlockPtr(3504); 125 124 _screen->setScreenDim(0); 126 127 for (int i = 0; i < 33; i++) 128 _sequenceStringsDuration[i] = strlen(_sequenceStrings[i]) * 8; 129 125 130 126 _abortIntroFlag = false; 131 127 132 _sequenceSoundList = (const char * const *) _sequenceSoundListPC; 133 _sequenceSoundListSize = _sequenceSoundListPCSize; 128 // temporary solution until staticres manager support (kyra.dat) is added for kyra 2 129 if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) { 130 _sequenceSoundList = (const char * const *) _sequenceSoundList_TOWNS; 131 _sequenceSoundListSize = _sequenceSoundListSize_TOWNS; 132 _sequenceStrings = (const char * const *) _sequenceStrings_TOWNS_EN; 133 _sequenceStringsSize = _sequenceStringsSize_TOWNS_EN; 134 _sequences = (const Sequence*) _sequences_TOWNS; 135 } else { 136 _sequenceSoundList = (const char * const *) _sequenceSoundList_PC; 137 _sequenceSoundListSize = _sequenceSoundListSize_PC; 138 _sequenceStrings = (const char * const *) _sequenceStrings_PC_EN; 139 _sequenceStringsSize = _sequenceStringsSize_PC_EN; 140 _sequences = (const Sequence*) _sequences_PC; 141 } 134 142 143 for (int i = 0; i < 33; i++) 144 _sequenceStringsDuration[i] = strlen(_sequenceStrings[i]) * 8; 145 135 146 // No mouse display in demo 136 147 if (_flags.isDemo) 137 148 return 0; … … 149 160 } 150 161 151 162 int KyraEngine_v2::go() { 152 // TODO move this to a better location, since for ingame we setup 153 // our soundfile list in KyraEngine_v2::startup for example 154 // so this should be just used in the sequenceplayer code, 155 // so maybe move this to KyraEngine_v2::seq_init 156 if (_flags.isDemo) { 157 static const char *soundFileList[] = { 158 "K2_DEMO", 159 "LOLSYSEX" 160 }; 161 _sound->setSoundFileList(soundFileList, 2); 162 } else { 163 // TODO: move this to proper place 164 static const char *soundFileList[] = { 165 "K2INTRO" 166 }; 167 _sound->setSoundFileList(soundFileList, 1); 168 } 169 _sound->loadSoundFile(0); 170 171 // Temporary measure to work around the fact that there's 163 // Temporary measure to work around the fact that there's 172 164 // several WSA files with identical names in different PAK files. 173 165 _res->unloadPakFile("OUTFARM.PAK"); 174 166 _res->unloadPakFile("FLYTRAP.PAK"); 175 167 176 168 seq_playSequences(kSequenceVirgin, kSequenceZanfaun); 169 //seq_playSequences(kSequenceFunters, kSequenceFrash); 177 170 178 171 if (_menuChoice == 1) { 179 172 startup(); 180 173 runLoop(); 181 174 cleanup(); 182 175 } else if (_menuChoice == 3) { 183 // Load Savegame176 // Load Game 184 177 } 185 178 186 179 return 0; … … 199 192 memset(_sceneShapeTable, 0, sizeof(_sceneShapeTable)); 200 193 _gamePlayBuffer = new uint8[46080]; 201 194 _unkBuf500Bytes = new uint8[500]; 202 195 203 196 loadMouseShapes(); 204 197 loadItemShapes(); 205 198 206 199 _screen->setMouseCursor(0, 0, getShapePtr(0)); 207 200 208 201 _screenBuffer = new uint8[64000]; 209 202 210 203 loadCCodeBuffer("C_CODE.XXX"); 211 204 loadOptionsBuffer("OPTIONS.XXX"); 212 205 loadChapterBuffer(_newChapterFile); 213 206 214 207 _unkBuf200kByte = new uint8[200000]; 215 208 216 209 showMessageFromCCode(265, 150, 0); 217 210 218 211 openTalkFile(0); 219 212 _currentTalkFile = 1; 220 213 openTalkFile(1); 221 214 222 215 showMessage(0, 207); 223 216 224 217 _screen->setShapePages(5, 3); 225 218 226 219 memset(&_mainCharacter, 0, sizeof(_mainCharacter)); … … 228 221 _mainCharacter.facing = 4; 229 222 _mainCharacter.animFrame = 0x12; 230 223 memset(_mainCharacter.inventory, -1, sizeof(_mainCharacter.inventory)); 231 224 232 225 memset(_sceneAnims, 0, sizeof(_sceneAnims)); 233 226 for (int i = 0; i < ARRAYSIZE(_sceneAnimMovie); ++i) 234 227 _sceneAnimMovie[i] = new WSAMovieV2(this); 235 228 memset(_wsaSlots, 0, sizeof(_wsaSlots)); 236 229 for (int i = 0; i < ARRAYSIZE(_wsaSlots); ++i) 237 230 _wsaSlots[i] = new WSAMovieV2(this); 238 231 239 232 _maskPage = 0;//_screen->getPagePtr(5); 240 233 _screen->_curPage = 0; 241 234 242 235 _talkObjectList = new TalkObject[72]; 243 236 memset(_talkObjectList, 0, sizeof(TalkObject)*72); 244 237 _shapeDescTable = new ShapeDesc[55]; 245 238 memset(_shapeDescTable, 0, sizeof(ShapeDesc)*55); 246 239 247 240 for (int i = 9; i <= 32; ++i) { 248 241 _shapeDescTable[i-9].width = 30; 249 242 _shapeDescTable[i-9].height = 55; 250 243 _shapeDescTable[i-9].xAdd = -15; 251 244 _shapeDescTable[i-9].yAdd = -50; 252 245 } 253 246 254 247 for (int i = 19; i <= 24; ++i) { 255 248 _shapeDescTable[i-9].width = 53; 256 249 _shapeDescTable[i-9].yAdd = -51; 257 250 } 258 251 259 252 _gfxBackUpRect = new uint8[_screen->getRectSize(32, 32)]; 260 253 _itemList = new Item[30]; 261 254 memset(_itemList, 0, sizeof(Item)*30); … … 270 263 _screen->copyPage(3, 0); 271 264 _screen->showMouse(); 272 265 _screen->hideMouse(); 273 266 274 267 clearAnimObjects(); 275 268 276 269 // XXX 277 270 278 271 _sceneList = new SceneDesc[86]; 279 272 memset(_sceneList, 0, sizeof(SceneDesc)*86); 280 273 _sceneListSize = 86; 281 274 runStartScript(1, 0); 282 275 loadNPCScript(); 283 276 284 277 // XXX 285 278 snd_playWanderScoreViaMap(52, 1); 286 279 // XXX 287 280 288 281 enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1); 289 282 _screen->showMouse(); 290 283 291 284 //sub_20EE8(1); 292 285 //setNextIdleAnimTimer(); 293 286 //XXX … … 296 289 297 290 void KyraEngine_v2::runLoop() { 298 291 _screen->updateScreen(); 299 292 300 293 _quitFlag = false; 301 294 while (!_quitFlag) { 302 295 //XXX … … 321 314 _unk5 = 0; 322 315 return; 323 316 } 324 317 325 318 if (!_screen->isMouseVisible()) 326 319 return; 327 320 328 321 if (_unk3 == -2) { 329 322 snd_playSoundEffect(13); 330 323 return; 331 324 } 332 325 333 326 //setNextIdleAnimTimer(); 334 327 335 328 if (x <= 6 || x >= 312 || y <= 6 || y >= 135) { 336 329 bool exitOk = false; 337 330 assert(_unk3 + 6 >= 0); … … 340 333 if (_sceneExit1 != 0xFFFF) 341 334 exitOk = true; 342 335 break; 343 336 344 337 case 1: 345 338 if (_sceneExit2 != 0xFFFF) 346 339 exitOk = true; 347 340 break; 348 341 349 342 case 2: 350 343 if (_sceneExit3 != 0xFFFF) 351 344 exitOk = true; 352 345 break; 353 346 354 347 case 3: 355 348 if (_sceneExit4 != 0xFFFF) 356 349 exitOk = true; 357 350 break; 358 351 359 352 default: 360 353 break; 361 354 } 362 355 363 356 if (exitOk) { 364 357 inputSceneChange(x, y, 1, 1); 365 358 return; 366 359 } 367 360 } 368 361 369 362 if (checkCharCollision(x, y) >= 0 && _unk3 >= -1) { 370 363 runSceneScript2(); 371 364 return; … … 391 384 392 385 //if (_unk1 <= -1) 393 386 // skipHandling = 1; 394 387 395 388 if (skipHandling) 396 389 return; 397 390 … … 429 422 return true; 430 423 } else { 431 424 _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); 432 425 433 426 _sceneScriptState.regs[1] = x; 434 427 _sceneScriptState.regs[2] = y; 435 428 _sceneScriptState.regs[3] = 0; 436 429 _sceneScriptState.regs[4] = _itemInHand; 437 430 438 431 _scriptInterpreter->startScript(&_sceneScriptState, 1); 439 432 440 433 while (_scriptInterpreter->validScript(&_sceneScriptState)) … … 492 485 int type = 0; 493 486 int xOffset = 0, yOffset = 0; 494 487 Common::Point mouse = getMousePos(); 495 488 496 489 if (mouse.y <= 145) { 497 490 if (mouse.x <= 6) { 498 491 if (_sceneExit4 != 0xFFFF) { … … 511 504 yOffset = 5; 512 505 } else { 513 506 type = -2; 514 } 507 } 515 508 } else if (mouse.y >= 135) { 516 509 if (_sceneExit3 != 0xFFFF) { 517 510 type = -4; … … 520 513 yOffset = 10; 521 514 } else { 522 515 type = -2; 523 } 516 } 524 517 } else if (mouse.y <= 6) { 525 518 if (_sceneExit1 != 0xFFFF) { 526 519 type = -6; … … 529 522 yOffset = 1; 530 523 } else { 531 524 type = -2; 532 } 525 } 533 526 } 534 527 } 535 528 536 529 for (int i = 0; i < _specialExitCount; ++i) { 537 530 if (checkSpecialSceneExit(i, mouse.x, mouse.y)) { 538 531 switch (_specialExitTable[20+i]) { … … 542 535 xOffset = 5; 543 536 yOffset = 1; 544 537 break; 545 538 546 539 case 2: 547 540 type = -5; 548 541 shapeIndex = 2; 549 542 xOffset = 7; 550 543 yOffset = 5; 551 544 break; 552 545 553 546 case 4: 554 547 type = -4; 555 548 shapeIndex = 3; 556 549 xOffset = 5; 557 550 yOffset = 7; 558 551 break; 559 552 560 553 case 6: 561 554 type = -3; 562 555 shapeIndex = 4; 563 556 xOffset = 1; 564 557 yOffset = 5; 565 558 break; 566 559 567 560 default: 568 561 break; 569 562 } 570 563 } 571 564 } 572 565 573 566 if (type == -2) { 574 567 shapeIndex = 5; 575 568 xOffset = 5; 576 569 yOffset = 9; 577 570 } 578 571 579 572 if (type != 0 && _handItemSet != type) { 580 573 _handItemSet = type; 581 574 _screen->hideMouse(); 582 575 _screen->setMouseCursor(xOffset, yOffset, getShapePtr(shapeIndex)); 583 576 _screen->showMouse(); 584 577 } 585 578 586 579 if (type == 0 && _handItemSet != _itemInHand) { 587 580 if ((mouse.y > 145) || (mouse.x > 6 && mouse.x < 312 && mouse.y > 6 && mouse.y < 135)) { 588 581 _handItemSet = _itemInHand; … … 619 612 // as when RETURN was pressed, but it *should* work for now 620 613 Common::Point pos = getMousePos(); 621 614 _mouseX = pos.x; 622 _mouseY = pos.y; 615 _mouseY = pos.y; 623 616 keys = 199; 624 617 } 625 618 … … 640 633 case Common::EVENT_QUIT: 641 634 _quitFlag = true; 642 635 break; 643 636 644 637 default: 645 638 break; 646 639 } 647 640 648 641 if (_debugger->isAttached()) 649 642 _debugger->onFrame(); 650 643 … … 653 646 654 647 _eventList.erase(_eventList.begin()); 655 648 } 656 649 657 650 _system->delayMillis(10); 658 651 return keys; 659 652 } … … 686 679 delete [] _unkBuf500Bytes; 687 680 delete [] _screenBuffer; 688 681 delete [] _unkBuf200kByte; 689 682 690 683 resetNewShapes(_newShapeCount, _newShapeFiledata); 691 684 692 685 for (int i = 0; i < ARRAYSIZE(_defaultShapeTable); ++i) 693 686 delete [] _defaultShapeTable[i]; 694 687 freeSceneShapePtrs(); 695 688 696 689 delete [] _cCodeBuffer; 697 690 delete [] _optionsBuffer; 698 691 delete [] _chapterBuffer; 699 692 700 693 delete [] _talkObjectList; 701 694 delete [] _shapeDescTable; 702 695 703 696 delete [] _gfxBackUpRect; 704 697 705 698 delete [] _sceneList; 706 699 707 700 for (int i = 0; i < ARRAYSIZE(_sceneAnimMovie); ++i) 708 701 delete _sceneAnimMovie[i]; 709 702 for (int i = 0; i < ARRAYSIZE(_wsaSlots); ++i) … … 716 709 char tempString[13]; 717 710 strcpy(tempString, file); 718 711 changeFileExtension(tempString); 719 712 720 713 delete [] _cCodeBuffer; 721 714 _cCodeBuffer = _res->fileData(tempString, 0); 722 715 } … … 725 718 char tempString[13]; 726 719 strcpy(tempString, file); 727 720 changeFileExtension(tempString); 728 721 729 722 delete [] _optionsBuffer; 730 723 _optionsBuffer = _res->fileData(tempString, 0); 731 724 } … … 740 733 assert(chapter >= 1 && chapter <= ARRAYSIZE(chapterFilenames)); 741 734 strcpy(tempString, chapterFilenames[chapter-1]); 742 735 changeFileExtension(tempString); 743 736 744 737 delete [] _chapterBuffer; 745 738 _chapterBuffer = _res->fileData(tempString, 0); 746 739 _currentChapter = chapter; … … 759 752 760 753 const char *KyraEngine_v2::getTableString(int id, const uint8 *buffer, int decode) { 761 754 const char *string = (const char*)getTableEntry(buffer, id); 762 755 763 756 if (decode) { 764 757 decodeString1(string, _internStringBuf); 765 758 decodeString2(_internStringBuf, _internStringBuf); 766 759 string = _internStringBuf; 767 760 } 768 761 769 762 return string; 770 763 } 771 764 772 765 const char *KyraEngine_v2::getChapterString(int id) { 773 766 if (_currentChapter != _newChapterFile) 774 767 loadChapterBuffer(_newChapterFile); 775 768 776 769 return getTableString(id, _chapterBuffer, 1); 777 770 } 778 771 … … 781 774 0x20, 0x65, 0x74, 0x61, 0x69, 0x6E, 0x6F, 0x73, 0x72, 0x6C, 0x68, 782 775 0x63, 0x64, 0x75, 0x70, 0x6D 783 776 }; 784 777 785 778 static const uint8 decodeTable2[] = { 786 779 0x74, 0x61, 0x73, 0x69, 0x6F, 0x20, 0x77, 0x62, 0x20, 0x72, 0x6E, 787 780 0x73, 0x64, 0x61, 0x6C, 0x6D, 0x68, 0x20, 0x69, 0x65, 0x6F, 0x72, … … 845 838 _shownMessage = string; 846 839 _screen->hideMouse(); 847 840 _screen->fillRect(0, 190, 319, 199, 0xCF); 848 841 849 842 if (string) { 850 843 if (palIndex != -1 || _msgUnk1) { 851 844 palIndex *= 3; … … 859 852 860 853 setTimer1DelaySecs(7); 861 854 } 862 855 863 856 _msgUnk1 = 0; 864 857 _screen->showMouse(); 865 858 } … … 893 886 894 887 void KyraEngine_v2::loadMouseShapes() { 895 888 _screen->loadBitmap("_MOUSE.CSH", 3, 3, 0); 896 889 897 890 for (int i = 0; i <= 8; ++i) { 898 891 _defaultShapeTable[i] = _screen->makeShapeCopy(_screen->getCPagePtr(3), i); 899 892 assert(_defaultShapeTable[i]); … … 902 895 903 896 void KyraEngine_v2::loadItemShapes() { 904 897 _screen->loadBitmap("_ITEMS.CSH", 3, 3, 0); 905 898 906 899 for (int i = 64; i <= 239; ++i) { 907 900 _defaultShapeTable[i] = _screen->makeShapeCopy(_screen->getCPagePtr(3), i-64); 908 901 assert(_defaultShapeTable[i]); 909 902 } 910 903 911 904 _res->loadFileToBuf("_ITEMHT.DAT", _itemHtDat, sizeof(_itemHtDat)); 912 905 assert(_res->getFileSize("_ITEMHT.DAT") == sizeof(_itemHtDat)); 913 906 914 907 _screen->_curPage = 0; 915 908 } 916 909 917 910 void KyraEngine_v2::loadZShapes(int shapes) { 918 911 char file[10]; 919 912 strcpy(file, "_ZX.SHP"); 920 913 921 914 _loadedZTable = shapes; 922 915 file[2] = '0' + shapes; 923 916 924 917 uint8 *data = _res->fileData(file, 0); 925 918 for (int i = 9; i <= 32; ++i) { 926 919 delete [] _defaultShapeTable[i]; 927 920 _defaultShapeTable[i] = _screen->makeShapeCopy(data, i-9); 928 921 } 929 922 delete [] data; 930 923 931 924 _loadedZTable = shapes; 932 925 } 933 926 934 927 void KyraEngine_v2::loadInventoryShapes() { 935 928 int curPageBackUp = _screen->_curPage; 936 929 _screen->_curPage = 2; 937 930 938 931 _screen->loadBitmap("_PLAYALL.CPS", 3, 3, 0); 939 932 940 933 for (int i = 0; i < 10; ++i) 941 934 _defaultShapeTable[240+i] = _screen->encodeShape(_inventoryX[i], _inventoryY[i], 16, 16, 0); 942 935 943 936 _screen->_curPage = curPageBackUp; 944 937 } 945 938 … … 950 943 951 944 ScriptData scriptData; 952 945 ScriptState scriptState; 953 946 954 947 _scriptInterpreter->loadScript(filename, &scriptData, &_opcodes); 955 948 _scriptInterpreter->initScript(&scriptState, &scriptData); 956 949 scriptState.regs[6] = unk1; … … 963 956 void KyraEngine_v2::loadNPCScript() { 964 957 char filename[12]; 965 958 strcpy(filename, "_NPC.EMC"); 966 959 967 960 switch (_lang) { 968 961 case 0: 969 962 filename[5] = 'E'; 970 963 break; 971 964 972 965 case 1: 973 966 filename[5] = 'F'; 974 967 break; 975 968 976 969 case 2: 977 970 filename[5] = 'G'; 978 971 break; 979 972 980 973 default: 981 974 break; 982 975 }; 983 976 984 977 _scriptInterpreter->loadScript(filename, &_npcScriptData, &_opcodes); 985 978 } 986 979 … … 1005 998 _newShapeFiledata = _res->fileData(_newShapeFilename, 0); 1006 999 assert(_newShapeFiledata); 1007 1000 } 1008 1001 1009 1002 fileData = _newShapeFiledata; 1010 1003 1011 1004 if (!fileData) … … 1108 1101 x = 4; 1109 1102 y = _sceneEnterY4; 1110 1103 _pathfinderFlag = 7; 1111 } 1104 } 1112 1105 } else if (_unk3 == -5) { 1113 1106 if (_sceneList[curScene].exit2 != 0xFFFF) { 1114 1107 x = 316; 1115 1108 y = _sceneEnterY2; 1116 1109 _pathfinderFlag = 7; 1117 } 1110 } 1118 1111 } else if (_unk3 == -6) { 1119 1112 if (_sceneList[curScene].exit1 != 0xFFFF) { 1120 1113 x = _sceneEnterX1; … … 1129 1122 } 1130 1123 } 1131 1124 } 1132 1125 1133 1126 if (_pathfinderFlag) { 1134 1127 if (findItem(curScene, 13) >= 0 && _unk3 <= -3) { 1135 1128 //XXX … … 1149 1142 return 0; 1150 1143 } 1151 1144 } 1152 1145 1153 1146 if (ABS(_mainCharacter.x1 - x) < 4 || ABS(_mainCharacter.y1 - y) < 2) 1154 1147 return 0; 1155 1148 1156 1149 int curX = _mainCharacter.x1 & ~3; 1157 1150 int curY = _mainCharacter.y1 & ~1; 1158 1151 int dstX = x & ~3; 1159 1152 int dstY = y & ~1; 1160 1153 1161 1154 int wayLength = findWay(curX, curY, dstX, dstY, _movFacingTable, 600); 1162 1155 _pathfinderFlag = 0; 1163 1156 _timer->disable(5); 1164 1157 1165 1158 if (wayLength != 0 && wayLength != 0x7D00) 1166 1159 refreshNPC = (trySceneChange(_movFacingTable, unk1, unk2) != 0); 1167 1160 1168 1161 //XXX 1169 1162 1170 1163 if (refreshNPC) 1171 1164 enterNewSceneUnk2(0); 1172 1165 1173 1166 _pathfinderFlag = 0; 1174 1167 return refreshNPC; 1175 1168 } … … 1185 1178 _mainCharacter.facing = facing; 1186 1179 x &= ~3; 1187 1180 y &= ~1; 1188 1181 1189 1182 _screen->hideMouse(); 1190 1183 switch (facing) { 1191 1184 case 0: 1192 1185 while (y < _mainCharacter.y1) 1193 1186 updateCharPosWithUpdate(); 1194 1187 break; 1195 1196 case 2: 1188 1189 case 2: 1197 1190 while (_mainCharacter.x1 < x) 1198 1191 updateCharPosWithUpdate(); 1199 1192 break; 1200 1193 1201 1194 case 4: 1202 1195 while (y > _mainCharacter.y1) 1203 1196 updateCharPosWithUpdate(); 1204 1197 break; 1205 1198 1206 1199 case 6: 1207 1200 while (_mainCharacter.x1 > x) 1208 1201 updateCharPosWithUpdate(); 1209 1202 break; 1210 1203 1211 1204 default: 1212 1205 break; 1213 1206 } … … 1222 1215 1223 1216 if (_system->getMillis() < nextUpdate) 1224 1217 return 0; 1225 1218 1226 1219 int facing = _mainCharacter.facing; 1227 1220 _mainCharacter.x1 += updateX[facing]; 1228 1221 _mainCharacter.y1 += updateY[facing]; … … 1306 1299 scale1 = getScale(_mainCharacter.x1, _mainCharacter.y1); 1307 1300 scale2 = (scale1 * 24) >> 8; 1308 1301 scale3 = (scale1 * 48) >> 8; 1309 1302 1310 1303 x1 = _mainCharacter.x1 - (scale2 >> 1); 1311 1304 x2 = _mainCharacter.x1 + (scale2 >> 1); 1312 1305 y1 = _mainCharacter.y1 - scale3; 1313 1306 y2 = _mainCharacter.y1; 1314 1307 1315 1308 if (x >= x1 && x <= x2 && y >= y1 && y <= y2) 1316 1309 return 0; 1317 1310 1318 1311 return -1; 1319 1312 } 1320 1313 … … 1677 1670 Opcode(o2_dummy), 1678 1671 Opcode(o2_dummy), 1679 1672 }; 1680 1673 1681 1674 for (int i = 0; i < ARRAYSIZE(opcodeTable); ++i) 1682 1675 _opcodes.push_back(&opcodeTable[i]); 1683 1676 1684 1677 static const OpcodeV2 opcodeTemporaryTable[] = { 1685 1678 Opcode(o2t_defineNewShapes), 1686 1679 Opcode(o2t_setCurrentFrame), -
kyra_v2.h
95 95 uint16 currentFrame; 96 96 uint16 lastFrame; 97 97 uint16 x; 98 uint16 y; 98 uint16 y; 99 99 const SequenceControl *control; 100 100 uint16 startupCommand; 101 101 uint16 finalCommand; … … 149 149 public: 150 150 KyraEngine_v2(OSystem *system, const GameFlags &flags); 151 151 ~KyraEngine_v2(); 152 152 153 153 virtual Screen *screen() { return _screen; } 154 154 Screen_v2 *screen_v2() { return _screen; } 155 155 int language() const { return _lang; } 156 156 157 157 virtual Movie *createWSAMovie(); 158 158 protected: 159 159 // Main menu code, also used for Kyra 3 … … 165 165 void gui_drawMainMenu(const char *const *strings, int select); 166 166 void gui_drawMainBox(int x, int y, int w, int h, int fill); 167 167 bool gui_mainMenuGetInput(); 168 168 169 169 void gui_printString(const char *string, int x, int y, int col1, int col2, int flags, ...); 170 170 171 171 // intro/outro … … 174 174 int seq_introWestwood(WSAMovieV2 *wsaObj, int x, int y, int frm); 175 175 int seq_introTitle(WSAMovieV2 *wsaObj, int x, int y, int frm); 176 176 int seq_introOverview(WSAMovieV2 *wsaObj, int x, int y, int frm); 177 int seq_introLibrary(WSAMovieV2 *wsaObj, int x, int y, int frm); 177 int seq_introLibrary(WSAMovieV2 *wsaObj, int x, int y, int frm); 178 178 int seq_introHand(WSAMovieV2 *wsaObj, int x, int y, int frm); 179 179 int seq_introPoint(WSAMovieV2 *wsaObj, int x, int y, int frm); 180 180 int seq_introZanfaun(WSAMovieV2 *wsaObj, int x, int y, int frm); … … 192 192 int seq_introHand2(WSAMovieV2 *wsaObj, int x, int y, int frm); 193 193 int seq_introHand3(WSAMovieV2 *wsaObj, int x, int y, int frm); 194 194 195 int seq_finaleFunters(WSAMovieV2 *wsaObj, int x, int y, int frm); 196 int seq_finaleFerb(WSAMovieV2 *wsaObj, int x, int y, int frm); 197 int seq_finaleFish(WSAMovieV2 *wsaObj, int x, int y, int frm); 198 int seq_finaleFheep(WSAMovieV2 *wsaObj, int x, int y, int frm); 199 int seq_finaleFarmer(WSAMovieV2 *wsaObj, int x, int y, int frm); 200 int seq_finaleFuards(WSAMovieV2 *wsaObj, int x, int y, int frm); 201 int seq_finaleFirates(WSAMovieV2 *wsaObj, int x, int y, int frm); 202 int seq_finaleFrash(WSAMovieV2 *wsaObj, int x, int y, int frm); 203 204 void seq_finaleActorScreen(); 205 int seq_finaleFiggle(WSAMovieV2 *wsaObj, int x, int y, int frm); 206 195 207 void seq_sequenceCommand(int command); 196 208 void seq_loadNestedSequence(int wsaNum, int seqNum); 197 209 void seq_nestedSequenceFrame(int command, int wsaNum); … … 202 214 void seq_unloadWSA(int wsaNum); 203 215 void seq_processWSAs(); 204 216 void seq_cmpFadeFrame(const char *cmpFile); 205 217 206 218 void seq_playTalkText(uint8 chatNum); 207 219 void seq_resetAllTextEntries(); 208 220 uint32 seq_activeTextsTimeLeft(); … … 210 222 int seq_setTextEntry(uint16 strIndex, uint16 posX, uint16 posY, int duration, uint16 width); 211 223 void seq_processText(); 212 224 char *seq_preprocessString(const char *str, int width); 225 void seq_printCreditsString(uint16 strIndex, int x, int y, uint8 * colorMap, uint8 textcolor); 226 void seq_playWsaSyncDialogue(uint16 strIndex, uint16 vocIndex, int textColor, int x, int y, int width, 227 WSAMovieV2 * wsa, int firstframe, int lastframe, int wsaXpos, int wsaYpos); 213 228 214 229 void seq_init(); 215 230 void seq_uninit(); 216 231 217 232 int init(); 218 233 int go(); 219 234 220 235 Screen_v2 *_screen; 221 236 TextDisplayer_v2 *_text; 222 237 Debugger_v2 *_debugger; 223 238 224 239 uint8 *_mouseSHPBuf; 225 240 241 242 static const char *_dosSoundFileListIntro[]; 243 static const char *_dosSoundFileListFinale[]; 226 244 static const char *_dosSoundFileList[]; 227 245 static const int _dosSoundFileListSize; 228 246 static const int8 _dosTrackMap[]; … … 232 250 static const int _introSoundListSize; 233 251 static const char *_introStrings[]; 234 252 static const int _introStringsSize; 235 253 236 254 int _introStringsDuration[21]; 237 255 238 256 protected: 239 257 // game initialization 240 258 void startup(); 241 259 void runLoop(); 242 260 void cleanup(); 243 261 244 262 void setupTimers(); 245 263 void setupOpcodeTable(); 246 264 247 265 void loadMouseShapes(); 248 266 void loadItemShapes(); 249 267 250 268 // run 251 269 void update(); 252 270 void updateWithText(); … … 254 272 Functor0Mem<void, KyraEngine_v2> _updateFunctor; 255 273 256 274 void updateMouse(); 257 275 258 276 int checkInput(void *p); 259 277 void removeInputTop(); 260 278 void handleInput(int x, int y); … … 267 285 268 286 int _mouseX, _mouseY; 269 287 Common::List<Common::Event> _eventList; 270 288 271 289 // gfx/animation specific 272 290 uint8 *_gamePlayBuffer; 273 291 void restorePage3(); … … 278 296 279 297 void backUpGfxRect24x24(int x, int y); 280 298 void restoreGfxRect24x24(int x, int y); 281 299 282 300 uint8 *getShapePtr(int index) { return _defaultShapeTable[index]; } 283 301 uint8 *_defaultShapeTable[250]; 284 302 uint8 *_sceneShapeTable[50]; 285 303 286 304 WSAMovieV2 *_wsaSlots[10]; 287 305 288 306 void freeSceneShapePtrs(); 289 307 290 308 struct ShapeDesc { 291 309 uint8 unk0, unk1, unk2, unk3, unk4; 292 310 uint16 width, height; 293 311 int16 xAdd, yAdd; 294 312 }; 295 313 296 314 ShapeDesc *_shapeDescTable; 297 315 298 316 struct SceneAnim { 299 317 uint16 flags; 300 318 int16 x, y; … … 307 325 uint16 wsaFlag; 308 326 char filename[14]; 309 327 }; 310 328 311 329 SceneAnim _sceneAnims[10]; 312 330 WSAMovieV2 *_sceneAnimMovie[10]; 313 331 bool _specialSceneScriptState[10]; … … 316 334 uint32 _sceneSpecialScriptsTimer[10]; 317 335 int _lastProcessedSceneScript; 318 336 bool _specialSceneScriptRunFlag; 319 320 void updateSpecialSceneScripts(); 337 338 void updateSpecialSceneScripts(); 321 339 void freeSceneAnims(); 322 340 323 341 int _loadedZTable; 324 342 void loadZShapes(int shapes); 325 343 void loadInventoryShapes(); 326 344 327 345 void resetScaleTable(); 328 346 void setScaleTableItem(int item, int data); 329 347 int getScale(int x, int y); 330 348 uint16 _scaleTable[15]; 331 349 332 350 void setDrawLayerTableEntry(int entry, int data); 333 351 int getDrawLayer(int x, int y); 334 352 int _drawLayerTable[15]; … … 348 366 int initNewShapes(uint8 *filedata); 349 367 void processNewShapes(int unk1, int unk2); 350 368 void resetNewShapes(int count, uint8 *filedata); 351 369 352 370 // animator 353 371 struct AnimObj { 354 372 uint16 index; … … 375 393 int16 width2, height2; 376 394 AnimObj *nextObject; 377 395 }; 378 396 379 397 AnimObj _animObjects[42]; 380 398 void clearAnimObjects(); 381 399 382 400 AnimObj *_animList; 383 401 bool _drawNoShapeFlag; 384 402 AnimObj *initAnimList(AnimObj *list, AnimObj *entry); 385 403 AnimObj *addToAnimListSorted(AnimObj *list, AnimObj *entry); 386 404 AnimObj *deleteAnimListEntry(AnimObj *list, AnimObj *entry); 387 405 388 406 void drawAnimObjects(); 389 407 void drawSceneAnimObject(AnimObj *obj, int x, int y, int drawLayer); 390 408 void drawCharacterAnimObject(AnimObj *obj, int x, int y, int drawLayer); 391 409 392 410 void refreshAnimObjects(int force); 393 411 void refreshAnimObjectsIfNeed(); 394 412 395 413 void flagAnimObjsForRefresh(); 396 414 397 415 void updateCharFacing(); 398 416 void updateCharacterAnim(int); 399 417 void updateSceneAnim(int anim, int newFrame); … … 404 422 int _animObj0Width, _animObj0Height; 405 423 void setCharacterAnimDim(int w, int h); 406 424 void resetCharacterAnimDim(); 407 425 408 426 // scene 409 427 struct SceneDesc { 410 428 char filename[10]; … … 412 430 uint8 flags; 413 431 uint8 sound; 414 432 }; 415 433 416 434 SceneDesc *_sceneList; 417 435 int _sceneListSize; 418 436 uint16 _currentScene; … … 426 444 bool checkSpecialSceneExit(int num, int x, int y); 427 445 uint8 _scenePal[688]; 428 446 bool _overwriteSceneFacing; 429 447 430 448 void enterNewScene(uint16 newScene, int facing, int unk1, int unk2, int unk3); 431 449 void enterNewSceneUnk1(int facing, int unk1, int unk2); 432 450 void enterNewSceneUnk2(int unk1); … … 436 454 void loadSceneMsc(); 437 455 438 456 void fadeScenePal(int srcIndex, int delay); 439 457 440 458 void startSceneScript(int unk1); 441 459 void runSceneScript2(); 442 460 void runSceneScript4(int unk1); 443 461 void runSceneScript6(); 444 462 void runSceneScript7(); 445 463 446 464 void initSceneAnims(int unk1); 447 465 void initSceneScreen(int unk1); 448 466 449 467 int trySceneChange(int *moveTable, int unk1, int updateChar); 450 468 int checkSceneChange(); 451 469 452 470 // pathfinder 453 471 int _movFacingTable[600]; 454 472 int findWay(int curX, int curY, int dstX, int dstY, int *moveTable, int moveTableSize); 455 473 bool lineIsPassable(int x, int y); 456 474 bool directLinePassable(int x, int y, int toX, int toY); 457 475 458 476 int pathfinderUnk1(int *moveTable); 459 477 int pathfinderUnk2(int index, int v1, int v2); 460 478 int pathfinderUnk3(int tableLen, int x, int y); 461 479 int pathfinderUnk4(int index, int v); 462 480 void pathfinderUnk5(int *moveTable, int unk1, int x, int y, int moveTableSize); 463 481 464 482 int _pathfinderUnkTable1[400]; 465 483 int _pathfinderUnkTable2[200]; 466 484 467 485 // item 468 486 uint8 _itemHtDat[176]; 469 487 470 488 struct Item { 471 489 uint16 id; 472 490 uint16 sceneId; … … 475 493 uint16 unk7; 476 494 }; 477 495 Item *_itemList; 478 496 479 497 int findFreeItem(); 480 498 int countAllItems(); 481 499 int findItem(uint16 sceneId, uint16 id); 482 500 int checkItemCollision(int x, int y); 483 501 void resetItemList(); 484 502 485 503 int _itemInHand; 486 504 int _handItemSet; 487 505 … … 503 521 void setMouseCursor(uint16 item); 504 522 void setHandItem(uint16 item); 505 523 void removeHandItem(); 506 524 507 525 // inventroy 508 526 static const int _inventoryX[]; 509 527 static const int _inventoryY[]; 510 528 511 529 // localization 512 530 void loadCCodeBuffer(const char *file); 513 531 void loadOptionsBuffer(const char *file); … … 518 536 uint8 *_chapterBuffer; 519 537 int _currentChapter; 520 538 int _newChapterFile; 521 539 522 540 const uint8 *getTableEntry(const uint8 *buffer, int id); 523 541 const char *getTableString(int id, const uint8 *buffer, int decode); 524 542 const char *getChapterString(int id); … … 526 544 void decodeString2(const char *src, char *dst); 527 545 528 546 void changeFileExtension(char *buffer); 529 547 530 548 char _internStringBuf[200]; 531 549 static const char *_languageExtension[]; 532 550 static const char *_scriptLangExt[]; 533 551 534 552 // character 535 553 struct Character { 536 554 uint16 sceneId; … … 545 563 int16 x1, y1; 546 564 int16 x2, y2; 547 565 }; 548 566 549 567 Character _mainCharacter; 550 568 bool _useCharPal; 551 569 int _charPalEntry; 552 570 uint8 _charPalTable[16]; 553 571 void updateCharPal(int unk1); 554 572 void setCharPalEntry(int entry, int value); 555 573 556 574 void moveCharacter(int facing, int x, int y); 557 575 int updateCharPos(int *table); 558 576 void updateCharPosWithUpdate(); 559 577 void updateCharAnimFrame(int num, int *table); 560 578 561 579 int checkCharCollision(int x, int y); 562 580 563 581 int _mainCharX, _mainCharY; 564 582 int _charScaleX, _charScaleY; 565 583 566 584 static const int _characterFrameTable[]; 567 585 568 586 // text 569 587 void showMessageFromCCode(int id, int16 palIndex, int); 570 588 void showMessage(const char *string, int16 palIndex); 571 589 void showChapterMessage(int id, int16 palIndex); 572 590 573 591 void updateCommandLineEx(int str1, int str2, int16 palIndex); 574 592 575 593 const char *_shownMessage; 576 594 577 595 byte _messagePal[3]; … … 609 627 void snd_loadSoundFile(int id); 610 628 611 629 void playVoice(int high, int low); 612 630 613 631 // timer 614 632 void timerFunc2(int); 615 633 void timerFunc3(int); 616 634 void timerFunc4(int); 617 635 void timerFunc5(int); 618 636 void timerFunc6(int); 619 637 620 638 void setTimer1DelaySecs(int secs); 621 639 622 640 // delay 623 641 void delay(uint32 millis, bool updateGame = false, bool isMainLoop = false); 624 642 625 // Talk object handling 643 // Talk object handling 626 644 struct TalkObject { 627 645 char filename[13]; 628 646 int8 scriptId; … … 640 658 int16 AVTLOffset; 641 659 int16 TEXTOffset; 642 660 }; 643 661 644 662 struct TIMStructUnk1 { 645 663 uint16 unk_0; 646 664 uint16 unk_2; … … 648 666 uint16 unk_8; 649 667 uint16* unk_20; 650 668 }; 651 669 652 670 struct TIMBuffers { 653 671 uint16 *AVTLChunk; 654 672 byte *TEXTChunk; 655 673 TIMStructUnk1 *UnkChunk; 656 674 }; 657 675 TIMBuffers _TIMBuffers; 658 676 659 677 struct TalkSections { 660 678 byte *STATim; 661 679 byte *TLKTim; 662 680 byte *ENDTim; 663 681 }; 664 682 TalkSections _currentTalkSections; 665 683 666 684 bool _objectChatFinished; 667 685 byte* loadTIMFile(const char *filename, byte *buffer, int32 bufferSize); 668 686 void freeTIM(byte *buffer); … … 744 762 int o2t_setCurrentFrame(ScriptState *script); 745 763 int o2t_playSoundEffect(ScriptState *script); 746 764 int o2t_setShapeFlag(ScriptState *script); 747 765 748 766 // script 749 767 void runStartScript(int script, int unk1); 750 768 void loadNPCScript(); 751 769 752 770 bool _noScriptEnter; 753 771 754 772 ScriptData _npcScriptData; 755 773 756 774 ScriptData _sceneScriptData; 757 775 ScriptState _sceneScriptState; 758 776 759 777 ScriptData _temporaryScriptData; 760 778 ScriptState _temporaryScriptState; 761 779 bool _temporaryScriptExecBit; 762 780 Common::Array<const Opcode*> _opcodesTemporary; 763 781 764 782 void runTemporaryScript(const char *filename, int unk1, int unk2, int newShapes, int shapeUnload); 765 783 766 784 // pathfinder 767 785 int _pathfinderFlag; 768 786 769 787 uint8 *_unkBuf500Bytes; 770 788 uint8 *_unkBuf200kByte; 771 789 bool _unkFlag1; … … 779 797 780 798 const char *const *_sequenceSoundList; 781 799 int _sequenceSoundListSize; 782 783 static const char *_sequenceSoundListPC[]; 784 static const int _sequenceSoundListPCSize; 785 static const char *_sequenceStrings[]; 786 static const int _sequenceStringsSize; 787 800 const char *const *_sequenceStrings; 801 int _sequenceStringsSize; 802 803 static const char *_sequenceSoundList_PC[]; 804 static const int _sequenceSoundListSize_PC; 805 static const char *_sequenceSoundList_TOWNS[]; 806 static const int _sequenceSoundListSize_TOWNS; 807 static const char *_sequenceStrings_TOWNS_EN[]; 808 static const int _sequenceStringsSize_TOWNS_EN; 809 static const char *_sequenceStrings_PC_EN[]; 810 static const int _sequenceStringsSize_PC_EN; 811 788 812 int _sequenceStringsDuration[33]; 789 813 790 uint8 *_pageBuffer1;791 uint8 *_pageBuffer2;792 814 static const uint8 _seqTextColorPresets[]; 793 815 char *_seqProcessedString; 794 816 WSAMovieV2 *_seqWsa; … … 799 821 uint32 _seqFrameDelay; 800 822 uint32 _seqEndTime; 801 823 int _seqFrameCounter; 824 int _seqWsaCurrentFrame; 825 bool _seqSpecialFlag; 802 826 bool _seqSubframePlaying; 803 827 uint8 _seqTextColor[2]; 804 805 static const Sequence _sequences[]; 828 uint8 _seqTextColorMap[16]; 829 830 const Sequence *_sequences; 831 832 static const Sequence _sequences_PC[]; 833 static const Sequence _sequences_TOWNS[]; 806 834 static const NestedSequence _nSequences[]; 807 835 static const SequenceControl _wsaControlLibrary[]; 808 836 static const SequenceControl _wsaControlHand1b[]; -
screen_v2.cpp
742 742 return _mouseLockCount == 0; 743 743 } 744 744 745 void Screen_v2::setTextColorMap(const uint8 *cmap) { 746 debugC(9, kDebugLevelScreen, "Screen_v2::setTextColorMap(%p)", (const void *)cmap); 747 setTextColor(cmap, 0, 15); 748 } 749 745 750 } // end of namespace Kyra -
screen_v2.h
76 76 77 77 // mouse handling 78 78 bool isMouseVisible() const; 79 80 // text display 81 void setTextColorMap(const uint8 *cmap); 79 82 private: 80 83 KyraEngine_v2 *_vm; 81 84 -
sequences_v2.cpp
42 42 43 43 if (endSeq == -1) 44 44 endSeq = startSeq; 45 45 46 46 assert(startSeq >= 0 && endSeq < kSequenceArraySize && startSeq <= endSeq); 47 47 48 if (_flags.isDemo) { 49 static const char *soundFileList[] = { 50 "K2_DEMO", 51 "LOLSYSEX" 52 }; 53 _sound->setSoundFileList(soundFileList, 2); 54 } else { 55 const char *const *soundFileList = 56 (startSeq > kSequenceZanfaun) ? _dosSoundFileListFinale : _dosSoundFileListIntro; 57 _sound->setSoundFileList(soundFileList, 1); 58 } 59 _sound->loadSoundFile(0); 60 48 61 _screen->_charWidth = -2; 49 62 50 63 memset(_activeWSA, 0, sizeof(ActiveWSA) * 8); 51 64 for (int i = 0; i < 8; i++) 52 65 _activeWSA[i].flags = -1; 53 54 66 67 55 68 memset(_activeText, 0, sizeof(ActiveText) * 10); 56 69 seq_resetAllTextEntries(); 57 70 … … 61 74 for (int i = 0; i < 4; i++) 62 75 memset(_screen->getPalette(i), 0, 0x300); 63 76 64 memset(_pageBuffer1, 0, 0xfa00);65 memset(_pageBuffer2, 0, 0xfa00);77 _screen->clearPage(10); 78 _screen->clearPage(12); 66 79 67 80 _seqSubframePlaying = false; 68 69 intseqWsaCurrentFrame = 0;70 _seqTextColor[0] = _seqTextColor[1] = 0; 81 82 _seqWsaCurrentFrame = 0; 83 _seqTextColor[0] = _seqTextColor[1] = 0; 71 84 _seqEndTime = 0; 72 85 _menuChoice = 0; 73 86 74 87 for (int seqNum = startSeq; seqNum <= endSeq && !((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice); seqNum++) { 75 88 _screen->clearPage(0); 76 89 _screen->clearPage(8); 77 memcpy(_screen->getPalette(1), _screen->getPalette(0), 0x300); 90 memcpy(_screen->getPalette(1), _screen->getPalette(0), 0x300); 78 91 _seqFrameCounter = 0; 79 92 80 93 allowSkip = (seqNum == 2) ? false : true; 81 94 82 95 if (_sequences[seqNum].flags & 2) { 83 96 _screen->loadBitmap(_sequences[seqNum].cpsFile, 2, 2, _screen->getPalette(0)); 84 97 } else { … … 103 116 if (_sequences[seqNum].flags & 4) { 104 117 int cp = _screen->setCurPage(2); 105 118 Screen::FontId cf = _screen->setFont(Screen::FID_GOLDFONT_FNT); 106 int sX = (320 - _screen->getTextWidth(_sequenceStrings[_sequences[seqNum].stringIndex1])) / 2; 119 int sX = (320 - _screen->getTextWidth(_sequenceStrings[_sequences[seqNum].stringIndex1])) / 2; 107 120 _screen->printText(_sequenceStrings[_sequences[seqNum].stringIndex1], sX, 100 - _screen->getFontHeight(), 1, 0); 108 sX = (320 - _screen->getTextWidth(_sequenceStrings[_sequences[seqNum].stringIndex2])) / 2; 121 sX = (320 - _screen->getTextWidth(_sequenceStrings[_sequences[seqNum].stringIndex2])) / 2; 109 122 _screen->printText(_sequenceStrings[_sequences[seqNum].stringIndex2], sX, 100, 1, 0); 110 123 111 124 _screen->setFont(cf); 112 125 _screen->setCurPage(cp); 113 126 } 114 127 115 _screen->copy RegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2);128 _screen->copyPage(2, 12); 116 129 _screen->copyPage(0, 2); 117 _screen->copy RegionToBuffer(2, 0, 0, 320, 200, _pageBuffer1);118 _screen->copy BlockToPage(2, 0, 0, 320, 200, _pageBuffer2);119 130 _screen->copyPage(2, 10); 131 _screen->copyPage(12, 2); 132 120 133 _screen->copyPage(2, 6); 121 134 122 135 seq_sequenceCommand(_sequences[seqNum].startupCommand); 123 136 124 137 if (!((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { 125 138 _screen->copyPage(2, 0); 126 139 _screen->updateScreen(); 127 } 140 } 128 141 129 142 if (_sequences[seqNum].flags & 1) { 130 143 int w2 = _seqWsa->width(); … … 145 158 h2 = 0; 146 159 } 147 160 148 if (_sequences[seqNum].xPos + _seqWsa->width() > 0x13F)149 _seqWsa->setWidth( 0x140 - _sequences[seqNum].xPos);161 if (_sequences[seqNum].xPos + _seqWsa->width() > 319) 162 _seqWsa->setWidth(320 - _sequences[seqNum].xPos); 150 163 151 if (_sequences[seqNum].yPos + _seqWsa->height() > 0xC7)152 _seqWsa->setHeight( 0xC7- _sequences[seqNum].yPos);164 if (_sequences[seqNum].yPos + _seqWsa->height() > 199) 165 _seqWsa->setHeight(199 - _sequences[seqNum].yPos); 153 166 } 154 167 uint8 dir = (_sequences[seqNum].startFrame > _sequences[seqNum].numFrames) ? 0 : 1; 155 seqWsaCurrentFrame = _sequences[seqNum].startFrame;168 _seqWsaCurrentFrame = _sequences[seqNum].startFrame; 156 169 157 170 bool loop = true; 158 171 while (loop && !((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { 159 172 _seqEndTime = _system->getMillis() + _seqFrameDelay * _tickLength; 160 173 161 174 if (_seqWsa || !_sequences[seqNum].callback) 162 _screen->copy BlockToPage(2, 0, 0, 320, 200, _pageBuffer2);175 _screen->copyPage(12, 2); 163 176 164 177 if (_sequences[seqNum].callback) { 165 int f = seqWsaCurrentFrame % _seqWsa->frames();178 int f = _seqWsaCurrentFrame % _seqWsa->frames(); 166 179 (this->*_sequences[seqNum].callback)(_seqWsa, _sequences[seqNum].xPos, _sequences[seqNum].yPos, f); 167 180 } 168 181 169 182 if (_seqWsa) { 170 int f = seqWsaCurrentFrame % _seqWsa->frames();183 int f = _seqWsaCurrentFrame % _seqWsa->frames(); 171 184 _seqWsa->setX(_sequences[seqNum].xPos); 172 185 _seqWsa->setY(_sequences[seqNum].yPos); 173 186 _seqWsa->setDrawPage(2); 174 187 _seqWsa->displayFrame(f, 0); 175 188 } 176 189 177 _screen->copy RegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2);190 _screen->copyPage(2, 12); 178 191 179 seq_processWSAs(); 192 seq_processWSAs(); 180 193 seq_processText(); 181 194 182 195 if ((_seqWsa || !_sequences[seqNum].callback) && !((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { 183 196 _screen->copyPage(2, 0); 184 197 _screen->copyPage(2, 6); 185 198 _screen->updateScreen(); 186 199 } 187 200 188 201 bool loop2 = true; 189 202 while (loop2 && !((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { 190 203 if (_seqWsa) { … … 203 216 uint32 tdiff = _seqEndTime - now; 204 217 uint32 dly = tdiff < _tickLength ? tdiff : _tickLength; 205 218 delay(dly); 206 _seqEndTime -= dly;219 //_seqEndTime -= dly; 207 220 } 208 221 } else { 209 222 loop = loop2 = false; … … 212 225 213 226 if (loop) { 214 227 if (dir == 1) { 215 if (++ seqWsaCurrentFrame >= _sequences[seqNum].numFrames)228 if (++_seqWsaCurrentFrame >= _sequences[seqNum].numFrames) 216 229 loop = false; 217 230 } else { 218 if (-- seqWsaCurrentFrame < _sequences[seqNum].numFrames)231 if (--_seqWsaCurrentFrame < _sequences[seqNum].numFrames) 219 232 loop = false; 220 233 } 221 234 } … … 228 241 _seqEndTime = _system->getMillis() + _seqFrameDelay * _tickLength; 229 242 while (!((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { 230 243 uint32 starttime = _system->getMillis(); 231 seq_processWSAs(); 244 seq_processWSAs(); 232 245 if (_sequences[seqNum].callback) 233 246 (this->*_sequences[seqNum].callback)(0, 0, 0, 0); 234 247 235 248 seq_processText(); 236 237 _screen->copyPage(2, 6); 249 250 _screen->copyPage(2, 6); 238 251 _screen->copyPage(2, 0); 239 252 _screen->updateScreen(); 240 _screen->copy BlockToPage(2, 0, 0, 320, 200, _pageBuffer2);253 _screen->copyPage(12, 2); 241 254 242 255 uint32 now = _system->getMillis(); 243 256 if (now >= _seqEndTime && !_seqSubframePlaying) 244 257 break; 245 258 246 259 uint32 tdiff = _seqEndTime - starttime; 247 260 int32 dly = _tickLength - (now - starttime); 248 261 if (dly > 0) … … 258 271 if (dl < ct) 259 272 dl = ct; 260 273 _seqEndTime = _system->getMillis() + dl; 261 274 262 275 while (!((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { 263 276 uint32 starttime = _system->getMillis(); 264 277 seq_processWSAs(); 265 278 266 _screen->copyPage(2, 6); 279 _screen->copyPage(2, 6); 267 280 _screen->copyPage(2, 0); 268 281 _screen->updateScreen(); 269 _screen->copy BlockToPage(2, 0, 0, 320, 200, _pageBuffer2);270 282 _screen->copyPage(12, 2); 283 271 284 uint32 now = _system->getMillis(); 272 285 if (now >= _seqEndTime && !_seqSubframePlaying) { 273 286 break; 274 } else {275 uint32 tdiff = _seqEndTime - starttime;276 delay(MIN<uint32>(tdiff, _tickLength));277 287 } 288 289 uint32 tdiff = _seqEndTime - starttime; 290 int32 dly = _tickLength - (now - starttime); 291 if (dly > 0) 292 delay(MIN<uint32>(dly, tdiff)); 278 293 } 279 294 280 295 seq_sequenceCommand(_sequences[seqNum].finalCommand); 281 296 seq_resetAllTextEntries(); 282 297 … … 285 300 _abortIntroFlag = _skipFlag = false; 286 301 seqNum = kSequenceWestwood; 287 302 } 288 303 289 304 if (_menuChoice) { 290 305 _abortIntroFlag = _skipFlag = false; 291 306 if (_menuChoice == 2) … … 293 308 } 294 309 } 295 310 311 if (!_menuChoice) 312 delay(1000); 313 296 314 _screen->setCurPage(oldPage); 297 315 _screen->showMouse(); 298 316 … … 309 327 310 328 int KyraEngine_v2::seq_introWestwood(WSAMovieV2 *wsaObj, int x, int y, int frm) { 311 329 debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introWestwood(%p, %i, %i, %i)", (const void*)wsaObj, x, y, frm); 312 313 if (frm == -2) 314 delay(300 * _tickLength); 315 else if (!frm) 330 331 if (frm == -2) { 332 if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) 333 delay(300 * _tickLength); 334 } else if (!frm) { 316 335 _sound->playTrack(2); 317 336 } 337 318 338 return 0; 319 339 } 320 340 321 341 int KyraEngine_v2::seq_introTitle(WSAMovieV2 *wsaObj, int x, int y, int frm) { 322 342 debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introTitle(%p, %i, %i, %i)", (const void*)wsaObj, x, y, frm); 323 343 324 344 if (frm == 1) { 325 345 _sound->playTrack(3); 326 } else if (frm == 0x19) {346 } else if (frm == 25) { 327 347 int cp = _screen->setCurPage(0); 328 348 _screen->showMouse(); 329 349 _system->updateScreen(); … … 342 362 343 363 int KyraEngine_v2::seq_introOverview(WSAMovieV2 *wsaObj, int x, int y, int frm) { 344 364 debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introOverview(%p, %i, %i, %i)", (const void*)wsaObj, x, y, frm); 345 365 346 366 uint8 * tmpPal = &(_screen->getPalette(3)[0x101]); 347 367 memset(tmpPal, 0, 256); 348 uint8 txtColorMap[16];349 368 uint32 endtime = 0, now = 0; 350 369 351 370 switch (_seqFrameCounter) { … … 353 372 _seqSubframePlaying = true; 354 373 _sound->playTrack(4); 355 374 endtime = _system->getMillis() + 60 * _tickLength; 356 375 357 376 _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; 358 memset( txtColorMap, _seqTextColor[1], 16);359 txtColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff;377 memset(_seqTextColorMap, _seqTextColor[1], 16); 378 _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; 360 379 361 _screen->setTextColorMap( txtColorMap);362 380 _screen->setTextColorMap(_seqTextColorMap); 381 363 382 now = _system->getMillis(); 364 383 if (endtime > now) 365 384 delay(endtime - now); … … 400 419 _screen->setScreenPalette(_screen->getPalette(2)); 401 420 _screen->updateScreen(); 402 421 _screen->applyGrayOverlay(0, 0, 320, 200, 2, _screen->getPalette(3)); 403 _screen->copy RegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2);422 _screen->copyPage(2, 12); 404 423 _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); 405 424 _screen->setScreenPalette(_screen->getPalette(0)); 406 425 _screen->updateScreen(); … … 414 433 break; 415 434 416 435 case 354: 436 case 434: 437 if (!((_seqFrameCounter == 354 && !_flags.isTalkie) || (_seqFrameCounter == 434 && _flags.isTalkie))) 438 break; 439 417 440 seq_resetActiveWSA(0); 418 441 seq_loadNestedSequence(0, kSequenceDragon); 419 442 break; 420 443 421 444 case 400: 445 case 540: 446 if (!((_seqFrameCounter == 400 && !_flags.isTalkie) || (_seqFrameCounter == 540 && _flags.isTalkie))) 447 break; 448 422 449 seq_waitForTextsTimeout(); 423 450 seq_resetActiveWSA(0); 424 451 _seqEndTime = 0; … … 435 462 436 463 int KyraEngine_v2::seq_introLibrary(WSAMovieV2 *wsaObj, int x, int y, int frm) { 437 464 debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introLibrary(%p, %i, %i, %i)", (const void*)wsaObj, x, y, frm); 438 uint8 txtColorMap[16];439 465 440 466 switch (_seqFrameCounter) { 441 467 case 0: 442 468 _seqSubframePlaying = true; 443 469 _sound->playTrack(5); 444 470 445 471 _screen->generateGrayOverlay(_screen->getPalette(0), _screen->getPalette(3), 0x24, 0, 0, 0, 0x100, false); 446 472 _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; 447 memset( txtColorMap, _seqTextColor[1], 16);448 txtColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff;473 memset(_seqTextColorMap, _seqTextColor[1], 16); 474 _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; 449 475 450 _screen->setTextColorMap( txtColorMap);476 _screen->setTextColorMap(_seqTextColorMap); 451 477 break; 452 478 453 479 case 1: … … 458 484 case 100: 459 485 seq_waitForTextsTimeout(); 460 486 461 _screen->copy BlockToPage(2, 0, 0, 320, 200, _pageBuffer2);487 _screen->copyPage(12, 2); 462 488 _screen->applyGrayOverlay(0, 0, 320, 200, 2, _screen->getPalette(3)); 463 489 _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); 464 490 _screen->updateScreen(); 465 _screen->copy RegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2);466 491 _screen->copyPage(2, 12); 492 467 493 seq_resetActiveWSA(0); 468 494 seq_loadNestedSequence(0, kSequenceDarm); 469 495 … … 482 508 case 340: 483 509 seq_resetActiveWSA(0); 484 510 _screen->applyGrayOverlay(0, 0, 320, 200, 2, _screen->getPalette(3)); 485 _screen->copy RegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2);511 _screen->copyPage(2, 12); 486 512 _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); 487 513 _screen->updateScreen(); 488 514 … … 491 517 break; 492 518 493 519 case 480: 494 _screen->copyRegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2); 520 case 660: 521 if (!((_seqFrameCounter == 480 && !_flags.isTalkie) || (_seqFrameCounter == 660 && _flags.isTalkie))) 522 break; 523 524 _screen->copyPage(2, 12); 495 525 seq_waitForTextsTimeout(); 496 526 seq_resetActiveWSA(0); 497 527 _seqEndTime = 0; … … 509 539 510 540 int KyraEngine_v2::seq_introHand(WSAMovieV2 *wsaObj, int x, int y, int frm) { 511 541 debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introHand(%p, %i, %i, %i)", (const void*)wsaObj, x, y, frm); 512 uint8 txtColorMap[16];513 542 514 543 switch (_seqFrameCounter) { 515 544 case 0: 516 545 _seqSubframePlaying = true; 517 546 _sound->playTrack(6); 518 547 519 548 _screen->generateGrayOverlay(_screen->getPalette(0), _screen->getPalette(3), 0x24, 0, 0, 0, 0x100, false); 520 549 _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; 521 memset( txtColorMap, _seqTextColor[1], 16);522 txtColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff;550 memset(_seqTextColorMap, _seqTextColor[1], 16); 551 _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; 523 552 524 _screen->setTextColorMap( txtColorMap);553 _screen->setTextColorMap(_seqTextColorMap); 525 554 break; 526 555 527 556 case 1: … … 534 563 case 201: 535 564 seq_waitForTextsTimeout(); 536 565 _screen->applyGrayOverlay(0, 0, 320, 200, 2, _screen->getPalette(3)); 537 _screen->copy RegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2);566 _screen->copyPage(2, 12); 538 567 _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); 539 568 _screen->updateScreen(); 540 569 seq_resetActiveWSA(0); … … 545 574 break; 546 575 547 576 case 260: 577 case 395: 578 if (!((_seqFrameCounter == 260 && !_flags.isTalkie) || (_seqFrameCounter == 395 && _flags.isTalkie))) 579 break; 580 581 548 582 seq_waitForTextsTimeout(); 549 583 seq_resetActiveWSA(0); 550 584 seq_loadNestedSequence(1, kSequenceHand3); … … 552 586 break; 553 587 554 588 case 365: 589 case 500: 590 if (!((_seqFrameCounter == 365 && !_flags.isTalkie) || (_seqFrameCounter == 500 && _flags.isTalkie))) 591 break; 592 555 593 seq_waitForTextsTimeout(); 556 594 seq_resetActiveWSA(1); 557 595 seq_loadNestedSequence(0, kSequenceHand4); 558 596 break; 559 597 560 598 case 405: 599 case 540: 600 if (!((_seqFrameCounter == 405 && !_flags.isTalkie) || (_seqFrameCounter == 540 && _flags.isTalkie))) 601 break; 602 603 561 604 seq_playTalkText(10); 562 605 break; 563 606 564 607 case 484: 608 case 630: 609 if (!((_seqFrameCounter == 484 && !_flags.isTalkie) || (_seqFrameCounter == 630 && _flags.isTalkie))) 610 break; 611 565 612 seq_waitForTextsTimeout(); 566 613 seq_resetActiveWSA(0); 567 614 _seqEndTime = 0; … … 582 629 _seqEndTime = 0; 583 630 } 584 631 585 uint8 txtColorMap[16];586 587 632 switch (_seqFrameCounter) { 588 633 case -2: 589 634 seq_waitForTextsTimeout(); 590 635 break; 591 636 592 637 case 0: 593 _sound->playTrack(7); 594 638 _sound->playTrack(7); 639 595 640 _seqTextColor[1] = 0xf7; 596 memset( txtColorMap, _seqTextColor[1], 16);597 txtColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff;598 _screen->setTextColorMap( txtColorMap);641 memset(_seqTextColorMap, _seqTextColor[1], 16); 642 _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; 643 _screen->setTextColorMap(_seqTextColorMap); 599 644 _screen->generateGrayOverlay(_screen->getPalette(0), _screen->getPalette(3), 0x24, 0, 0, 0, 0x100, false); 600 645 break; 601 646 … … 618 663 return 0; 619 664 } 620 665 621 uint8 txtColorMap[16];622 623 666 switch (_seqFrameCounter) { 624 667 case 0: 625 _sound->playTrack(8); 626 668 _sound->playTrack(8); 669 627 670 _seqTextColor[1] = 0xfd; 628 memset( txtColorMap, _seqTextColor[1], 16);629 txtColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff;630 _screen->setTextColorMap( txtColorMap);671 memset(_seqTextColorMap, _seqTextColor[1], 16); 672 _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; 673 _screen->setTextColorMap(_seqTextColorMap); 631 674 break; 632 675 633 676 case 1: 634 seq_setTextEntry(21, 140, 70, 20, 160); 635 if (_flags.isTalkie) 636 _sound->voicePlay(_sequenceSoundList[13]); 637 _seqFrameDelay = 200; 677 if (_flags.isTalkie) { 678 seq_playWsaSyncDialogue(21, 13, -1, 140, 70, 160, wsaObj, 0, 8, x, y); 679 } else { 680 seq_setTextEntry(21, 140, 70, 20, 160); 681 _seqFrameDelay = 200; 682 } 638 683 break; 639 684 640 685 case 2: 641 686 case 11: 642 687 case 21: 643 _seqFrameDelay = 12; 688 if (!_flags.isTalkie) 689 _seqFrameDelay = 12; 644 690 break; 645 691 692 case 9: 693 if (_flags.isTalkie) 694 seq_playWsaSyncDialogue(13, 14, -1, 140, (_flags.lang == Common::FR_FRA 695 || _flags.lang == Common::DE_DEU) ? 50 : 70, 160, wsaObj, 9, 15, x, y); 696 break; 697 646 698 case 10: 647 seq_waitForTextsTimeout(); 648 seq_setTextEntry(13, 140, 50, _sequenceStringsDuration[13], 160); 699 if (!_flags.isTalkie) { 700 seq_waitForTextsTimeout(); 701 seq_setTextEntry(13, 140, 50, _sequenceStringsDuration[13], 160); 702 _seqFrameDelay = 300; 703 } 704 break; 705 706 case 16: 649 707 if (_flags.isTalkie) 650 _sound->voicePlay(_sequenceSoundList[14]);651 _seqFrameDelay = 300;708 seq_playWsaSyncDialogue(18, 15, -1, 140, (_flags.lang == Common::FR_FRA) ? 50 : 709 (_flags.lang == Common::DE_DEU ? 40 : 70), 160, wsaObj, 10, 16, x, y); 652 710 break; 653 711 654 case 20: 655 seq_setTextEntry(18, 160, 50, _sequenceStringsDuration[17], 160); 712 case 17: 656 713 if (_flags.isTalkie) 657 _sound->voicePlay(_sequenceSoundList[15]); 658 _seqFrameDelay = 200; 659 break; 714 _seqFrameDelay = 12; 715 break; 660 716 717 case 20: 718 if (!_flags.isTalkie) { 719 seq_setTextEntry(18, 160, 50, _sequenceStringsDuration[17], 160); 720 _seqFrameDelay = 200; 721 } 722 break; 723 661 724 case 19: 662 725 case 26: 663 726 seq_waitForTextsTimeout(); 664 727 break; 665 728 666 729 case 46: 667 seq_waitForTextsTimeout(); 668 seq_setTextEntry(16, 200, 50, _sequenceStringsDuration[16], 120); 669 if (_flags.isTalkie) 670 _sound->voicePlay(_sequenceSoundList[16]); 730 if (_flags.isTalkie) { 731 seq_playWsaSyncDialogue(16, 16, -1, 200, 50, 120, wsaObj, 46, 46, x, y); 732 } else { 733 seq_waitForTextsTimeout(); 734 seq_setTextEntry(16, 200, 50, _sequenceStringsDuration[16], 120); 735 } 736 671 737 _seqEndTime = _system->getMillis() + 120 * _tickLength; 672 738 break; 673 739 674 740 default: 675 741 break; 676 } 677 742 } 743 678 744 _seqFrameCounter++; 679 745 return 0; 680 746 } … … 695 761 } 696 762 697 763 int KyraEngine_v2::seq_introForest(WSAMovieV2 *wsaObj, int x, int y, int frm) { 698 if (frm == 11) 764 if (frm == 11) { 699 765 seq_waitForTextsTimeout(); 700 else if (frm == 12) 766 } else if (frm == 12) { 767 if (_flags.lang == Common::FR_FRA) 768 {}//// TODO 701 769 seq_playTalkText(2); 770 } 702 771 return frm; 703 772 } 704 773 … … 755 824 return frm; 756 825 } 757 826 827 int KyraEngine_v2::seq_finaleFunters(WSAMovieV2 *wsaObj, int x, int y, int frm) { 828 uint32 endtime = 0; 829 int chatX = 0; 830 int chatY = 0; 831 int chatW = 0; 832 int chatFirstFrame = 0; 833 int chatLastFrame = 0; 834 uint16 voiceIndex = 0; 835 836 switch (frm) { 837 case -2: 838 seq_sequenceCommand(9); 839 break; 840 841 case 0: 842 _sound->playTrack(3); 843 844 _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; 845 memset(_seqTextColorMap, _seqTextColor[1], 16); 846 _seqTextColor[0] = _seqTextColorMap[1] = 0xff; 847 _screen->setTextColorMap(_seqTextColorMap); 848 849 endtime = _system->getMillis() + 480 * _tickLength; 850 seq_printCreditsString(81, 240, 70, _seqTextColorMap, 252); 851 seq_printCreditsString(82, 240, 90, _seqTextColorMap, _seqTextColor[0]); 852 _screen->copyPage(2, 12); 853 delay(endtime - _system->getMillis()); 854 seq_playTalkText(_flags.isTalkie ? 28 : 24); 855 _seqTextColor[0] = 1; 856 857 if (_flags.isTalkie) { 858 if (_flags.lang == Common::FR_FRA) { 859 chatX = 84; 860 chatY = 70; 861 } else { 862 chatX = 88; 863 chatY = 78; 864 } 865 chatFirstFrame = 9; 866 chatLastFrame = 15; 867 voiceIndex = 34; 868 } else { 869 chatX = 88; 870 chatY = 70; 871 chatFirstFrame = 0; 872 chatLastFrame = 8; 873 } 874 chatW = 100; 875 876 seq_playWsaSyncDialogue(22, voiceIndex, 187, chatX, chatY, chatW, wsaObj, chatFirstFrame, chatLastFrame, x, y); 877 break; 878 879 case 9: 880 case 16: 881 if (!((frm == 9 && !_flags.isTalkie) || (frm == 16 && _flags.isTalkie))) 882 break; 883 884 _seqFrameDelay = 12; 885 886 if (_flags.isTalkie) { 887 if (_flags.lang == Common::FR_FRA) { 888 chatW = 112; 889 chatX = 80; 890 } else { 891 chatW = 100; 892 chatX = (_flags.lang == Common::DE_DEU) ? 84 : 96; 893 } 894 chatFirstFrame = 0; 895 chatLastFrame = 8; 896 voiceIndex = 35; 897 } else { 898 chatX = 96; 899 chatW = 100; 900 chatFirstFrame = 9; 901 chatLastFrame = 15; 902 } 903 chatY = 70; 904 905 seq_playWsaSyncDialogue(23, voiceIndex, 137, chatX, chatY, chatW, wsaObj, chatFirstFrame, chatLastFrame, x, y); 906 if (_flags.isTalkie) 907 _seqWsaCurrentFrame = 17; 908 909 break; 910 911 default: 912 break; 913 } 914 915 _seqFrameCounter++; 916 return 0; 917 } 918 919 int KyraEngine_v2::seq_finaleFerb(WSAMovieV2 *wsaObj, int x, int y, int frm) { 920 uint32 endtime = 0; 921 int chatX = 0; 922 int chatY = 0; 923 int chatW = 0; 924 int chatFirstFrame = 0; 925 int chatLastFrame = 0; 926 uint16 voiceIndex = 0; 927 928 switch (frm) { 929 case -2: 930 seq_sequenceCommand(9); 931 endtime = _system->getMillis() + 480 * _tickLength; 932 seq_printCreditsString(34, 240, _flags.isTalkie ? 60 : 40, _seqTextColorMap, 252); 933 seq_printCreditsString(35, 240, _flags.isTalkie ? 70 : 50, _seqTextColorMap, _seqTextColor[0]); 934 seq_printCreditsString(36, 240, _flags.isTalkie ? 90 : 70, _seqTextColorMap, 252); 935 seq_printCreditsString(37, 240, _flags.isTalkie ? 100 : 90, _seqTextColorMap, _seqTextColor[0]); 936 seq_printCreditsString(38, 240, _flags.isTalkie ? 120 : 110, _seqTextColorMap, 252); 937 seq_printCreditsString(39, 240, _flags.isTalkie ? 130 : 120, _seqTextColorMap, _seqTextColor[0]); 938 if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) 939 seq_printCreditsString(103, 240, 130, _seqTextColorMap, _seqTextColor[0]); 940 delay(endtime - _system->getMillis()); 941 _seqEndTime = 0; 942 break; 943 944 case 0: 945 _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; 946 memset(_seqTextColorMap, _seqTextColor[1], 16); 947 _seqTextColor[0] = _seqTextColorMap[1] = 255; 948 _screen->setTextColorMap(_seqTextColorMap); 949 950 break; 951 952 case 5: 953 if (!_flags.isTalkie) 954 seq_playTalkText(18); 955 _seqFrameDelay = 16; 956 957 if (_flags.isTalkie) { 958 chatFirstFrame = 5; 959 chatLastFrame = 8; 960 voiceIndex = 22; 961 } else { 962 chatLastFrame = 14; 963 } 964 chatX = 116; 965 chatY = 90; 966 chatW = 60; 967 968 seq_playWsaSyncDialogue(24, voiceIndex, 149, chatX, chatY, chatW, wsaObj, chatFirstFrame, chatLastFrame, x, y); 969 break; 970 971 case 11: 972 if (_flags.isTalkie) 973 seq_playWsaSyncDialogue(24, 22, 149, 116, 90, 60, wsaObj, 11, 14, x, y); 974 975 break; 976 977 case 16: 978 seq_playTalkText(_flags.isTalkie ? 23 : 19); 979 _seqFrameDelay = _flags.isTalkie ? 20 : 16; 980 981 if (_flags.isTalkie) { 982 if (_flags.lang == Common::FR_FRA) { 983 chatY = 48; 984 chatW = 88; 985 } else { 986 chatY = 60; 987 chatW = 100; 988 } 989 voiceIndex = 36; 990 } else { 991 chatY = 60; 992 chatW = 100; 993 } 994 chatX = 60; 995 996 seq_playWsaSyncDialogue(25, voiceIndex, 143, chatX, chatY, chatW, wsaObj, 16, 25, x, y); 997 _seqFrameDelay = 16; 998 break; 999 1000 default: 1001 break; 1002 } 1003 1004 _seqFrameCounter++; 1005 return 0; 1006 } 1007 1008 int KyraEngine_v2::seq_finaleFish(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1009 uint32 endtime = 0; 1010 int chatX = 0; 1011 int chatY = 0; 1012 int chatW = 0; 1013 uint16 voiceIndex = 0; 1014 1015 switch (frm) { 1016 case -2: 1017 seq_sequenceCommand(9); 1018 endtime = _system->getMillis() + 480 * _tickLength; 1019 1020 seq_printCreditsString(40, 240, _flags.isTalkie ? 55 : 40, _seqTextColorMap, 252); 1021 seq_printCreditsString(41, 240, _flags.isTalkie ? 65 : 50, _seqTextColorMap, _seqTextColor[0]); 1022 seq_printCreditsString(42, 240, _flags.isTalkie ? 75 : 60, _seqTextColorMap, _seqTextColor[0]); 1023 seq_printCreditsString(43, 240, _flags.isTalkie ? 95 : 80, _seqTextColorMap, 252); 1024 seq_printCreditsString(44, 240, _flags.isTalkie ? 105 : 90, _seqTextColorMap, _seqTextColor[0]); 1025 seq_printCreditsString(93, 240, _flags.isTalkie ? 125 : 110, _seqTextColorMap, 252); 1026 seq_printCreditsString(94, 240, _flags.isTalkie ? 135 : 120, _seqTextColorMap, _seqTextColor[0]); 1027 delay(endtime - _system->getMillis()); 1028 _seqEndTime = 0; 1029 break; 1030 1031 case 0: 1032 _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; 1033 memset(_seqTextColorMap, _seqTextColor[1], 16); 1034 _seqTextColor[0] = _seqTextColorMap[1] = 0xff; 1035 _screen->setTextColorMap(_seqTextColorMap); 1036 break; 1037 1038 case 4: 1039 chatX = 94; 1040 chatY = 42; 1041 chatW = 100; 1042 if (_flags.isTalkie) 1043 voiceIndex = 37; 1044 seq_playWsaSyncDialogue(26, voiceIndex, 149, chatX, chatY, chatW, wsaObj, 3, 12, x, y); 1045 break; 1046 1047 case 14: 1048 seq_playTalkText(_flags.isTalkie ? 19 : 15); 1049 break; 1050 1051 case 23: 1052 seq_playTalkText(_flags.isTalkie ? 20 : 16); 1053 break; 1054 1055 case 29: 1056 if (_flags.isTalkie) { 1057 if (_flags.lang == Common::DE_DEU) { 1058 chatX = 82; 1059 chatY = 35; 1060 } else { 1061 chatX = (_flags.lang == Common::FR_FRA) ? 92 : 88; 1062 chatY = 40; 1063 } 1064 voiceIndex = 38; 1065 } else { 1066 chatX = 88; 1067 chatY = 40; 1068 } 1069 chatW = 100; 1070 1071 seq_playWsaSyncDialogue(27, voiceIndex, 187, chatX, chatY, chatW, wsaObj, 28, 34, x, y); 1072 break; 1073 1074 case 45: 1075 seq_playTalkText(_flags.isTalkie ? 21 : 17); 1076 break; 1077 1078 case 50: 1079 seq_playTalkText(_flags.isTalkie ? 29 : 25); 1080 break; 1081 1082 default: 1083 break; 1084 } 1085 1086 _seqFrameCounter++; 1087 return 0; 1088 } 1089 1090 int KyraEngine_v2::seq_finaleFheep(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1091 uint32 endtime = 0; 1092 int chatX = 0; 1093 int chatY = 0; 1094 int chatW = 0; 1095 int chatFirstFrame = 0; 1096 int chatLastFrame = 0; 1097 uint16 voiceIndex = 0; 1098 1099 switch (frm) { 1100 case -2: 1101 _screen->copyPage(12, 2); 1102 _screen->copyPage(2, 0); 1103 _screen->updateScreen(); 1104 seq_sequenceCommand(9); 1105 endtime = _system->getMillis() + 480 * _tickLength; 1106 seq_printCreditsString(49, 240, 20, _seqTextColorMap, 252); 1107 seq_printCreditsString(50, 240, 30, _seqTextColorMap, _seqTextColor[0]); 1108 seq_printCreditsString(51, 240, 40, _seqTextColorMap, _seqTextColor[0]); 1109 seq_printCreditsString(52, 240, 50, _seqTextColorMap, _seqTextColor[0]); 1110 seq_printCreditsString(53, 240, 60, _seqTextColorMap, _seqTextColor[0]); 1111 seq_printCreditsString(54, 240, 70, _seqTextColorMap, _seqTextColor[0]); 1112 seq_printCreditsString(55, 240, 80, _seqTextColorMap, _seqTextColor[0]); 1113 seq_printCreditsString(56, 240, 90, _seqTextColorMap, _seqTextColor[0]); 1114 seq_printCreditsString(57, 240, 100, _seqTextColorMap, _seqTextColor[0]); 1115 seq_printCreditsString(58, 240, 110, _seqTextColorMap, _seqTextColor[0]); 1116 seq_printCreditsString(60, 240, 120, _seqTextColorMap, _seqTextColor[0]); 1117 seq_printCreditsString(61, 240, 130, _seqTextColorMap, _seqTextColor[0]); 1118 seq_printCreditsString(62, 240, 140, _seqTextColorMap, _seqTextColor[0]); 1119 seq_printCreditsString(63, 240, 150, _seqTextColorMap, _seqTextColor[0]); 1120 seq_printCreditsString(64, 240, 160, _seqTextColorMap, _seqTextColor[0]); 1121 1122 delay(endtime - _system->getMillis()); 1123 _seqEndTime = 0; 1124 break; 1125 1126 case 0: 1127 _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; 1128 memset(_seqTextColorMap, _seqTextColor[1], 16); 1129 _seqTextColor[0] = _seqTextColorMap[1] = 0xff; 1130 _screen->setTextColorMap(_seqTextColorMap); 1131 break; 1132 1133 case 2: 1134 seq_playTalkText(_flags.isTalkie ? 25 : 21); 1135 1136 if (_flags.isTalkie) { 1137 if (_flags.lang == Common::FR_FRA) { 1138 chatX = 92; 1139 chatY = 72; 1140 } else { 1141 chatX = (_flags.lang == Common::DE_DEU) ? 90 : 98; 1142 chatY = 84; 1143 } 1144 chatFirstFrame = 8; 1145 chatLastFrame = 9; 1146 voiceIndex = 39; 1147 } else { 1148 chatX = 98; 1149 chatY = 84; 1150 chatFirstFrame = 2; 1151 chatLastFrame = -8; 1152 } 1153 chatW = 100; 1154 1155 seq_playWsaSyncDialogue(28, voiceIndex, -1, chatX, chatY, chatW, wsaObj, chatFirstFrame, chatLastFrame, x, y); 1156 if (_flags.isTalkie) 1157 _seqWsaCurrentFrame = 4; 1158 break; 1159 1160 case 9: 1161 seq_playTalkText(_flags.isTalkie ? 24 : 20); 1162 _seqFrameDelay = 100; 1163 break; 1164 1165 default: 1166 break; 1167 } 1168 1169 _seqFrameCounter++; 1170 return 0; 1171 } 1172 1173 int KyraEngine_v2::seq_finaleFarmer(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1174 uint32 endtime = 0; 1175 int chatX = 0; 1176 int chatY = 0; 1177 int chatW = 0; 1178 uint16 voiceIndex = 0; 1179 1180 switch (frm) { 1181 case -2: 1182 _screen->copyPage(12, 2); 1183 _screen->copyPage(2, 0); 1184 _screen->updateScreen(); 1185 seq_sequenceCommand(9); 1186 endtime = _system->getMillis() + 480 * _tickLength; 1187 seq_printCreditsString(45, 240, 40, _seqTextColorMap, 252); 1188 seq_printCreditsString(46, 240, 50, _seqTextColorMap, _seqTextColor[0]); 1189 seq_printCreditsString(47, 240, 60, _seqTextColorMap, _seqTextColor[0]); 1190 seq_printCreditsString(83, 240, 80, _seqTextColorMap, 252); 1191 seq_printCreditsString(48, 240, 90, _seqTextColorMap, _seqTextColor[0]); 1192 seq_printCreditsString(65, 240, 110, _seqTextColorMap, 252); 1193 seq_printCreditsString(66, 240, 120, _seqTextColorMap, _seqTextColor[0]); 1194 seq_printCreditsString(67, 240, 130, _seqTextColorMap, _seqTextColor[0]); 1195 seq_printCreditsString(68, 240, 140, _seqTextColorMap, _seqTextColor[0]); 1196 seq_printCreditsString(69, 240, 150, _seqTextColorMap, _seqTextColor[0]); 1197 if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) 1198 seq_printCreditsString(104, 240, 160, _seqTextColorMap, _seqTextColor[0]); 1199 delay(endtime - _system->getMillis()); 1200 _seqEndTime = 0; 1201 break; 1202 1203 case 0: 1204 _seqTextColor[1] = 1 + (_screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 254) & 0xff); 1205 memset(_seqTextColorMap, _seqTextColor[1], 16); 1206 _seqTextColorMap[1] = _seqTextColor[0] = 1 + (_screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 254) & 0xff); 1207 _screen->setTextColorMap(_seqTextColorMap); 1208 seq_playTalkText(_flags.isTalkie ? 30 : 26); 1209 break; 1210 1211 case 6: 1212 if (_flags.isTalkie) 1213 seq_playTalkText(18); 1214 break; 1215 1216 case 12: 1217 if (!_flags.isTalkie) 1218 seq_playTalkText(14); 1219 1220 if (_flags.isTalkie) { 1221 if (_flags.lang == Common::FR_FRA || _flags.lang == Common::DE_DEU) { 1222 chatX = 75; 1223 chatY = 25; 1224 } else { 1225 chatX = 90; 1226 chatY = 30; 1227 } 1228 voiceIndex = 40; 1229 } else { 1230 chatX = 90; 1231 chatY = 30; 1232 } 1233 chatW = 100; 1234 1235 seq_playWsaSyncDialogue(29, voiceIndex, 150, chatX, chatY, chatW, wsaObj, 12, -21, x, y); 1236 1237 break; 1238 1239 default: 1240 break; 1241 } 1242 1243 _seqFrameCounter++; 1244 return 0; 1245 } 1246 1247 int KyraEngine_v2::seq_finaleFuards(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1248 uint32 endtime = 0; 1249 int chatX = 0; 1250 int chatY = 0; 1251 int chatW = 0; 1252 int chatFirstFrame = 0; 1253 int chatLastFrame = 0; 1254 int textCol = 0; 1255 1256 uint16 voiceIndex = 0; 1257 1258 switch (frm) { 1259 case -2: 1260 seq_sequenceCommand(9); 1261 endtime = _system->getMillis() + 480 * _tickLength; 1262 seq_printCreditsString(70, 240, 20, _seqTextColorMap, 252); 1263 seq_printCreditsString(71, 240, 30, _seqTextColorMap, _seqTextColor[0]); 1264 seq_printCreditsString(72, 240, 40, _seqTextColorMap, _seqTextColor[0]); 1265 seq_printCreditsString(73, 240, 50, _seqTextColorMap, _seqTextColor[0]); 1266 seq_printCreditsString(74, 240, 60, _seqTextColorMap, _seqTextColor[0]); 1267 seq_printCreditsString(75, 240, 70, _seqTextColorMap, _seqTextColor[0]); 1268 seq_printCreditsString(101, 240, 80, _seqTextColorMap, _seqTextColor[0]); 1269 seq_printCreditsString(102, 240, 90, _seqTextColorMap, _seqTextColor[0]); 1270 seq_printCreditsString(87, 240, 100, _seqTextColorMap, _seqTextColor[0]); 1271 seq_printCreditsString(88, 240, 110, _seqTextColorMap, _seqTextColor[0]); 1272 seq_printCreditsString(89, 240, 120, _seqTextColorMap, _seqTextColor[0]); 1273 seq_printCreditsString(90, 240, 130, _seqTextColorMap, _seqTextColor[0]); 1274 seq_printCreditsString(91, 240, 140, _seqTextColorMap, _seqTextColor[0]); 1275 seq_printCreditsString(92, 240, 150, _seqTextColorMap, _seqTextColor[0]); 1276 delay(endtime - _system->getMillis()); 1277 _seqEndTime = 0; 1278 break; 1279 1280 case 0: 1281 for (int i = 0; i < 0x300; i++) 1282 _screen->getPalette(0)[i] &= 0x3f; 1283 _seqTextColor[1] = 0xCf; 1284 memset(_seqTextColorMap, _seqTextColor[1], 16); 1285 _seqTextColor[0] = _seqTextColorMap[1] = 0xfe; 1286 1287 _screen->setTextColorMap(_seqTextColorMap); 1288 break; 1289 1290 case 6: 1291 _seqFrameDelay = 20; 1292 1293 if (_flags.isTalkie) { 1294 chatX = 82; 1295 chatY = (_flags.lang == Common::FR_FRA || _flags.lang == Common::DE_DEU) ? 88 :100; 1296 textCol = 143; 1297 chatFirstFrame = 16; 1298 chatLastFrame = 21; 1299 voiceIndex = 41; 1300 } else { 1301 chatX = 62; 1302 chatY = 100; 1303 textCol = 137; 1304 chatFirstFrame = 9; 1305 chatLastFrame = 13; 1306 } 1307 chatW = 80; 1308 1309 seq_playWsaSyncDialogue(30, voiceIndex, 137, chatX, chatY, chatW, wsaObj, chatFirstFrame, chatLastFrame, x, y); 1310 if (_flags.isTalkie) 1311 _seqWsaCurrentFrame = 8; 1312 break; 1313 1314 case 9: 1315 case 16: 1316 if (_flags.isTalkie) { 1317 if (frm == 16) 1318 break; 1319 chatX = 64; 1320 textCol = 137; 1321 chatFirstFrame = 9; 1322 chatLastFrame = 13; 1323 voiceIndex = 42; 1324 } else { 1325 if (frm == 9) 1326 break; 1327 chatX = 80; 1328 textCol = 143; 1329 chatFirstFrame = 16; 1330 chatLastFrame = 21; 1331 } 1332 chatY = 100; 1333 chatW = 100; 1334 1335 seq_playWsaSyncDialogue(31, voiceIndex, 143, chatX, chatY, chatW, wsaObj, chatFirstFrame, chatLastFrame, x, y); 1336 if (_flags.isTalkie) 1337 _seqWsaCurrentFrame = 21; 1338 break; 1339 1340 default: 1341 break; 1342 } 1343 1344 _seqFrameCounter++; 1345 return 0; 1346 } 1347 1348 int KyraEngine_v2::seq_finaleFirates(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1349 uint32 endtime = 0; 1350 int chatX = 0; 1351 int chatY = 0; 1352 int chatW = 0; 1353 uint16 voiceIndex = 0; 1354 1355 switch (frm) { 1356 case -2: 1357 _screen->copyPage(12, 2); 1358 _screen->copyPage(2, 0); 1359 _screen->updateScreen(); 1360 seq_sequenceCommand(9); 1361 endtime = _system->getMillis() + 480 * _tickLength; 1362 seq_printCreditsString(76, 240, 40, _seqTextColorMap, 252); 1363 seq_printCreditsString(77, 240, 50, _seqTextColorMap, 252); 1364 seq_printCreditsString(78, 240, 60, _seqTextColorMap, _seqTextColor[0]); 1365 seq_printCreditsString(79, 240, 70, _seqTextColorMap, _seqTextColor[0]); 1366 seq_printCreditsString(80, 240, 80, _seqTextColorMap, _seqTextColor[0]); 1367 seq_printCreditsString(84, 240, 100, _seqTextColorMap, 252); 1368 seq_printCreditsString(85, 240, 110, _seqTextColorMap, _seqTextColor[0]); 1369 seq_printCreditsString(99, 240, 130, _seqTextColorMap, 252); 1370 seq_printCreditsString(100, 240, 140, _seqTextColorMap, _seqTextColor[0]); 1371 delay(endtime - _system->getMillis()); 1372 _seqEndTime = 0; 1373 break; 1374 1375 case 0: 1376 _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; 1377 memset(_seqTextColorMap, _seqTextColor[1], 16); 1378 _seqTextColor[0] = _seqTextColorMap[1] = 0xff; 1379 _screen->setTextColorMap(_seqTextColorMap); 1380 break; 1381 1382 case 6: 1383 seq_playTalkText(_flags.isTalkie ? 31 : 27); 1384 break; 1385 1386 case 14: 1387 case 15: 1388 if (!((frm == 15 && !_flags.isTalkie) || (frm == 14 && _flags.isTalkie))) 1389 break; 1390 1391 seq_playTalkText(_flags.isTalkie ? 31 : 27); 1392 1393 if (_flags.isTalkie) { 1394 if (_flags.lang == Common::DE_DEU) { 1395 chatX = 82; 1396 chatY = 84; 1397 chatW = 140; 1398 } else { 1399 chatX = 74; 1400 chatY = (_flags.lang == Common::FR_FRA) ? 96: 108; 1401 chatW = 80; 1402 } 1403 voiceIndex = 43; 1404 } else { 1405 chatX = 74; 1406 chatY = 108; 1407 chatW = 80; 1408 } 1409 1410 seq_playWsaSyncDialogue(32, voiceIndex, 137, chatX, chatY, chatW, wsaObj, 14, 16, x, y); 1411 break; 1412 1413 case 28: 1414 seq_playTalkText(_flags.isTalkie ? 32 : 28); 1415 break; 1416 1417 case 29: 1418 seq_playTalkText(_flags.isTalkie ? 33 : 29); 1419 break; 1420 1421 case 31: 1422 if (_flags.isTalkie) { 1423 chatY = (_flags.lang == Common::DE_DEU) ? 60 : 76; 1424 voiceIndex = 44; 1425 } else { 1426 chatY = 76; 1427 } 1428 chatX = 90; 1429 chatW = 80; 1430 1431 seq_playWsaSyncDialogue(33, voiceIndex, 143, chatX, chatY, chatW, wsaObj, 31, 34, x, y); 1432 break; 1433 1434 case 35: 1435 _seqFrameDelay = 300; 1436 break; 1437 1438 default: 1439 break; 1440 } 1441 1442 _seqFrameCounter++; 1443 return 0; 1444 } 1445 1446 int KyraEngine_v2::seq_finaleFrash(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1447 uint32 endtime = 0; 1448 int tmp = 0; 1449 1450 switch (frm) { 1451 case -2: 1452 _screen->setCurPage(2); 1453 _screen->clearCurPage(); 1454 _screen->copyPage(2, 12); 1455 _screen->copyPage(2, 0); 1456 _screen->updateScreen(); 1457 _seqFrameCounter = 0; 1458 seq_loadNestedSequence(0, kSequenceFiggle); 1459 break; 1460 1461 case -1: 1462 // if (_flags.isTalkie) 1463 // seq_finaleActorScreen(); 1464 _seqSpecialFlag = true; 1465 break; 1466 1467 case 0: 1468 if (_seqFrameCounter == 1) { 1469 _sound->playTrack(4); 1470 _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; 1471 memset(_seqTextColorMap, _seqTextColor[1], 16); 1472 _seqTextColor[0] = _seqTextColorMap[1] = 0xff; 1473 _screen->setTextColorMap(_seqTextColorMap); 1474 } 1475 _seqFrameDelay = 10; 1476 break; 1477 1478 case 1: 1479 if (_seqFrameCounter < 20 && _seqSpecialFlag) { 1480 _seqWsaCurrentFrame = 0; 1481 } else { 1482 _seqFrameDelay = 500; 1483 seq_playTalkText(_flags.isTalkie ? 26 : 22); 1484 if (_seqSpecialFlag) { 1485 _seqFrameCounter = 3; 1486 _seqSpecialFlag = false; 1487 } 1488 } 1489 break; 1490 1491 case 2: 1492 _seqFrameDelay = 20; 1493 break; 1494 1495 case 3: 1496 seq_playTalkText(_flags.isTalkie ? 27 : 23); 1497 _seqFrameDelay = 500; 1498 break; 1499 1500 case 4: 1501 _seqFrameDelay = 10; 1502 break; 1503 1504 case 5: 1505 seq_playTalkText(_flags.isTalkie ? 27 : 23); 1506 tmp = _seqFrameCounter / 6; 1507 if (tmp == 2) 1508 _seqFrameDelay = 7; 1509 else if (tmp < 2) 1510 _seqFrameDelay = 500; 1511 break; 1512 1513 case 6: 1514 _seqFrameDelay = 10; 1515 tmp = _seqFrameCounter / 6; 1516 if (tmp == 2) 1517 _seqWsaCurrentFrame = 4; 1518 else if (tmp < 2) 1519 _seqWsaCurrentFrame = 0; 1520 break; 1521 1522 case 7: 1523 _seqFrameCounter = 0; 1524 _seqFrameDelay = 5; 1525 seq_playTalkText(_flags.isTalkie ? 26 : 22); 1526 break; 1527 1528 case 11: 1529 if (_seqFrameCounter < 8) 1530 _seqWsaCurrentFrame = 8; 1531 break; 1532 1533 default: 1534 break; 1535 } 1536 1537 _seqFrameCounter++; 1538 return 0; 1539 } 1540 1541 void KyraEngine_v2::seq_finaleActorScreen() { 1542 _screen->loadBitmap("finale.cps", 3, 3, _screen->_currentPalette); 1543 _screen->setFont(Screen::FID_GOLDFONT_FNT); 1544 1545 _sound->setSoundFileList(_dosSoundFileList, _dosSoundFileListSize); 1546 _sound->loadSoundFile(3); 1547 _sound->playTrack(3); 1548 1549 static const uint8 colormap[] = {0, 0, 102, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 1550 _screen->setTextColorMap(colormap); 1551 1552 // TODO 1553 1554 _sound->setSoundFileList(_dosSoundFileListFinale, 1); 1555 _sound->loadSoundFile(0); 1556 } 1557 1558 int KyraEngine_v2::seq_finaleFiggle(WSAMovieV2 *wsaObj, int x, int y, int frm) { 1559 if (_seqFrameCounter == 10) 1560 _seqEndTime = 0; 1561 if (_seqFrameCounter == 10 || _seqFrameCounter == 5 || _seqFrameCounter == 7) 1562 seq_playTalkText(_flags.isTalkie ? 45 : 30); 1563 1564 _seqFrameCounter++; 1565 return frm; 1566 } 1567 758 1568 uint32 KyraEngine_v2::seq_activeTextsTimeLeft() { 759 1569 uint32 res = 0; 760 1570 … … 820 1630 char *dstStr = _seqProcessedString; 821 1631 int lineStart = 0; 822 1632 int linePos = 0; 823 1633 824 1634 while (*srcStr) { 825 1635 while (*srcStr && *srcStr != 0x20) // Space 826 1636 dstStr[lineStart + linePos++] = *srcStr++; … … 828 1638 829 1639 int len = _screen->getTextWidth(&dstStr[lineStart]); 830 1640 if (width >= len && *srcStr) { 831 dstStr[lineStart + linePos++] = *srcStr++; 1641 dstStr[lineStart + linePos++] = *srcStr++; 832 1642 } else { 833 1643 dstStr[lineStart + linePos] = 0x0d; // Carriage return 834 1644 lineStart += linePos + 1; … … 838 1648 } 839 1649 } 840 1650 dstStr[lineStart + linePos] = 0; 841 1651 842 1652 return strlen(_seqProcessedString) ? dstStr : 0; 843 1653 } 844 1654 845 1655 void KyraEngine_v2::seq_sequenceCommand(int command) { 846 1656 uint8 pal[768]; 847 1657 848 1658 for (int i = 0; i < 8; i++) 849 1659 seq_resetActiveWSA(i); 850 1660 851 1661 switch (command) { 852 1662 case 0: 853 1663 memset(pal, 0, 0x300); … … 881 1691 case 5: 882 1692 _screen->copyPage(2, 0); 883 1693 break; 884 1694 885 1695 case 6: 886 1696 // UNUSED 887 1697 // seq_loadBLD("library.bld"); … … 891 1701 // UNUSED 892 1702 // seq_loadBLD("marco.bld"); 893 1703 break; 894 1704 895 1705 case 8: 896 1706 memset(pal, 0, 0x300); 897 1707 _screen->fadePalette(pal, 16); … … 900 1710 901 1711 delay(120 * _tickLength); 902 1712 break; 903 1713 904 1714 case 9: 905 1715 for (int i = 0; i < 0x100; i++) { 906 1716 int pv = (_screen->getPalette(0)[3 * i] + _screen->getPalette(0)[3 * i + 1] + _screen->getPalette(0)[3 * i + 2]) / 3; … … 922 1732 } 923 1733 924 1734 void KyraEngine_v2::seq_cmpFadeFrame(const char * cmpFile) { 925 _screen->copy BlockToPage(2, 0, 0, 320, 200, _pageBuffer1);926 _screen->copy RegionToBuffer(4, 0, 0, 320, 200, _pageBuffer1);1735 _screen->copyPage(10, 2); 1736 _screen->copyPage(4, 10); 927 1737 _screen->clearPage(6); 928 1738 _screen->loadBitmap(cmpFile, 6, 6, 0); 929 _screen->copy BlockToPage(4, 0, 0, 320, 200, _pageBuffer2);1739 _screen->copyPage(12, 4); 930 1740 931 1741 for (int i = 0; i < 3; i++) { 932 1742 uint32 endtime = _system->getMillis() + 4 * _tickLength; … … 940 1750 _screen->updateScreen(); 941 1751 _screen->copyPage(4, 2); 942 1752 _screen->copyPage(4, 6); 943 _screen->copy BlockToPage(4, 0, 0, 320, 200, _pageBuffer1);1753 _screen->copyPage(10, 4); 944 1754 } 945 1755 946 1756 void KyraEngine_v2::seq_playTalkText(uint8 chatNum) { 947 1757 debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_playIntroChat(%i)", chatNum); 948 1758 949 1759 assert(chatNum < _sequenceSoundListSize); 950 1760 951 1761 if (chatNum < 12) … … 956 1766 957 1767 void KyraEngine_v2::seq_waitForTextsTimeout() { 958 1768 debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_waitForTextsTimeout()"); 959 1769 960 1770 uint32 longest = seq_activeTextsTimeLeft() + _system->getMillis(); 961 1771 uint32 now = _system->getMillis(); 962 1772 if (longest > now) … … 973 1783 974 1784 int KyraEngine_v2::seq_setTextEntry(uint16 strIndex, uint16 posX, uint16 posY, int duration, uint16 width) { 975 1785 debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_setTextEntry(%i, %i, %i, %i, %i)", strIndex, posX, posY, duration, width); 976 1786 977 1787 for (int i = 0; i < 10; i++) { 978 1788 if (_activeText[i].duration != -1) { 979 1789 if (i < 9) … … 988 1798 _activeText[i].duration = duration * _tickLength; 989 1799 _activeText[i].width = width; 990 1800 _activeText[i].startTime = _system->getMillis(); 991 _activeText[i].textcolor = -1; 1801 _activeText[i].textcolor = -1; 992 1802 993 1803 return i; 994 1804 } … … 1000 1810 1001 1811 if (_activeWSA[wsaNum].flags != -1) 1002 1812 return; 1003 1813 1004 1814 NestedSequence s = _nSequences[seqNum]; 1005 1815 1006 1816 if (!_activeWSA[wsaNum].movie) { 1007 _activeWSA[wsaNum].movie = new WSAMovieV2(this); 1817 _activeWSA[wsaNum].movie = new WSAMovieV2(this); 1008 1818 assert(_activeWSA[wsaNum].movie); 1009 1819 } 1010 1820 … … 1023 1833 _activeWSA[wsaNum].startFrame = _activeWSA[wsaNum].currentFrame = s.startframe; 1024 1834 _activeWSA[wsaNum].frameDelay = s.frameDelay; 1025 1835 _activeWSA[wsaNum].movie->setX(0); 1026 _activeWSA[wsaNum].movie->setY(0); 1836 _activeWSA[wsaNum].movie->setY(0); 1027 1837 _activeWSA[wsaNum].movie->setDrawPage(_screen->_curPage); 1028 _activeWSA[wsaNum].callback = s.callback; 1838 _activeWSA[wsaNum].callback = s.callback; 1029 1839 _activeWSA[wsaNum].control = s.wsaControl; 1030 1840 1031 1841 _activeWSA[wsaNum].flags = s.flags | 1; … … 1034 1844 _activeWSA[wsaNum].startupCommand = s.startupCommand; 1035 1845 _activeWSA[wsaNum].finalCommand = s.finalCommand; 1036 1846 _activeWSA[wsaNum].lastFrame = 0xffff; 1037 1847 1038 1848 seq_nestedSequenceFrame(s.startupCommand, wsaNum); 1039 1849 1040 1850 if (!s.startupCommand) … … 1074 1884 _activeWSA[wsaNum].movie->setY(0); 1075 1885 seq_animatedSubFrame(8, 2, 7, 8, _activeWSA[wsaNum].movie->xAdd(), _activeWSA[wsaNum].movie->yAdd(), 1076 1886 _activeWSA[wsaNum].movie->width(), _activeWSA[wsaNum].movie->height(), 1, 1); 1077 break; 1887 break; 1078 1888 1079 1889 case 2: 1080 1890 seq_waitForTextsTimeout(); … … 1091 1901 break; 1092 1902 1093 1903 case 3: 1094 _screen->copy RegionToBuffer(2, 0, 0, 320, 200, _pageBuffer1);1904 _screen->copyPage(2, 10); 1095 1905 _activeWSA[wsaNum].movie->setDrawPage(2); 1096 1906 _activeWSA[wsaNum].movie->setX(0); 1097 1907 _activeWSA[wsaNum].movie->setY(0); 1098 1908 _activeWSA[wsaNum].movie->displayFrame(0, 0); 1099 _screen->copy RegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2);1909 _screen->copyPage(2, 12); 1100 1910 seq_cmpFadeFrame("scene2.cmp"); 1101 1911 break; 1102 1912 1103 1913 case 4: 1104 _screen->copy RegionToBuffer(2, 0, 0, 320, 200, _pageBuffer1);1914 _screen->copyPage(2, 10); 1105 1915 _activeWSA[wsaNum].movie->setDrawPage(2); 1106 1916 _activeWSA[wsaNum].movie->setX(0); 1107 1917 _activeWSA[wsaNum].movie->setY(0); 1108 1918 _activeWSA[wsaNum].movie->displayFrame(0, 0); 1109 _screen->copy RegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2);1919 _screen->copyPage(2, 12); 1110 1920 seq_cmpFadeFrame("scene3.cmp"); 1111 1921 break; 1112 1922 … … 1115 1925 } 1116 1926 } 1117 1927 1118 void KyraEngine_v2::seq_animatedSubFrame(int srcPage, int dstPage, int delaytime, int steps, 1928 void KyraEngine_v2::seq_animatedSubFrame(int srcPage, int dstPage, int delaytime, int steps, 1119 1929 int x, int y, int w, int h, int openClose, int directionFlags) { 1120 1930 1121 1931 if (openClose) { 1122 1932 for (int i = 1; i < steps; i++) { 1123 1933 uint32 endtime = _system->getMillis() + delaytime * _tickLength; … … 1134 1944 _screen->copyPage(dstPage, 0); 1135 1945 _screen->updateScreen(); 1136 1946 1137 _screen->copy BlockToPage(dstPage, 0, 0, 320, 200, _pageBuffer2);1947 _screen->copyPage(12, dstPage); 1138 1948 delayUntil(endtime); 1139 1949 } 1140 1950 … … 1143 1953 _screen->copyPage(dstPage, 0); 1144 1954 _screen->updateScreen(); 1145 1955 } else { 1146 _screen->copy BlockToPage(dstPage, 0, 0, 320, 200, _pageBuffer2);1956 _screen->copyPage(12, dstPage); 1147 1957 for (int i = steps; i; i--) { 1148 1958 uint32 endtime = _system->getMillis() + delaytime * _tickLength; 1149 1959 … … 1159 1969 _screen->copyPage(dstPage, 0); 1160 1970 _screen->updateScreen(); 1161 1971 1162 _screen->copy BlockToPage(dstPage, 0, 0, 320, 200, _pageBuffer2);1972 _screen->copyPage(12, dstPage); 1163 1973 delayUntil(endtime); 1164 1974 } 1165 1975 } … … 1185 1995 bool KyraEngine_v2::seq_processNextSubFrame(int wsaNum) { 1186 1996 uint32 currentFrame = _activeWSA[wsaNum].currentFrame; 1187 1997 uint32 currentTime = _system->getMillis(); 1188 1998 1189 1999 if (_activeWSA[wsaNum].callback && currentFrame != _activeWSA[wsaNum].lastFrame) { 1190 2000 _activeWSA[wsaNum].lastFrame = currentFrame; 1191 currentFrame = (this->*_activeWSA[wsaNum].callback)(_activeWSA[wsaNum].movie, _activeWSA[wsaNum].x, _activeWSA[wsaNum].y, currentFrame); 2001 currentFrame = (this->*_activeWSA[wsaNum].callback)(_activeWSA[wsaNum].movie, _activeWSA[wsaNum].x, _activeWSA[wsaNum].y, currentFrame); 1192 2002 } 1193 2003 1194 2004 if (_activeWSA[wsaNum].movie) { 1195 2005 _activeWSA[wsaNum].movie->setDrawPage(2); 1196 2006 _activeWSA[wsaNum].movie->setX(_activeWSA[wsaNum].x); 1197 2007 _activeWSA[wsaNum].movie->setY(_activeWSA[wsaNum].y); 1198 2008 1199 2009 if (_activeWSA[wsaNum].flags & 0x20) { 1200 2010 _activeWSA[wsaNum].movie->displayFrame(_activeWSA[wsaNum].control[currentFrame].frameIndex, 0x4000); 1201 2011 _activeWSA[wsaNum].frameDelay = _activeWSA[wsaNum].control[currentFrame].frameDelay; … … 1209 2019 } else { 1210 2020 if (((int32)(currentTime - _activeWSA[wsaNum].nextFrame) / (int32)(_activeWSA[wsaNum].frameDelay * _tickLength)) > 0) { 1211 2021 currentFrame++; 1212 _activeWSA[wsaNum].nextFrame += (_activeWSA[wsaNum].frameDelay * _tickLength);2022 _activeWSA[wsaNum].nextFrame = currentTime; 1213 2023 } 1214 2024 } 1215 2025 1216 2026 bool res = false; 1217 2027 1218 2028 if (currentFrame >= _activeWSA[wsaNum].endFrame) { … … 1221 2031 case 0: 1222 2032 res = true; 1223 2033 currentFrame = _activeWSA[wsaNum].endFrame; 1224 _screen->copy RegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2);2034 _screen->copyPage(2, 12); 1225 2035 break; 1226 2036 1227 2037 case 6: … … 1245 2055 return res; 1246 2056 } 1247 2057 2058 void KyraEngine_v2::seq_printCreditsString(uint16 strIndex, int x, int y, uint8 * colorMap, uint8 textcolor) { 2059 uint8 colormap[16]; 2060 2061 memset(&_screen->getPalette(0)[0x2fa], 0x3f, 6); 2062 _screen->getPalette(0)[0x2f6] = 0x3f; 2063 _screen->getPalette(0)[0x2f5] = 0x20; 2064 _screen->getPalette(0)[0x2f4] = 0x30; 2065 colormap[0] = colorMap[0]; 2066 colormap[1] = 0xfd; 2067 memcpy(&colormap[2], &colorMap[2], 14); 2068 uint8 seqTextColor0 = _seqTextColor[0]; 2069 2070 _seqTextColor[0] = 0xfd; 2071 _screen->setTextColorMap(colormap); 2072 seq_resetAllTextEntries(); 2073 seq_setTextEntry(strIndex, x, y, 0x80, 0x78); 2074 seq_processText(); 2075 _screen->copyPage(2, 6); 2076 _screen->copyPage(2, 0); 2077 _screen->updateScreen(); 2078 _screen->getPalette(0)[0x2f7] = _screen->getPalette(0)[textcolor * 3]; 2079 _screen->getPalette(0)[0x2f8] = _screen->getPalette(0)[textcolor * 3 + 1]; 2080 _screen->getPalette(0)[0x2f9] = _screen->getPalette(0)[textcolor * 3 + 2]; 2081 _screen->fadePalette(_screen->getPalette(0), 0x18); 2082 2083 _seqTextColor[0] = textcolor; 2084 _screen->setTextColorMap(colorMap); 2085 seq_resetAllTextEntries(); 2086 seq_setTextEntry(strIndex, x, y, 0x80, 0x78); 2087 seq_processText(); 2088 _screen->copyPage(2, 6); 2089 _screen->copyPage(2, 0); 2090 _screen->updateScreen(); 2091 _screen->getPalette(0)[0x2f7] = _screen->getPalette(0)[0x2f8] = _screen->getPalette(0)[0x2f9] = 0; 2092 _screen->fadePalette(_screen->getPalette(0), 1); 2093 _screen->copyPage(2, 12); 2094 seq_resetAllTextEntries(); 2095 2096 _seqTextColor[0] = seqTextColor0; 2097 } 2098 2099 void KyraEngine_v2::seq_playWsaSyncDialogue(uint16 strIndex, uint16 vocIndex, int textColor, int x, int y, int width, WSAMovieV2 * wsa, int firstframe, int lastframe, int wsaXpos, int wsaYpos) { 2100 int dur = strlen(_sequenceStrings[strIndex]) * (_flags.isTalkie ? 7 : 15); 2101 int entry = seq_setTextEntry(strIndex, x, y, dur, width); 2102 _activeText[entry].textcolor = textColor; 2103 uint32 chatTimeout = _system->getMillis() + dur * _tickLength; 2104 int curframe = firstframe; 2105 2106 if (vocIndex) 2107 seq_playTalkText(vocIndex); 2108 2109 while (_system->getMillis() < chatTimeout) { 2110 if (lastframe < 0) { 2111 int t = ABS(lastframe); 2112 if (t < curframe) 2113 curframe = t; 2114 } 2115 2116 if (ABS(lastframe) < curframe) 2117 curframe = firstframe; 2118 2119 uint32 frameTimeout = _seqEndTime = _system->getMillis() + _seqFrameDelay * _tickLength; 2120 if (wsa) { 2121 wsa->setDrawPage(2); 2122 wsa->setX(wsaXpos); 2123 wsa->setY(wsaYpos); 2124 wsa->displayFrame(curframe % wsa->frames(), 0); 2125 } 2126 2127 _screen->copyPage(2, 12); 2128 2129 seq_processText(); 2130 2131 uint32 tm = _system->getMillis(); 2132 if (frameTimeout > tm && chatTimeout > tm) 2133 delay(MIN(frameTimeout - tm, chatTimeout - tm)); 2134 2135 _screen->copyPage(2, 6); 2136 _screen->copyPage(2, 0); 2137 _screen->updateScreen(); 2138 curframe++; 2139 } 2140 2141 2142 2143 if (lastframe < 0) { 2144 int t = ABS(lastframe); 2145 if (t < curframe) 2146 curframe = t; 2147 } 2148 2149 if (curframe == firstframe) 2150 curframe++; 2151 2152 _seqWsaCurrentFrame = curframe; 2153 } 2154 1248 2155 void KyraEngine_v2::seq_init() { 1249 _pageBuffer1 = new uint8[64000];1250 _pageBuffer2 = new uint8[64000];1251 2156 _seqProcessedString = new char[200]; 1252 2157 _seqWsa = new WSAMovieV2(this); 1253 2158 _activeWSA = new ActiveWSA[8]; … … 1255 2160 } 1256 2161 1257 2162 void KyraEngine_v2::seq_uninit() { 1258 delete [] _pageBuffer1;1259 _pageBuffer1 = NULL;1260 1261 delete [] _pageBuffer2;1262 _pageBuffer2 = NULL;1263 1264 2163 delete [] _seqProcessedString; 1265 2164 _seqProcessedString = NULL; 1266 2165 1267 2166 delete [] _activeWSA; 1268 2167 _activeWSA = NULL; 1269 2168 1270 2169 delete [] _activeText; 1271 2170 _activeText = NULL; 1272 2171 1273 2172 delete _seqWsa; 1274 2173 _seqWsa = NULL; 1275 2174 } … … 1277 2176 // static res 1278 2177 // TODO: move to staticres.cpp 1279 2178 1280 const Sequence KyraEngine_v2::_sequences [] = {2179 const Sequence KyraEngine_v2::_sequences_PC[] = { 1281 2180 // flags, wsaFile, cpsFile, startupCommand, finalCommand, stringIndex1, stringIndex2, 1282 2181 // startFrame, numFrames, frameDelay, xPos, yPos, callback, duration 1283 2182 { 2, 0, "virgin.cps", 4, 0, -1, -1, 0, 1, 100, 0, 0, 0, 30 }, 1284 { 1, "westwood.wsa", 0, 4, 0, -1, -1, 0, 18, 12, 0, 0, &KyraEngine_v2::seq_introWestwood, 10 }, 2183 { 1, "westwood.wsa", 0, 4, 0, -1, -1, 0, 18, 6, 0, 0, &KyraEngine_v2::seq_introWestwood, 160 }, 2184 { 1, "title.wsa", 0, 4, 0, -1, -1, 0, 26, 6, 0, 0, &KyraEngine_v2::seq_introTitle, 10 }, 2185 { 2, 0, "over.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introOverview, 30 }, 2186 { 2, 0, "library.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introLibrary, 30 }, 2187 { 2, 0, "hand.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introHand, 90 }, 2188 { 1, "point.wsa", 0, 4, 8, -1, -1, 0, 38, 7, 0, 0, &KyraEngine_v2::seq_introPoint, 200 }, 2189 { 1, "zanfaun.wsa", 0, 4, 0, -1, -1, 0, 51, 16, 0, 0, &KyraEngine_v2::seq_introZanfaun, 240 }, 2190 2191 { 1, "funters.wsa", 0, 4, 0, -1, -1, 0, 27, 12, 0, 0, &KyraEngine_v2::seq_finaleFunters, 30 }, 2192 { 1, "ferb.wsa", 0, 4, 0, -1, -1, 0, 27, 16, 0, 0, &KyraEngine_v2::seq_finaleFerb, 30 }, 2193 { 1, "fish.wsa", 0, 4, 0, -1, -1, 0, 56, 12, 0, 0, &KyraEngine_v2::seq_finaleFish, 30 }, 2194 { 1, "fheep.wsa", 0, 4, 0, -1, -1, 0, 11, 12, 0, 0, &KyraEngine_v2::seq_finaleFheep, 30 }, 2195 { 1, "farmer.wsa", 0, 4, 0, -1, -1, 0, 22, 12, 0, 0, &KyraEngine_v2::seq_finaleFarmer, 100 }, 2196 { 1, "fuards.wsa", 0, 4, 0, -1, -1, 0, 24, 14, 0, 0, &KyraEngine_v2::seq_finaleFuards, 30 }, 2197 { 1, "firates.wsa", 0, 4, 0, -1, -1, 0, 37, 12, 0, 0, &KyraEngine_v2::seq_finaleFirates, 30 }, 2198 { 1, "frash.wsa", 0, 4, 0, -1, -1, 0, 12, 10, 0, 0, &KyraEngine_v2::seq_finaleFrash, 340 } 2199 }; 2200 2201 const Sequence KyraEngine_v2::_sequences_TOWNS[] = { 2202 // flags, wsaFile, cpsFile, startupCommand, finalCommand, stringIndex1, stringIndex2, 2203 // startFrame, numFrames, frameDelay, xPos, yPos, callback, duration 2204 { 2, 0, "virgin.cps", 4, 0, -1, -1, 0, 1, 100, 0, 0, 0, 30 }, 2205 { 1, "westwood.wsa", 0, 4, 0, -1, -1, 0, 18, 12, 0, 0, &KyraEngine_v2::seq_introWestwood, 160 }, 1285 2206 { 1, "title.wsa", 0, 4, 0, -1, -1, 0, 26, 12, 0, 0, &KyraEngine_v2::seq_introTitle, 10 }, 1286 2207 { 2, 0, "over.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introOverview, 30 }, 1287 2208 { 2, 0, "library.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introLibrary, 30 }, 1288 2209 { 2, 0, "hand.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introHand, 90 }, 1289 2210 { 1, "point.wsa", 0, 4, 8, -1, -1, 0, 38, 7, 0, 0, &KyraEngine_v2::seq_introPoint, 200 }, 1290 2211 { 1, "zanfaun.wsa", 0, 4, 0, -1, -1, 0, 51, 16, 0, 0, &KyraEngine_v2::seq_introZanfaun, 240 }, 2212 2213 { 1, "funters.wsa", 0, 4, 0, -1, -1, 0, 27, 12, 0, 0, &KyraEngine_v2::seq_finaleFunters, 30 }, 2214 { 1, "ferb.wsa", 0, 4, 0, -1, -1, 0, 27, 16, 0, 0, &KyraEngine_v2::seq_finaleFerb, 30 }, 2215 { 1, "fish.wsa", 0, 4, 0, -1, -1, 0, 56, 12, 0, 0, &KyraEngine_v2::seq_finaleFish, 30 }, 2216 { 1, "fheep.wsa", 0, 4, 0, -1, -1, 0, 11, 12, 0, 0, &KyraEngine_v2::seq_finaleFheep, 30 }, 2217 { 1, "farmer.wsa", 0, 4, 0, -1, -1, 0, 22, 12, 0, 0, &KyraEngine_v2::seq_finaleFarmer, 100 }, 2218 { 1, "fuards.wsa", 0, 4, 0, -1, -1, 0, 24, 14, 0, 0, &KyraEngine_v2::seq_finaleFuards, 30 }, 2219 { 1, "firates.wsa", 0, 4, 0, -1, -1, 0, 37, 12, 0, 0, &KyraEngine_v2::seq_finaleFirates, 30 }, 2220 { 1, "frash.wsa", 0, 4, 0, -1, -1, 0, 12, 10, 0, 0, &KyraEngine_v2::seq_finaleFrash, 340 } 1291 2221 }; 1292 2222 1293 2223 const NestedSequence KyraEngine_v2::_nSequences[] = { 1294 2224 // flags, wsaFile, startframe, endFrame, frameDelay, callback, x, y, wsaControl, startupCommand, finalCommand, unk1; 1295 { 0x0C, "figgle.wsa", 0, 3, 60, /*&KyraEngine_v2::seq_finaleFiggle*/0, 0, 0, 0,0, 0, 0 },2225 { 0x0C, "figgle.wsa", 0, 3, 60, &KyraEngine_v2::seq_finaleFiggle, 0, 0, 0, 0, 0, 0 }, 1296 2226 1297 2227 { 8, "over1.wsa", 0, 10, 10, &KyraEngine_v2::seq_introOver1, 0, 0, 0, 0, 0, 0 }, 1298 2228 { 8, "over2.wsa", 0, 11, 9, &KyraEngine_v2::seq_introOver2, 0, 0, 0, 0, 0, 0 }, … … 1300 2230 { 8, "dragon.wsa", 0, 11, 6, &KyraEngine_v2::seq_introDragon, 0, 0, 0, 2, 0, 0 }, 1301 2231 { 2, "darm.wsa", 0, 19, 9, &KyraEngine_v2::seq_introDarm, 0, 0, 0, 4, 0, 0 }, 1302 2232 { 2, "library.wsa", 0, 33, 9, &KyraEngine_v2::seq_introLibrary2, 0, 0, 0, 4, 0, 0 }, 1303 { 0x2A, "library.wsa", 0, 1 8, 9, &KyraEngine_v2::seq_introLibrary2, 0, 0, _wsaControlLibrary, 0, 0, 0 },2233 { 0x2A, "library.wsa", 0, 19, 9, &KyraEngine_v2::seq_introLibrary2, 0, 0, _wsaControlLibrary, 0, 0, 0 }, 1304 2234 { 0x0A, "marco.wsa", 0, 37, 9, &KyraEngine_v2::seq_introMarco, 0, 0, 0, 4, 0, 0 }, 1305 2235 { 2, "hand1a.wsa", 0, 34, 9, &KyraEngine_v2::seq_introHand1a, 0, 0, 0, 0, 0, 0 }, 1306 2236 { 0x2A, "hand1b.wsa", 0, 16, 9, &KyraEngine_v2::seq_introHand1b, 0, 0, _wsaControlHand1b, 0, 0, 0 }, … … 1327 2257 {0x00, 0x06}, {0x01, 0x06}, {0x02, 0x06}, {0x03, 0x06}, {0x04, 0x06}, {0x03, 0x06}, 1328 2258 {0x04, 0x06}, {0x05, 0x40}, {0x05, 0x06} 1329 2259 }; 1330 2260 1331 2261 const SequenceControl KyraEngine_v2::_wsaControlHand2[] = { 1332 2262 {0x00, 0x06}, {0x01, 0x06}, {0x00, 0x06}, {0x01, 0x06}, {0x00, 0x06}, {0x01, 0x06}, 1333 2263 {0x00, 0x06}, {0x01, 0x06}, {0x00, 0x06}, {0x01, 0x06}, {0x00, 0x06}, {0x01, 0x06}, 1334 {0x00, 0x06}, {0x01, 0x06}, {0x00, 0x06}, {0x01, 0x06} 2264 {0x00, 0x06}, {0x01, 0x06}, {0x00, 0x06}, {0x01, 0x06} 1335 2265 }; 1336 2266 1337 2267 const SequenceControl KyraEngine_v2::_wsaControlHand3[] = { -
sound.cpp
81 81 } 82 82 83 83 if (_currentVocFile) { 84 _mixer->stopHandle(_vocHandle);84 //_mixer->stopHandle(_vocHandle); 85 85 _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_vocHandle, _currentVocFile); 86 86 } 87 87 delete [] fileData; -
staticres.cpp
1154 1154 1155 1155 // kyra 2 static res 1156 1156 1157 const char *KyraEngine_v2::_sequenceStrings [] = {1157 const char *KyraEngine_v2::_sequenceStrings_PC_EN[] = { 1158 1158 "Kyrandia is disappearing!", 1159 1159 "Rock by rock...", 1160 1160 "...and tree by tree.", … … 1193 1193 1194 1194 "Executive Producer", 1195 1195 "Brett W. Sperry", 1196 "Direction & Design", 1197 "Rick Gush", 1198 "Lead Programmer", 1199 "Michael Legg", 1200 "Art Management", 1201 "Louis Castle", 1202 "Joseph B. Hewitt IV", 1203 "Lead Artist", 1204 "Rick Parks", 1205 "Additional Coding by", 1206 "Philip W. Gorrow", 1207 "Mike Grayford", 1208 "Mark McCubbin", 1209 "Artists", 1210 "Cameron Chun", 1211 "Cary Averett", 1212 "Cindy Chinn", 1213 "Elie Arabian", 1214 "Fei Cheng", 1215 "Ferby Miguel", 1216 "Frank Mendeola", 1217 "Jack Martin", 1218 "Jerry Moore", 1219 "DUMMY STRING... ", 1220 "Judith Peterson", 1221 "Larry Miller", 1222 "Lenny Lee", 1223 "Louise Sandoval", 1224 "Ren Olsen", 1225 "Music & Sounds by", 1226 "Paul Mudra", 1227 "Frank Klepacki", 1228 "Dwight Okahara", 1229 "Pat Collins", 1230 "Quality Assurance by", 1231 "Glenn Sperry", 1232 "Michael Lightner", 1233 "William Foster", 1234 "Jesse Clemit", 1235 "Jeff Fillhaber", 1236 "Manual, Package Design", 1237 "& Fulfillment", 1238 "Eydie Laramore", 1239 "Lisa Marcinko", 1240 "Lauren Rifkin", 1241 "Congratulations!", 1242 "Thank you for playing The Hand of Fate!", 1243 "Guest Coding", 1244 "Producer Liaison", 1245 "Scott Duckett", 1246 "Irvine Testers", 1247 "Chris McFarland", 1248 "Paul Moore", 1249 "Chad Soares", 1250 "Jared Brinkley", 1251 "Jon Willliams", 1252 "Chris Toft", 1253 "Joe Kucan's Hair by", 1254 "Theodore A. Morris", 1255 "Load a game", 1256 "Introduction", 1257 "Start a new game", 1258 "Exit the game", 1259 "Special Thanks, to", 1260 "Sake Joe Bostic-san", 1261 "Tim Fritz", 1262 "Kenny Dunne", 1263 "Thank you for playing \"The Hand of Fate\." 1264 }; 1265 1266 const char *KyraEngine_v2::_sequenceStrings_TOWNS_EN[] = { 1267 "Kyrandia is disappearing!", 1268 "Rock by rock...", 1269 "...and tree by tree.", 1270 "Kyrandia ceases to exist!", 1271 "The Royal Mystics are baffled.", 1272 "Every reference has been consulted.", 1273 "Even Marko and his new valet have been allowed into the conference.", 1274 "Luckily, the Hand was experienced in these matters.", 1275 "And finally a plan was approved...", 1276 "...that required a magic Anchor Stone...", 1277 "...to be retrieved from the center of the world.", 1278 "Zanthia, youngest of the Kyrandian Mystics, has been selected to retrieve the Stone.", 1279 "Thank you for playing The Hand of Fate.", 1280 "This should be enough blueberries to open a portal to the center of the world.", 1281 " DUMMY STRING... ", 1282 " DUMMY STRING... ", 1283 "Hey! All my equipment has been stolen!", 1284 " DUMMY STRING... ", 1285 "If they think I'm going to walk all the way down there, they're nuts!", 1286 " DUMMY STRING... ", 1287 " DUMMY STRING... ", 1288 "Hurry up Faun!", 1289 1290 "Boy, that was a close call!", 1291 "You said it pal. I, for one, am never going hunting again!", 1292 "Ribbit.", 1293 "How many times do I have to tell you? You're a toad.", 1294 "Oh no! We're out of cheese!", 1295 "Let's try this earwax. It's orange.", 1296 "Mommy, when do I get the ivy?", 1297 "Get out of here, shoo!", 1298 "You cut, and I'll choose.", 1299 "No. You cut and I'll choose.", 1300 "I still say it was derivative drivel.", 1301 "Aw, you still wouldn't recognize iambic pentameter if it bit you on the butt!", 1302 1303 "Executive Producer", 1304 "Brett W. Sperry", 1196 1305 "Designed & Directed by", 1197 1306 "Rick Gush", 1198 1307 "Lead Programmer", … … 1264 1373 "Takeshi Abo (Japan)" 1265 1374 }; 1266 1375 1267 const int KyraEngine_v2::_sequenceStringsSize = ARRAYSIZE(KyraEngine_v2::_sequenceStrings); 1376 const int KyraEngine_v2::_sequenceStringsSize_PC_EN = ARRAYSIZE(KyraEngine_v2::_sequenceStrings_PC_EN); 1377 const int KyraEngine_v2::_sequenceStringsSize_TOWNS_EN = ARRAYSIZE(KyraEngine_v2::_sequenceStrings_TOWNS_EN); 1268 1378 1269 const char *KyraEngine_v2::_sequenceSoundList PC[] = {1379 const char *KyraEngine_v2::_sequenceSoundList_PC[] = { 1270 1380 "eintro1", 1271 1381 "eintro2", 1272 1382 "eintro3", … … 1317 1427 "theend" 1318 1428 }; 1319 1429 1320 const int KyraEngine_v2::_sequenceSoundListPCSize = ARRAYSIZE(KyraEngine_v2::_sequenceSoundListPC); 1430 const char *KyraEngine_v2::_sequenceSoundList_TOWNS[] = { 1431 "intro1.pcm", 1432 "intro2.pcm", 1433 "intro3.pcm", 1434 "intro4.pcm", 1435 "intro5.pcm", 1436 "intro6.pcm", 1437 "intro7.pcm", 1438 "intro8.pcm", 1439 "intro9.pcm", 1440 "intro10.pcm", 1441 "intro11.pcm", 1442 "intro12.pcm", 1443 "glow.pcm", 1321 1444 1445 "asong.pcm", 1446 "crowcaw.pcm", 1447 "eyerub2.pcm", 1448 "pluck3.pcm", 1449 "rodnreel.pcm", 1450 "frog1.pcm", 1451 "scavmov2.pcm", 1452 "lambmom3.pcm", 1453 "lambkid1.pcm", 1454 "thunder2.pcm", 1455 "thunder3.pcm", 1456 "wind6.pcm", 1457 "h2odrop2.pcm", 1458 "gasleak.pcm", 1459 "polgulp1.pcm", 1460 "hndslap1.pcm", 1461 "burp1.pcm", 1462 "scream1.pcm", 1463 "theend.pcm" 1464 }; 1465 1466 const int KyraEngine_v2::_sequenceSoundListSize_PC = ARRAYSIZE(KyraEngine_v2::_sequenceSoundList_PC); 1467 const int KyraEngine_v2::_sequenceSoundListSize_TOWNS = ARRAYSIZE(KyraEngine_v2::_sequenceSoundList_TOWNS); 1468 1322 1469 const uint8 KyraEngine_v2::_seqTextColorPresets[] = { 0x01, 0x01, 0x00, 0x3f, 0x3f, 0x3f }; 1323 1470 1324 1471 const char *KyraEngine_v2::_languageExtension[] = { … … 1374 1521 0, 2, 0, 0, 0, 0, 0, 0 1375 1522 }; 1376 1523 1524 const char *KyraEngine_v2::_dosSoundFileListIntro[] = { "K2INTRO" }; 1525 const char *KyraEngine_v2::_dosSoundFileListFinale[] = { "K2FINALE" }; 1526 1377 1527 const char *KyraEngine_v2::_dosSoundFileList[] = { 1378 1528 "K2TEST1", 1379 1529 "K2TEST2",