diff options
author | Oystein Eftevaag | 2007-11-05 08:23:57 +0000 |
---|---|---|
committer | Oystein Eftevaag | 2007-11-05 08:23:57 +0000 |
commit | eb42e8271e047c14dcee6b1389b530baec151d95 (patch) | |
tree | eac8ff5ae0efd470e6c64d21f61d9eb9433c634e | |
parent | 975dbcd23176dfd5850975aa9670e169adcf3b9a (diff) | |
download | scummvm-rg350-eb42e8271e047c14dcee6b1389b530baec151d95.tar.gz scummvm-rg350-eb42e8271e047c14dcee6b1389b530baec151d95.tar.bz2 scummvm-rg350-eb42e8271e047c14dcee6b1389b530baec151d95.zip |
Committing '[ 1824376 ] KYRA: more sequence player code' from Florian, with a couple of warnings fixed
svn-id: r29417
-rw-r--r-- | engines/kyra/detection.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_v2.cpp | 267 | ||||
-rw-r--r-- | engines/kyra/kyra_v2.h | 188 | ||||
-rw-r--r-- | engines/kyra/screen_v2.cpp | 5 | ||||
-rw-r--r-- | engines/kyra/screen_v2.h | 3 | ||||
-rw-r--r-- | engines/kyra/sequences_v2.cpp | 1270 | ||||
-rw-r--r-- | engines/kyra/sound.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 158 | ||||
-rw-r--r-- | engines/kyra/text_v2.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/wsamovie.h | 2 |
10 files changed, 1504 insertions, 395 deletions
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index 2c006dd61a..67872affd2 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -49,7 +49,7 @@ namespace { #define KYRA1_CD_FLAGS FLAGS(false, true, true, false, Kyra::GI_KYRA1) #define KYRA1_DEMO_FLAGS FLAGS(true, false, false, false, Kyra::GI_KYRA1) -#define KYRA2_CD_FLAGS FLAGS(false, false, false, false, Kyra::GI_KYRA2) +#define KYRA2_CD_FLAGS FLAGS(false, false, true, false, Kyra::GI_KYRA2) #define KYRA2_DEMO_FLAGS FLAGS(true, false, false, false, Kyra::GI_KYRA2) #define KYRA3_CD_FLAGS FLAGS(false, false, true, false, Kyra::GI_KYRA3) diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 3ef46a33b9..8ec9899393 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -45,15 +45,14 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags) : KyraEngi _screen = 0; _text = 0; - _pageBuffer1 = _pageBuffer2 = 0; _seqProcessedString = 0; _activeWSA = 0; _activeText = 0; _seqWsa = 0; - + _gamePlayBuffer = 0; _cCodeBuffer = _optionsBuffer = _chapterBuffer = 0; - + _overwriteSceneFacing = false; _mainCharX = _mainCharY = -1; _drawNoShapeFlag = false; @@ -80,11 +79,11 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags) : KyraEngi _chatVocLow = -1; _chatText = 0; _chatObject = -1; - + _currentTalkSections.STATim = NULL; _currentTalkSections.TLKTim = NULL; _currentTalkSections.ENDTim = NULL; - + memset(&_sceneScriptData, 0, sizeof(_sceneScriptData)); } @@ -114,7 +113,7 @@ int KyraEngine_v2::init() { assert(_debugger); _text = new TextDisplayer_v2(this, _screen); assert(_text); - + setupTimers(); _screen->loadFont(_screen->FID_6_FNT, "6.FNT"); @@ -123,14 +122,26 @@ int KyraEngine_v2::init() { _screen->loadFont(_screen->FID_BOOKFONT_FNT, "BOOKFONT.FNT"); _screen->setAnimBlockPtr(3504); _screen->setScreenDim(0); - - for (int i = 0; i < 33; i++) - _sequenceStringsDuration[i] = strlen(_sequenceStrings[i]) * 8; - + _abortIntroFlag = false; - _sequenceSoundList = (const char * const *) _sequenceSoundListPC; - _sequenceSoundListSize = _sequenceSoundListPCSize; + // temporary solution until staticres manager support (kyra.dat) is added for kyra 2 + if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) { + _sequenceSoundList = (const char * const *) _sequenceSoundList_TOWNS; + _sequenceSoundListSize = _sequenceSoundListSize_TOWNS; + _sequenceStrings = (const char * const *) _sequenceStrings_TOWNS_EN; + _sequenceStringsSize = _sequenceStringsSize_TOWNS_EN; + _sequences = (const Sequence*) _sequences_TOWNS; + } else { + _sequenceSoundList = (const char * const *) _sequenceSoundList_PC; + _sequenceSoundListSize = _sequenceSoundListSize_PC; + _sequenceStrings = (const char * const *) _sequenceStrings_PC_EN; + _sequenceStringsSize = _sequenceStringsSize_PC_EN; + _sequences = (const Sequence*) _sequences_PC; + } + + for (int i = 0; i < 33; i++) + _sequenceStringsDuration[i] = strlen(_sequenceStrings[i]) * 8; // No mouse display in demo if (_flags.isDemo) @@ -149,38 +160,20 @@ int KyraEngine_v2::init() { } int KyraEngine_v2::go() { - // TODO move this to a better location, since for ingame we setup - // our soundfile list in KyraEngine_v2::startup for example - // so this should be just used in the sequenceplayer code, - // so maybe move this to KyraEngine_v2::seq_init - if (_flags.isDemo) { - static const char *soundFileList[] = { - "K2_DEMO", - "LOLSYSEX" - }; - _sound->setSoundFileList(soundFileList, 2); - } else { - // TODO: move this to proper place - static const char *soundFileList[] = { - "K2INTRO" - }; - _sound->setSoundFileList(soundFileList, 1); - } - _sound->loadSoundFile(0); - - // Temporary measure to work around the fact that there's + // Temporary measure to work around the fact that there's // several WSA files with identical names in different PAK files. _res->unloadPakFile("OUTFARM.PAK"); _res->unloadPakFile("FLYTRAP.PAK"); seq_playSequences(kSequenceVirgin, kSequenceZanfaun); + //seq_playSequences(kSequenceFunters, kSequenceFrash); if (_menuChoice == 1) { startup(); runLoop(); cleanup(); } else if (_menuChoice == 3) { - // Load Savegame + // Load Game } return 0; @@ -199,28 +192,28 @@ void KyraEngine_v2::startup() { memset(_sceneShapeTable, 0, sizeof(_sceneShapeTable)); _gamePlayBuffer = new uint8[46080]; _unkBuf500Bytes = new uint8[500]; - + loadMouseShapes(); loadItemShapes(); - + _screen->setMouseCursor(0, 0, getShapePtr(0)); - + _screenBuffer = new uint8[64000]; - + loadCCodeBuffer("C_CODE.XXX"); loadOptionsBuffer("OPTIONS.XXX"); loadChapterBuffer(_newChapterFile); - + _unkBuf200kByte = new uint8[200000]; - + showMessageFromCCode(265, 150, 0); - + openTalkFile(0); _currentTalkFile = 1; openTalkFile(1); - + showMessage(0, 207); - + _screen->setShapePages(5, 3); memset(&_mainCharacter, 0, sizeof(_mainCharacter)); @@ -228,34 +221,34 @@ void KyraEngine_v2::startup() { _mainCharacter.facing = 4; _mainCharacter.animFrame = 0x12; memset(_mainCharacter.inventory, -1, sizeof(_mainCharacter.inventory)); - + memset(_sceneAnims, 0, sizeof(_sceneAnims)); for (int i = 0; i < ARRAYSIZE(_sceneAnimMovie); ++i) _sceneAnimMovie[i] = new WSAMovieV2(this); memset(_wsaSlots, 0, sizeof(_wsaSlots)); for (int i = 0; i < ARRAYSIZE(_wsaSlots); ++i) _wsaSlots[i] = new WSAMovieV2(this); - + _maskPage = 0;//_screen->getPagePtr(5); _screen->_curPage = 0; - + _talkObjectList = new TalkObject[72]; memset(_talkObjectList, 0, sizeof(TalkObject)*72); _shapeDescTable = new ShapeDesc[55]; memset(_shapeDescTable, 0, sizeof(ShapeDesc)*55); - + for (int i = 9; i <= 32; ++i) { _shapeDescTable[i-9].width = 30; _shapeDescTable[i-9].height = 55; _shapeDescTable[i-9].xAdd = -15; _shapeDescTable[i-9].yAdd = -50; } - + for (int i = 19; i <= 24; ++i) { _shapeDescTable[i-9].width = 53; _shapeDescTable[i-9].yAdd = -51; } - + _gfxBackUpRect = new uint8[_screen->getRectSize(32, 32)]; _itemList = new Item[30]; memset(_itemList, 0, sizeof(Item)*30); @@ -270,24 +263,24 @@ void KyraEngine_v2::startup() { _screen->copyPage(3, 0); _screen->showMouse(); _screen->hideMouse(); - + clearAnimObjects(); - + // XXX - + _sceneList = new SceneDesc[86]; memset(_sceneList, 0, sizeof(SceneDesc)*86); _sceneListSize = 86; runStartScript(1, 0); loadNPCScript(); - + // XXX snd_playWanderScoreViaMap(52, 1); // XXX - + enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1); _screen->showMouse(); - + //sub_20EE8(1); //setNextIdleAnimTimer(); //XXX @@ -296,7 +289,7 @@ void KyraEngine_v2::startup() { void KyraEngine_v2::runLoop() { _screen->updateScreen(); - + _quitFlag = false; while (!_quitFlag) { //XXX @@ -321,17 +314,17 @@ void KyraEngine_v2::handleInput(int x, int y) { _unk5 = 0; return; } - + if (!_screen->isMouseVisible()) return; - + if (_unk3 == -2) { snd_playSoundEffect(13); return; } - + //setNextIdleAnimTimer(); - + if (x <= 6 || x >= 312 || y <= 6 || y >= 135) { bool exitOk = false; assert(_unk3 + 6 >= 0); @@ -340,32 +333,32 @@ void KyraEngine_v2::handleInput(int x, int y) { if (_sceneExit1 != 0xFFFF) exitOk = true; break; - + case 1: if (_sceneExit2 != 0xFFFF) exitOk = true; break; - + case 2: if (_sceneExit3 != 0xFFFF) exitOk = true; break; - + case 3: if (_sceneExit4 != 0xFFFF) exitOk = true; break; - + default: break; } - + if (exitOk) { inputSceneChange(x, y, 1, 1); return; } } - + if (checkCharCollision(x, y) >= 0 && _unk3 >= -1) { runSceneScript2(); return; @@ -391,7 +384,7 @@ void KyraEngine_v2::handleInput(int x, int y) { //if (_unk1 <= -1) // skipHandling = 1; - + if (skipHandling) return; @@ -429,12 +422,12 @@ bool KyraEngine_v2::handleInputUnkSub(int x, int y) { return true; } else { _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); - + _sceneScriptState.regs[1] = x; _sceneScriptState.regs[2] = y; _sceneScriptState.regs[3] = 0; _sceneScriptState.regs[4] = _itemInHand; - + _scriptInterpreter->startScript(&_sceneScriptState, 1); while (_scriptInterpreter->validScript(&_sceneScriptState)) @@ -492,7 +485,7 @@ void KyraEngine_v2::updateMouse() { int type = 0; int xOffset = 0, yOffset = 0; Common::Point mouse = getMousePos(); - + if (mouse.y <= 145) { if (mouse.x <= 6) { if (_sceneExit4 != 0xFFFF) { @@ -511,7 +504,7 @@ void KyraEngine_v2::updateMouse() { yOffset = 5; } else { type = -2; - } + } } else if (mouse.y >= 135) { if (_sceneExit3 != 0xFFFF) { type = -4; @@ -520,7 +513,7 @@ void KyraEngine_v2::updateMouse() { yOffset = 10; } else { type = -2; - } + } } else if (mouse.y <= 6) { if (_sceneExit1 != 0xFFFF) { type = -6; @@ -529,10 +522,10 @@ void KyraEngine_v2::updateMouse() { yOffset = 1; } else { type = -2; - } + } } } - + for (int i = 0; i < _specialExitCount; ++i) { if (checkSpecialSceneExit(i, mouse.x, mouse.y)) { switch (_specialExitTable[20+i]) { @@ -542,47 +535,47 @@ void KyraEngine_v2::updateMouse() { xOffset = 5; yOffset = 1; break; - + case 2: type = -5; shapeIndex = 2; xOffset = 7; yOffset = 5; break; - + case 4: type = -4; shapeIndex = 3; xOffset = 5; yOffset = 7; break; - + case 6: type = -3; shapeIndex = 4; xOffset = 1; yOffset = 5; break; - + default: break; } } } - + if (type == -2) { shapeIndex = 5; xOffset = 5; yOffset = 9; } - + if (type != 0 && _handItemSet != type) { _handItemSet = type; _screen->hideMouse(); _screen->setMouseCursor(xOffset, yOffset, getShapePtr(shapeIndex)); _screen->showMouse(); } - + if (type == 0 && _handItemSet != _itemInHand) { if ((mouse.y > 145) || (mouse.x > 6 && mouse.x < 312 && mouse.y > 6 && mouse.y < 135)) { _handItemSet = _itemInHand; @@ -619,7 +612,7 @@ int KyraEngine_v2::checkInput(void *p) { // as when RETURN was pressed, but it *should* work for now Common::Point pos = getMousePos(); _mouseX = pos.x; - _mouseY = pos.y; + _mouseY = pos.y; keys = 199; } @@ -640,11 +633,11 @@ int KyraEngine_v2::checkInput(void *p) { case Common::EVENT_QUIT: _quitFlag = true; break; - + default: break; } - + if (_debugger->isAttached()) _debugger->onFrame(); @@ -653,7 +646,7 @@ int KyraEngine_v2::checkInput(void *p) { _eventList.erase(_eventList.begin()); } - + _system->delayMillis(10); return keys; } @@ -686,24 +679,24 @@ void KyraEngine_v2::cleanup() { delete [] _unkBuf500Bytes; delete [] _screenBuffer; delete [] _unkBuf200kByte; - + resetNewShapes(_newShapeCount, _newShapeFiledata); for (int i = 0; i < ARRAYSIZE(_defaultShapeTable); ++i) delete [] _defaultShapeTable[i]; freeSceneShapePtrs(); - + delete [] _cCodeBuffer; delete [] _optionsBuffer; delete [] _chapterBuffer; - + delete [] _talkObjectList; delete [] _shapeDescTable; - + delete [] _gfxBackUpRect; - + delete [] _sceneList; - + for (int i = 0; i < ARRAYSIZE(_sceneAnimMovie); ++i) delete _sceneAnimMovie[i]; for (int i = 0; i < ARRAYSIZE(_wsaSlots); ++i) @@ -716,7 +709,7 @@ void KyraEngine_v2::loadCCodeBuffer(const char *file) { char tempString[13]; strcpy(tempString, file); changeFileExtension(tempString); - + delete [] _cCodeBuffer; _cCodeBuffer = _res->fileData(tempString, 0); } @@ -725,7 +718,7 @@ void KyraEngine_v2::loadOptionsBuffer(const char *file) { char tempString[13]; strcpy(tempString, file); changeFileExtension(tempString); - + delete [] _optionsBuffer; _optionsBuffer = _res->fileData(tempString, 0); } @@ -740,7 +733,7 @@ void KyraEngine_v2::loadChapterBuffer(int chapter) { assert(chapter >= 1 && chapter <= ARRAYSIZE(chapterFilenames)); strcpy(tempString, chapterFilenames[chapter-1]); changeFileExtension(tempString); - + delete [] _chapterBuffer; _chapterBuffer = _res->fileData(tempString, 0); _currentChapter = chapter; @@ -759,20 +752,20 @@ const uint8 *KyraEngine_v2::getTableEntry(const uint8 *buffer, int id) { const char *KyraEngine_v2::getTableString(int id, const uint8 *buffer, int decode) { const char *string = (const char*)getTableEntry(buffer, id); - + if (decode) { decodeString1(string, _internStringBuf); decodeString2(_internStringBuf, _internStringBuf); string = _internStringBuf; } - + return string; } const char *KyraEngine_v2::getChapterString(int id) { if (_currentChapter != _newChapterFile) loadChapterBuffer(_newChapterFile); - + return getTableString(id, _chapterBuffer, 1); } @@ -781,7 +774,7 @@ int KyraEngine_v2::decodeString1(const char *src, char *dst) { 0x20, 0x65, 0x74, 0x61, 0x69, 0x6E, 0x6F, 0x73, 0x72, 0x6C, 0x68, 0x63, 0x64, 0x75, 0x70, 0x6D }; - + static const uint8 decodeTable2[] = { 0x74, 0x61, 0x73, 0x69, 0x6F, 0x20, 0x77, 0x62, 0x20, 0x72, 0x6E, 0x73, 0x64, 0x61, 0x6C, 0x6D, 0x68, 0x20, 0x69, 0x65, 0x6F, 0x72, @@ -845,7 +838,7 @@ void KyraEngine_v2::showMessage(const char *string, int16 palIndex) { _shownMessage = string; _screen->hideMouse(); _screen->fillRect(0, 190, 319, 199, 0xCF); - + if (string) { if (palIndex != -1 || _msgUnk1) { palIndex *= 3; @@ -859,7 +852,7 @@ void KyraEngine_v2::showMessage(const char *string, int16 palIndex) { setTimer1DelaySecs(7); } - + _msgUnk1 = 0; _screen->showMouse(); } @@ -893,7 +886,7 @@ void KyraEngine_v2::updateCommandLineEx(int str1, int str2, int16 palIndex) { void KyraEngine_v2::loadMouseShapes() { _screen->loadBitmap("_MOUSE.CSH", 3, 3, 0); - + for (int i = 0; i <= 8; ++i) { _defaultShapeTable[i] = _screen->makeShapeCopy(_screen->getCPagePtr(3), i); assert(_defaultShapeTable[i]); @@ -902,44 +895,44 @@ void KyraEngine_v2::loadMouseShapes() { void KyraEngine_v2::loadItemShapes() { _screen->loadBitmap("_ITEMS.CSH", 3, 3, 0); - + for (int i = 64; i <= 239; ++i) { _defaultShapeTable[i] = _screen->makeShapeCopy(_screen->getCPagePtr(3), i-64); assert(_defaultShapeTable[i]); } - + _res->loadFileToBuf("_ITEMHT.DAT", _itemHtDat, sizeof(_itemHtDat)); assert(_res->getFileSize("_ITEMHT.DAT") == sizeof(_itemHtDat)); - + _screen->_curPage = 0; } void KyraEngine_v2::loadZShapes(int shapes) { char file[10]; strcpy(file, "_ZX.SHP"); - + _loadedZTable = shapes; file[2] = '0' + shapes; - + uint8 *data = _res->fileData(file, 0); for (int i = 9; i <= 32; ++i) { delete [] _defaultShapeTable[i]; _defaultShapeTable[i] = _screen->makeShapeCopy(data, i-9); } delete [] data; - + _loadedZTable = shapes; } void KyraEngine_v2::loadInventoryShapes() { int curPageBackUp = _screen->_curPage; _screen->_curPage = 2; - + _screen->loadBitmap("_PLAYALL.CPS", 3, 3, 0); - + for (int i = 0; i < 10; ++i) _defaultShapeTable[240+i] = _screen->encodeShape(_inventoryX[i], _inventoryY[i], 16, 16, 0); - + _screen->_curPage = curPageBackUp; } @@ -950,7 +943,7 @@ void KyraEngine_v2::runStartScript(int script, int unk1) { ScriptData scriptData; ScriptState scriptState; - + _scriptInterpreter->loadScript(filename, &scriptData, &_opcodes); _scriptInterpreter->initScript(&scriptState, &scriptData); scriptState.regs[6] = unk1; @@ -963,24 +956,24 @@ void KyraEngine_v2::runStartScript(int script, int unk1) { void KyraEngine_v2::loadNPCScript() { char filename[12]; strcpy(filename, "_NPC.EMC"); - + switch (_lang) { case 0: filename[5] = 'E'; break; - + case 1: filename[5] = 'F'; break; - + case 2: filename[5] = 'G'; break; - + default: break; }; - + _scriptInterpreter->loadScript(filename, &_npcScriptData, &_opcodes); } @@ -1005,7 +998,7 @@ void KyraEngine_v2::runTemporaryScript(const char *filename, int unk1, int unk2, _newShapeFiledata = _res->fileData(_newShapeFilename, 0); assert(_newShapeFiledata); } - + fileData = _newShapeFiledata; if (!fileData) @@ -1108,13 +1101,13 @@ int KyraEngine_v2::inputSceneChange(int x, int y, int unk1, int unk2) { x = 4; y = _sceneEnterY4; _pathfinderFlag = 7; - } + } } else if (_unk3 == -5) { if (_sceneList[curScene].exit2 != 0xFFFF) { x = 316; y = _sceneEnterY2; _pathfinderFlag = 7; - } + } } else if (_unk3 == -6) { if (_sceneList[curScene].exit1 != 0xFFFF) { x = _sceneEnterX1; @@ -1129,7 +1122,7 @@ int KyraEngine_v2::inputSceneChange(int x, int y, int unk1, int unk2) { } } } - + if (_pathfinderFlag) { if (findItem(curScene, 13) >= 0 && _unk3 <= -3) { //XXX @@ -1149,27 +1142,27 @@ int KyraEngine_v2::inputSceneChange(int x, int y, int unk1, int unk2) { return 0; } } - + if (ABS(_mainCharacter.x1 - x) < 4 || ABS(_mainCharacter.y1 - y) < 2) return 0; - + int curX = _mainCharacter.x1 & ~3; int curY = _mainCharacter.y1 & ~1; int dstX = x & ~3; int dstY = y & ~1; - + int wayLength = findWay(curX, curY, dstX, dstY, _movFacingTable, 600); _pathfinderFlag = 0; _timer->disable(5); - + if (wayLength != 0 && wayLength != 0x7D00) refreshNPC = (trySceneChange(_movFacingTable, unk1, unk2) != 0); //XXX - + if (refreshNPC) enterNewSceneUnk2(0); - + _pathfinderFlag = 0; return refreshNPC; } @@ -1185,29 +1178,29 @@ void KyraEngine_v2::moveCharacter(int facing, int x, int y) { _mainCharacter.facing = facing; x &= ~3; y &= ~1; - + _screen->hideMouse(); switch (facing) { case 0: while (y < _mainCharacter.y1) updateCharPosWithUpdate(); break; - - case 2: + + case 2: while (_mainCharacter.x1 < x) updateCharPosWithUpdate(); break; - + case 4: while (y > _mainCharacter.y1) updateCharPosWithUpdate(); break; - + case 6: while (_mainCharacter.x1 > x) updateCharPosWithUpdate(); break; - + default: break; } @@ -1222,7 +1215,7 @@ int KyraEngine_v2::updateCharPos(int *table) { if (_system->getMillis() < nextUpdate) return 0; - + int facing = _mainCharacter.facing; _mainCharacter.x1 += updateX[facing]; _mainCharacter.y1 += updateY[facing]; @@ -1306,15 +1299,15 @@ int KyraEngine_v2::checkCharCollision(int x, int y) { scale1 = getScale(_mainCharacter.x1, _mainCharacter.y1); scale2 = (scale1 * 24) >> 8; scale3 = (scale1 * 48) >> 8; - + x1 = _mainCharacter.x1 - (scale2 >> 1); x2 = _mainCharacter.x1 + (scale2 >> 1); y1 = _mainCharacter.y1 - scale3; y2 = _mainCharacter.y1; - + if (x >= x1 && x <= x2 && y >= y1 && y <= y2) return 0; - + return -1; } @@ -1677,10 +1670,10 @@ void KyraEngine_v2::setupOpcodeTable() { Opcode(o2_dummy), Opcode(o2_dummy), }; - + for (int i = 0; i < ARRAYSIZE(opcodeTable); ++i) _opcodes.push_back(&opcodeTable[i]); - + static const OpcodeV2 opcodeTemporaryTable[] = { Opcode(o2t_defineNewShapes), Opcode(o2t_setCurrentFrame), diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index 2dade32554..3bfd50438d 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -95,7 +95,7 @@ struct ActiveWSA { uint16 currentFrame; uint16 lastFrame; uint16 x; - uint16 y; + uint16 y; const SequenceControl *control; uint16 startupCommand; uint16 finalCommand; @@ -149,11 +149,11 @@ friend class TextDisplayer_v2; public: KyraEngine_v2(OSystem *system, const GameFlags &flags); ~KyraEngine_v2(); - + virtual Screen *screen() { return _screen; } Screen_v2 *screen_v2() { return _screen; } int language() const { return _lang; } - + virtual Movie *createWSAMovie(); protected: // Main menu code, also used for Kyra 3 @@ -165,7 +165,7 @@ protected: void gui_drawMainMenu(const char *const *strings, int select); void gui_drawMainBox(int x, int y, int w, int h, int fill); bool gui_mainMenuGetInput(); - + void gui_printString(const char *string, int x, int y, int col1, int col2, int flags, ...); // intro/outro @@ -174,7 +174,7 @@ protected: int seq_introWestwood(WSAMovieV2 *wsaObj, int x, int y, int frm); int seq_introTitle(WSAMovieV2 *wsaObj, int x, int y, int frm); int seq_introOverview(WSAMovieV2 *wsaObj, int x, int y, int frm); - int seq_introLibrary(WSAMovieV2 *wsaObj, int x, int y, int frm); + int seq_introLibrary(WSAMovieV2 *wsaObj, int x, int y, int frm); int seq_introHand(WSAMovieV2 *wsaObj, int x, int y, int frm); int seq_introPoint(WSAMovieV2 *wsaObj, int x, int y, int frm); int seq_introZanfaun(WSAMovieV2 *wsaObj, int x, int y, int frm); @@ -192,6 +192,18 @@ protected: int seq_introHand2(WSAMovieV2 *wsaObj, int x, int y, int frm); int seq_introHand3(WSAMovieV2 *wsaObj, int x, int y, int frm); + int seq_finaleFunters(WSAMovieV2 *wsaObj, int x, int y, int frm); + int seq_finaleFerb(WSAMovieV2 *wsaObj, int x, int y, int frm); + int seq_finaleFish(WSAMovieV2 *wsaObj, int x, int y, int frm); + int seq_finaleFheep(WSAMovieV2 *wsaObj, int x, int y, int frm); + int seq_finaleFarmer(WSAMovieV2 *wsaObj, int x, int y, int frm); + int seq_finaleFuards(WSAMovieV2 *wsaObj, int x, int y, int frm); + int seq_finaleFirates(WSAMovieV2 *wsaObj, int x, int y, int frm); + int seq_finaleFrash(WSAMovieV2 *wsaObj, int x, int y, int frm); + + void seq_finaleActorScreen(); + int seq_finaleFiggle(WSAMovieV2 *wsaObj, int x, int y, int frm); + void seq_sequenceCommand(int command); void seq_loadNestedSequence(int wsaNum, int seqNum); void seq_nestedSequenceFrame(int command, int wsaNum); @@ -202,7 +214,7 @@ protected: void seq_unloadWSA(int wsaNum); void seq_processWSAs(); void seq_cmpFadeFrame(const char *cmpFile); - + void seq_playTalkText(uint8 chatNum); void seq_resetAllTextEntries(); uint32 seq_activeTextsTimeLeft(); @@ -210,19 +222,25 @@ protected: int seq_setTextEntry(uint16 strIndex, uint16 posX, uint16 posY, int duration, uint16 width); void seq_processText(); char *seq_preprocessString(const char *str, int width); + void seq_printCreditsString(uint16 strIndex, int x, int y, uint8 * colorMap, uint8 textcolor); + void seq_playWsaSyncDialogue(uint16 strIndex, uint16 vocIndex, int textColor, int x, int y, int width, + WSAMovieV2 * wsa, int firstframe, int lastframe, int wsaXpos, int wsaYpos); void seq_init(); void seq_uninit(); int init(); int go(); - + Screen_v2 *_screen; TextDisplayer_v2 *_text; Debugger_v2 *_debugger; - + uint8 *_mouseSHPBuf; + + static const char *_dosSoundFileListIntro[]; + static const char *_dosSoundFileListFinale[]; static const char *_dosSoundFileList[]; static const int _dosSoundFileListSize; static const int8 _dosTrackMap[]; @@ -232,21 +250,21 @@ protected: static const int _introSoundListSize; static const char *_introStrings[]; static const int _introStringsSize; - + int _introStringsDuration[21]; - + protected: // game initialization void startup(); void runLoop(); void cleanup(); - + void setupTimers(); void setupOpcodeTable(); - + void loadMouseShapes(); void loadItemShapes(); - + // run void update(); void updateWithText(); @@ -254,7 +272,7 @@ protected: Functor0Mem<void, KyraEngine_v2> _updateFunctor; void updateMouse(); - + int checkInput(void *p); void removeInputTop(); void handleInput(int x, int y); @@ -267,7 +285,7 @@ protected: int _mouseX, _mouseY; Common::List<Common::Event> _eventList; - + // gfx/animation specific uint8 *_gamePlayBuffer; void restorePage3(); @@ -278,23 +296,23 @@ protected: void backUpGfxRect24x24(int x, int y); void restoreGfxRect24x24(int x, int y); - + uint8 *getShapePtr(int index) { return _defaultShapeTable[index]; } uint8 *_defaultShapeTable[250]; uint8 *_sceneShapeTable[50]; - + WSAMovieV2 *_wsaSlots[10]; - + void freeSceneShapePtrs(); - + struct ShapeDesc { uint8 unk0, unk1, unk2, unk3, unk4; uint16 width, height; int16 xAdd, yAdd; }; - + ShapeDesc *_shapeDescTable; - + struct SceneAnim { uint16 flags; int16 x, y; @@ -307,7 +325,7 @@ protected: uint16 wsaFlag; char filename[14]; }; - + SceneAnim _sceneAnims[10]; WSAMovieV2 *_sceneAnimMovie[10]; bool _specialSceneScriptState[10]; @@ -316,19 +334,19 @@ protected: uint32 _sceneSpecialScriptsTimer[10]; int _lastProcessedSceneScript; bool _specialSceneScriptRunFlag; - - void updateSpecialSceneScripts(); + + void updateSpecialSceneScripts(); void freeSceneAnims(); - + int _loadedZTable; void loadZShapes(int shapes); void loadInventoryShapes(); - + void resetScaleTable(); void setScaleTableItem(int item, int data); int getScale(int x, int y); uint16 _scaleTable[15]; - + void setDrawLayerTableEntry(int entry, int data); int getDrawLayer(int x, int y); int _drawLayerTable[15]; @@ -348,7 +366,7 @@ protected: int initNewShapes(uint8 *filedata); void processNewShapes(int unk1, int unk2); void resetNewShapes(int count, uint8 *filedata); - + // animator struct AnimObj { uint16 index; @@ -375,25 +393,25 @@ protected: int16 width2, height2; AnimObj *nextObject; }; - + AnimObj _animObjects[42]; void clearAnimObjects(); - + AnimObj *_animList; bool _drawNoShapeFlag; AnimObj *initAnimList(AnimObj *list, AnimObj *entry); AnimObj *addToAnimListSorted(AnimObj *list, AnimObj *entry); AnimObj *deleteAnimListEntry(AnimObj *list, AnimObj *entry); - + void drawAnimObjects(); void drawSceneAnimObject(AnimObj *obj, int x, int y, int drawLayer); void drawCharacterAnimObject(AnimObj *obj, int x, int y, int drawLayer); - + void refreshAnimObjects(int force); void refreshAnimObjectsIfNeed(); void flagAnimObjsForRefresh(); - + void updateCharFacing(); void updateCharacterAnim(int); void updateSceneAnim(int anim, int newFrame); @@ -404,7 +422,7 @@ protected: int _animObj0Width, _animObj0Height; void setCharacterAnimDim(int w, int h); void resetCharacterAnimDim(); - + // scene struct SceneDesc { char filename[10]; @@ -412,7 +430,7 @@ protected: uint8 flags; uint8 sound; }; - + SceneDesc *_sceneList; int _sceneListSize; uint16 _currentScene; @@ -426,7 +444,7 @@ protected: bool checkSpecialSceneExit(int num, int x, int y); uint8 _scenePal[688]; bool _overwriteSceneFacing; - + void enterNewScene(uint16 newScene, int facing, int unk1, int unk2, int unk3); void enterNewSceneUnk1(int facing, int unk1, int unk2); void enterNewSceneUnk2(int unk1); @@ -436,37 +454,37 @@ protected: void loadSceneMsc(); void fadeScenePal(int srcIndex, int delay); - + void startSceneScript(int unk1); void runSceneScript2(); void runSceneScript4(int unk1); void runSceneScript6(); void runSceneScript7(); - + void initSceneAnims(int unk1); void initSceneScreen(int unk1); - + int trySceneChange(int *moveTable, int unk1, int updateChar); int checkSceneChange(); - + // pathfinder int _movFacingTable[600]; int findWay(int curX, int curY, int dstX, int dstY, int *moveTable, int moveTableSize); bool lineIsPassable(int x, int y); bool directLinePassable(int x, int y, int toX, int toY); - + int pathfinderUnk1(int *moveTable); int pathfinderUnk2(int index, int v1, int v2); int pathfinderUnk3(int tableLen, int x, int y); int pathfinderUnk4(int index, int v); void pathfinderUnk5(int *moveTable, int unk1, int x, int y, int moveTableSize); - + int _pathfinderUnkTable1[400]; int _pathfinderUnkTable2[200]; - + // item uint8 _itemHtDat[176]; - + struct Item { uint16 id; uint16 sceneId; @@ -475,13 +493,13 @@ protected: uint16 unk7; }; Item *_itemList; - + int findFreeItem(); int countAllItems(); int findItem(uint16 sceneId, uint16 id); int checkItemCollision(int x, int y); void resetItemList(); - + int _itemInHand; int _handItemSet; @@ -503,11 +521,11 @@ protected: void setMouseCursor(uint16 item); void setHandItem(uint16 item); void removeHandItem(); - + // inventroy static const int _inventoryX[]; static const int _inventoryY[]; - + // localization void loadCCodeBuffer(const char *file); void loadOptionsBuffer(const char *file); @@ -518,7 +536,7 @@ protected: uint8 *_chapterBuffer; int _currentChapter; int _newChapterFile; - + const uint8 *getTableEntry(const uint8 *buffer, int id); const char *getTableString(int id, const uint8 *buffer, int decode); const char *getChapterString(int id); @@ -526,11 +544,11 @@ protected: void decodeString2(const char *src, char *dst); void changeFileExtension(char *buffer); - + char _internStringBuf[200]; static const char *_languageExtension[]; static const char *_scriptLangExt[]; - + // character struct Character { uint16 sceneId; @@ -545,33 +563,33 @@ protected: int16 x1, y1; int16 x2, y2; }; - + Character _mainCharacter; bool _useCharPal; int _charPalEntry; uint8 _charPalTable[16]; void updateCharPal(int unk1); void setCharPalEntry(int entry, int value); - + void moveCharacter(int facing, int x, int y); int updateCharPos(int *table); void updateCharPosWithUpdate(); void updateCharAnimFrame(int num, int *table); - + int checkCharCollision(int x, int y); int _mainCharX, _mainCharY; int _charScaleX, _charScaleY; static const int _characterFrameTable[]; - + // text void showMessageFromCCode(int id, int16 palIndex, int); void showMessage(const char *string, int16 palIndex); void showChapterMessage(int id, int16 palIndex); void updateCommandLineEx(int str1, int str2, int16 palIndex); - + const char *_shownMessage; byte _messagePal[3]; @@ -609,20 +627,20 @@ protected: void snd_loadSoundFile(int id); void playVoice(int high, int low); - + // timer void timerFunc2(int); void timerFunc3(int); void timerFunc4(int); void timerFunc5(int); void timerFunc6(int); - + void setTimer1DelaySecs(int secs); - + // delay void delay(uint32 millis, bool updateGame = false, bool isMainLoop = false); - // Talk object handling + // Talk object handling struct TalkObject { char filename[13]; int8 scriptId; @@ -640,7 +658,7 @@ protected: int16 AVTLOffset; int16 TEXTOffset; }; - + struct TIMStructUnk1 { uint16 unk_0; uint16 unk_2; @@ -648,21 +666,21 @@ protected: uint16 unk_8; uint16* unk_20; }; - + struct TIMBuffers { uint16 *AVTLChunk; byte *TEXTChunk; TIMStructUnk1 *UnkChunk; }; TIMBuffers _TIMBuffers; - + struct TalkSections { byte *STATim; byte *TLKTim; byte *ENDTim; }; TalkSections _currentTalkSections; - + bool _objectChatFinished; byte* loadTIMFile(const char *filename, byte *buffer, int32 bufferSize); void freeTIM(byte *buffer); @@ -744,28 +762,28 @@ protected: int o2t_setCurrentFrame(ScriptState *script); int o2t_playSoundEffect(ScriptState *script); int o2t_setShapeFlag(ScriptState *script); - + // script void runStartScript(int script, int unk1); void loadNPCScript(); - + bool _noScriptEnter; ScriptData _npcScriptData; - + ScriptData _sceneScriptData; ScriptState _sceneScriptState; - + ScriptData _temporaryScriptData; ScriptState _temporaryScriptState; bool _temporaryScriptExecBit; Common::Array<const Opcode*> _opcodesTemporary; void runTemporaryScript(const char *filename, int unk1, int unk2, int newShapes, int shapeUnload); - + // pathfinder int _pathfinderFlag; - + uint8 *_unkBuf500Bytes; uint8 *_unkBuf200kByte; bool _unkFlag1; @@ -779,16 +797,20 @@ protected: const char *const *_sequenceSoundList; int _sequenceSoundListSize; - - static const char *_sequenceSoundListPC[]; - static const int _sequenceSoundListPCSize; - static const char *_sequenceStrings[]; - static const int _sequenceStringsSize; - + const char *const *_sequenceStrings; + int _sequenceStringsSize; + + static const char *_sequenceSoundList_PC[]; + static const int _sequenceSoundListSize_PC; + static const char *_sequenceSoundList_TOWNS[]; + static const int _sequenceSoundListSize_TOWNS; + static const char *_sequenceStrings_TOWNS_EN[]; + static const int _sequenceStringsSize_TOWNS_EN; + static const char *_sequenceStrings_PC_EN[]; + static const int _sequenceStringsSize_PC_EN; + int _sequenceStringsDuration[33]; - uint8 *_pageBuffer1; - uint8 *_pageBuffer2; static const uint8 _seqTextColorPresets[]; char *_seqProcessedString; WSAMovieV2 *_seqWsa; @@ -799,10 +821,16 @@ protected: uint32 _seqFrameDelay; uint32 _seqEndTime; int _seqFrameCounter; + int _seqWsaCurrentFrame; + bool _seqSpecialFlag; bool _seqSubframePlaying; uint8 _seqTextColor[2]; - - static const Sequence _sequences[]; + uint8 _seqTextColorMap[16]; + + const Sequence *_sequences; + + static const Sequence _sequences_PC[]; + static const Sequence _sequences_TOWNS[]; static const NestedSequence _nSequences[]; static const SequenceControl _wsaControlLibrary[]; static const SequenceControl _wsaControlHand1b[]; diff --git a/engines/kyra/screen_v2.cpp b/engines/kyra/screen_v2.cpp index 6b9358e1b1..cf252d0738 100644 --- a/engines/kyra/screen_v2.cpp +++ b/engines/kyra/screen_v2.cpp @@ -742,4 +742,9 @@ bool Screen_v2::isMouseVisible() const { return _mouseLockCount == 0; } +void Screen_v2::setTextColorMap(const uint8 *cmap) { + debugC(9, kDebugLevelScreen, "Screen_v2::setTextColorMap(%p)", (const void *)cmap); + setTextColor(cmap, 0, 15); +} + } // end of namespace Kyra diff --git a/engines/kyra/screen_v2.h b/engines/kyra/screen_v2.h index 85ab59bc91..654ee6f99f 100644 --- a/engines/kyra/screen_v2.h +++ b/engines/kyra/screen_v2.h @@ -76,6 +76,9 @@ public: // mouse handling bool isMouseVisible() const; + + // text display + void setTextColorMap(const uint8 *cmap); private: KyraEngine_v2 *_vm; diff --git a/engines/kyra/sequences_v2.cpp b/engines/kyra/sequences_v2.cpp index 0fdb53c8dc..206342e2e8 100644 --- a/engines/kyra/sequences_v2.cpp +++ b/engines/kyra/sequences_v2.cpp @@ -42,15 +42,28 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) { if (endSeq == -1) endSeq = startSeq; - + assert(startSeq >= 0 && endSeq < kSequenceArraySize && startSeq <= endSeq); + if (_flags.isDemo) { + static const char *soundFileList[] = { + "K2_DEMO", + "LOLSYSEX" + }; + _sound->setSoundFileList(soundFileList, 2); + } else { + const char *const *soundFileList = + (startSeq > kSequenceZanfaun) ? _dosSoundFileListFinale : _dosSoundFileListIntro; + _sound->setSoundFileList(soundFileList, 1); + } + _sound->loadSoundFile(0); + _screen->_charWidth = -2; memset(_activeWSA, 0, sizeof(ActiveWSA) * 8); for (int i = 0; i < 8; i++) _activeWSA[i].flags = -1; - + memset(_activeText, 0, sizeof(ActiveText) * 10); seq_resetAllTextEntries(); @@ -61,24 +74,24 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) { for (int i = 0; i < 4; i++) memset(_screen->getPalette(i), 0, 0x300); - memset(_pageBuffer1, 0, 0xfa00); - memset(_pageBuffer2, 0, 0xfa00); + _screen->clearPage(10); + _screen->clearPage(12); _seqSubframePlaying = false; - - int seqWsaCurrentFrame = 0; - _seqTextColor[0] = _seqTextColor[1] = 0; + + _seqWsaCurrentFrame = 0; + _seqTextColor[0] = _seqTextColor[1] = 0; _seqEndTime = 0; _menuChoice = 0; for (int seqNum = startSeq; seqNum <= endSeq && !((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice); seqNum++) { _screen->clearPage(0); _screen->clearPage(8); - memcpy(_screen->getPalette(1), _screen->getPalette(0), 0x300); + memcpy(_screen->getPalette(1), _screen->getPalette(0), 0x300); _seqFrameCounter = 0; allowSkip = (seqNum == 2) ? false : true; - + if (_sequences[seqNum].flags & 2) { _screen->loadBitmap(_sequences[seqNum].cpsFile, 2, 2, _screen->getPalette(0)); } else { @@ -103,28 +116,28 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) { if (_sequences[seqNum].flags & 4) { int cp = _screen->setCurPage(2); Screen::FontId cf = _screen->setFont(Screen::FID_GOLDFONT_FNT); - int sX = (320 - _screen->getTextWidth(_sequenceStrings[_sequences[seqNum].stringIndex1])) / 2; + int sX = (320 - _screen->getTextWidth(_sequenceStrings[_sequences[seqNum].stringIndex1])) / 2; _screen->printText(_sequenceStrings[_sequences[seqNum].stringIndex1], sX, 100 - _screen->getFontHeight(), 1, 0); - sX = (320 - _screen->getTextWidth(_sequenceStrings[_sequences[seqNum].stringIndex2])) / 2; + sX = (320 - _screen->getTextWidth(_sequenceStrings[_sequences[seqNum].stringIndex2])) / 2; _screen->printText(_sequenceStrings[_sequences[seqNum].stringIndex2], sX, 100, 1, 0); _screen->setFont(cf); _screen->setCurPage(cp); } - _screen->copyRegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(2, 12); _screen->copyPage(0, 2); - _screen->copyRegionToBuffer(2, 0, 0, 320, 200, _pageBuffer1); - _screen->copyBlockToPage(2, 0, 0, 320, 200, _pageBuffer2); - + _screen->copyPage(2, 10); + _screen->copyPage(12, 2); + _screen->copyPage(2, 6); - + seq_sequenceCommand(_sequences[seqNum].startupCommand); - + if (!((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { _screen->copyPage(2, 0); _screen->updateScreen(); - } + } if (_sequences[seqNum].flags & 1) { int w2 = _seqWsa->width(); @@ -145,46 +158,46 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) { h2 = 0; } - if (_sequences[seqNum].xPos + _seqWsa->width() > 0x13F) - _seqWsa->setWidth(0x140 - _sequences[seqNum].xPos); + if (_sequences[seqNum].xPos + _seqWsa->width() > 319) + _seqWsa->setWidth(320 - _sequences[seqNum].xPos); - if (_sequences[seqNum].yPos + _seqWsa->height() > 0xC7) - _seqWsa->setHeight(0xC7 - _sequences[seqNum].yPos); + if (_sequences[seqNum].yPos + _seqWsa->height() > 199) + _seqWsa->setHeight(199 - _sequences[seqNum].yPos); } uint8 dir = (_sequences[seqNum].startFrame > _sequences[seqNum].numFrames) ? 0 : 1; - seqWsaCurrentFrame = _sequences[seqNum].startFrame; + _seqWsaCurrentFrame = _sequences[seqNum].startFrame; bool loop = true; while (loop && !((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { _seqEndTime = _system->getMillis() + _seqFrameDelay * _tickLength; if (_seqWsa || !_sequences[seqNum].callback) - _screen->copyBlockToPage(2, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(12, 2); if (_sequences[seqNum].callback) { - int f = seqWsaCurrentFrame % _seqWsa->frames(); + int f = _seqWsaCurrentFrame % _seqWsa->frames(); (this->*_sequences[seqNum].callback)(_seqWsa, _sequences[seqNum].xPos, _sequences[seqNum].yPos, f); } if (_seqWsa) { - int f = seqWsaCurrentFrame % _seqWsa->frames(); + int f = _seqWsaCurrentFrame % _seqWsa->frames(); _seqWsa->setX(_sequences[seqNum].xPos); _seqWsa->setY(_sequences[seqNum].yPos); _seqWsa->setDrawPage(2); _seqWsa->displayFrame(f, 0); } - _screen->copyRegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(2, 12); - seq_processWSAs(); + seq_processWSAs(); seq_processText(); - + if ((_seqWsa || !_sequences[seqNum].callback) && !((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { _screen->copyPage(2, 0); _screen->copyPage(2, 6); _screen->updateScreen(); } - + bool loop2 = true; while (loop2 && !((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { if (_seqWsa) { @@ -203,7 +216,7 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) { uint32 tdiff = _seqEndTime - now; uint32 dly = tdiff < _tickLength ? tdiff : _tickLength; delay(dly); - _seqEndTime -= dly; + //_seqEndTime -= dly; } } else { loop = loop2 = false; @@ -212,10 +225,10 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) { if (loop) { if (dir == 1) { - if (++seqWsaCurrentFrame >= _sequences[seqNum].numFrames) + if (++_seqWsaCurrentFrame >= _sequences[seqNum].numFrames) loop = false; } else { - if (--seqWsaCurrentFrame < _sequences[seqNum].numFrames) + if (--_seqWsaCurrentFrame < _sequences[seqNum].numFrames) loop = false; } } @@ -228,21 +241,21 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) { _seqEndTime = _system->getMillis() + _seqFrameDelay * _tickLength; while (!((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { uint32 starttime = _system->getMillis(); - seq_processWSAs(); + seq_processWSAs(); if (_sequences[seqNum].callback) (this->*_sequences[seqNum].callback)(0, 0, 0, 0); - + seq_processText(); - - _screen->copyPage(2, 6); + + _screen->copyPage(2, 6); _screen->copyPage(2, 0); _screen->updateScreen(); - _screen->copyBlockToPage(2, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(12, 2); uint32 now = _system->getMillis(); if (now >= _seqEndTime && !_seqSubframePlaying) break; - + uint32 tdiff = _seqEndTime - starttime; int32 dly = _tickLength - (now - starttime); if (dly > 0) @@ -258,25 +271,27 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) { if (dl < ct) dl = ct; _seqEndTime = _system->getMillis() + dl; - + while (!((_skipFlag && allowSkip) || _quitFlag || (_abortIntroFlag && allowSkip) || _menuChoice)) { uint32 starttime = _system->getMillis(); seq_processWSAs(); - _screen->copyPage(2, 6); + _screen->copyPage(2, 6); _screen->copyPage(2, 0); _screen->updateScreen(); - _screen->copyBlockToPage(2, 0, 0, 320, 200, _pageBuffer2); - + _screen->copyPage(12, 2); + uint32 now = _system->getMillis(); if (now >= _seqEndTime && !_seqSubframePlaying) { break; - } else { - uint32 tdiff = _seqEndTime - starttime; - delay(MIN<uint32>(tdiff, _tickLength)); } + + uint32 tdiff = _seqEndTime - starttime; + int32 dly = _tickLength - (now - starttime); + if (dly > 0) + delay(MIN<uint32>(dly, tdiff)); } - + seq_sequenceCommand(_sequences[seqNum].finalCommand); seq_resetAllTextEntries(); @@ -285,7 +300,7 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) { _abortIntroFlag = _skipFlag = false; seqNum = kSequenceWestwood; } - + if (_menuChoice) { _abortIntroFlag = _skipFlag = false; if (_menuChoice == 2) @@ -293,6 +308,9 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) { } } + if (!_menuChoice) + delay(1000); + _screen->setCurPage(oldPage); _screen->showMouse(); @@ -309,21 +327,23 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) { int KyraEngine_v2::seq_introWestwood(WSAMovieV2 *wsaObj, int x, int y, int frm) { debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introWestwood(%p, %i, %i, %i)", (const void*)wsaObj, x, y, frm); - - if (frm == -2) - delay(300 * _tickLength); - else if (!frm) + + if (frm == -2) { + if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) + delay(300 * _tickLength); + } else if (!frm) { _sound->playTrack(2); - + } + return 0; } int KyraEngine_v2::seq_introTitle(WSAMovieV2 *wsaObj, int x, int y, int frm) { debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introTitle(%p, %i, %i, %i)", (const void*)wsaObj, x, y, frm); - + if (frm == 1) { _sound->playTrack(3); - } else if (frm == 0x19) { + } else if (frm == 25) { int cp = _screen->setCurPage(0); _screen->showMouse(); _system->updateScreen(); @@ -342,10 +362,9 @@ int KyraEngine_v2::seq_introTitle(WSAMovieV2 *wsaObj, int x, int y, int frm) { int KyraEngine_v2::seq_introOverview(WSAMovieV2 *wsaObj, int x, int y, int frm) { debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introOverview(%p, %i, %i, %i)", (const void*)wsaObj, x, y, frm); - + uint8 * tmpPal = &(_screen->getPalette(3)[0x101]); memset(tmpPal, 0, 256); - uint8 txtColorMap[16]; uint32 endtime = 0, now = 0; switch (_seqFrameCounter) { @@ -353,13 +372,13 @@ int KyraEngine_v2::seq_introOverview(WSAMovieV2 *wsaObj, int x, int y, int frm) _seqSubframePlaying = true; _sound->playTrack(4); endtime = _system->getMillis() + 60 * _tickLength; - + _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; - memset(txtColorMap, _seqTextColor[1], 16); - txtColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; + memset(_seqTextColorMap, _seqTextColor[1], 16); + _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; + + _screen->setTextColorMap(_seqTextColorMap); - _screen->setTextColorMap(txtColorMap); - now = _system->getMillis(); if (endtime > now) delay(endtime - now); @@ -400,7 +419,7 @@ int KyraEngine_v2::seq_introOverview(WSAMovieV2 *wsaObj, int x, int y, int frm) _screen->setScreenPalette(_screen->getPalette(2)); _screen->updateScreen(); _screen->applyGrayOverlay(0, 0, 320, 200, 2, _screen->getPalette(3)); - _screen->copyRegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(2, 12); _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); _screen->setScreenPalette(_screen->getPalette(0)); _screen->updateScreen(); @@ -414,11 +433,19 @@ int KyraEngine_v2::seq_introOverview(WSAMovieV2 *wsaObj, int x, int y, int frm) break; case 354: + case 434: + if (!((_seqFrameCounter == 354 && !_flags.isTalkie) || (_seqFrameCounter == 434 && _flags.isTalkie))) + break; + seq_resetActiveWSA(0); seq_loadNestedSequence(0, kSequenceDragon); break; case 400: + case 540: + if (!((_seqFrameCounter == 400 && !_flags.isTalkie) || (_seqFrameCounter == 540 && _flags.isTalkie))) + break; + seq_waitForTextsTimeout(); seq_resetActiveWSA(0); _seqEndTime = 0; @@ -435,19 +462,18 @@ int KyraEngine_v2::seq_introOverview(WSAMovieV2 *wsaObj, int x, int y, int frm) int KyraEngine_v2::seq_introLibrary(WSAMovieV2 *wsaObj, int x, int y, int frm) { debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introLibrary(%p, %i, %i, %i)", (const void*)wsaObj, x, y, frm); - uint8 txtColorMap[16]; switch (_seqFrameCounter) { case 0: _seqSubframePlaying = true; _sound->playTrack(5); - + _screen->generateGrayOverlay(_screen->getPalette(0), _screen->getPalette(3), 0x24, 0, 0, 0, 0x100, false); _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; - memset(txtColorMap, _seqTextColor[1], 16); - txtColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; + memset(_seqTextColorMap, _seqTextColor[1], 16); + _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; - _screen->setTextColorMap(txtColorMap); + _screen->setTextColorMap(_seqTextColorMap); break; case 1: @@ -458,12 +484,12 @@ int KyraEngine_v2::seq_introLibrary(WSAMovieV2 *wsaObj, int x, int y, int frm) { case 100: seq_waitForTextsTimeout(); - _screen->copyBlockToPage(2, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(12, 2); _screen->applyGrayOverlay(0, 0, 320, 200, 2, _screen->getPalette(3)); _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); _screen->updateScreen(); - _screen->copyRegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2); - + _screen->copyPage(2, 12); + seq_resetActiveWSA(0); seq_loadNestedSequence(0, kSequenceDarm); @@ -482,7 +508,7 @@ int KyraEngine_v2::seq_introLibrary(WSAMovieV2 *wsaObj, int x, int y, int frm) { case 340: seq_resetActiveWSA(0); _screen->applyGrayOverlay(0, 0, 320, 200, 2, _screen->getPalette(3)); - _screen->copyRegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(2, 12); _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); _screen->updateScreen(); @@ -491,7 +517,11 @@ int KyraEngine_v2::seq_introLibrary(WSAMovieV2 *wsaObj, int x, int y, int frm) { break; case 480: - _screen->copyRegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2); + case 660: + if (!((_seqFrameCounter == 480 && !_flags.isTalkie) || (_seqFrameCounter == 660 && _flags.isTalkie))) + break; + + _screen->copyPage(2, 12); seq_waitForTextsTimeout(); seq_resetActiveWSA(0); _seqEndTime = 0; @@ -509,19 +539,18 @@ int KyraEngine_v2::seq_introLibrary(WSAMovieV2 *wsaObj, int x, int y, int frm) { int KyraEngine_v2::seq_introHand(WSAMovieV2 *wsaObj, int x, int y, int frm) { debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_introHand(%p, %i, %i, %i)", (const void*)wsaObj, x, y, frm); - uint8 txtColorMap[16]; switch (_seqFrameCounter) { case 0: _seqSubframePlaying = true; _sound->playTrack(6); - + _screen->generateGrayOverlay(_screen->getPalette(0), _screen->getPalette(3), 0x24, 0, 0, 0, 0x100, false); _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; - memset(txtColorMap, _seqTextColor[1], 16); - txtColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; + memset(_seqTextColorMap, _seqTextColor[1], 16); + _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; - _screen->setTextColorMap(txtColorMap); + _screen->setTextColorMap(_seqTextColorMap); break; case 1: @@ -534,7 +563,7 @@ int KyraEngine_v2::seq_introHand(WSAMovieV2 *wsaObj, int x, int y, int frm) { case 201: seq_waitForTextsTimeout(); _screen->applyGrayOverlay(0, 0, 320, 200, 2, _screen->getPalette(3)); - _screen->copyRegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(2, 12); _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); _screen->updateScreen(); seq_resetActiveWSA(0); @@ -545,6 +574,11 @@ int KyraEngine_v2::seq_introHand(WSAMovieV2 *wsaObj, int x, int y, int frm) { break; case 260: + case 395: + if (!((_seqFrameCounter == 260 && !_flags.isTalkie) || (_seqFrameCounter == 395 && _flags.isTalkie))) + break; + + seq_waitForTextsTimeout(); seq_resetActiveWSA(0); seq_loadNestedSequence(1, kSequenceHand3); @@ -552,16 +586,29 @@ int KyraEngine_v2::seq_introHand(WSAMovieV2 *wsaObj, int x, int y, int frm) { break; case 365: + case 500: + if (!((_seqFrameCounter == 365 && !_flags.isTalkie) || (_seqFrameCounter == 500 && _flags.isTalkie))) + break; + seq_waitForTextsTimeout(); seq_resetActiveWSA(1); seq_loadNestedSequence(0, kSequenceHand4); break; case 405: + case 540: + if (!((_seqFrameCounter == 405 && !_flags.isTalkie) || (_seqFrameCounter == 540 && _flags.isTalkie))) + break; + + seq_playTalkText(10); break; case 484: + case 630: + if (!((_seqFrameCounter == 484 && !_flags.isTalkie) || (_seqFrameCounter == 630 && _flags.isTalkie))) + break; + seq_waitForTextsTimeout(); seq_resetActiveWSA(0); _seqEndTime = 0; @@ -582,20 +629,18 @@ int KyraEngine_v2::seq_introPoint(WSAMovieV2 *wsaObj, int x, int y, int frm) { _seqEndTime = 0; } - uint8 txtColorMap[16]; - switch (_seqFrameCounter) { case -2: seq_waitForTextsTimeout(); break; case 0: - _sound->playTrack(7); - + _sound->playTrack(7); + _seqTextColor[1] = 0xf7; - memset(txtColorMap, _seqTextColor[1], 16); - txtColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; - _screen->setTextColorMap(txtColorMap); + memset(_seqTextColorMap, _seqTextColor[1], 16); + _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; + _screen->setTextColorMap(_seqTextColorMap); _screen->generateGrayOverlay(_screen->getPalette(0), _screen->getPalette(3), 0x24, 0, 0, 0, 0x100, false); break; @@ -618,45 +663,63 @@ int KyraEngine_v2::seq_introZanfaun(WSAMovieV2 *wsaObj, int x, int y, int frm) { return 0; } - uint8 txtColorMap[16]; - switch (_seqFrameCounter) { case 0: - _sound->playTrack(8); - + _sound->playTrack(8); + _seqTextColor[1] = 0xfd; - memset(txtColorMap, _seqTextColor[1], 16); - txtColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; - _screen->setTextColorMap(txtColorMap); + memset(_seqTextColorMap, _seqTextColor[1], 16); + _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff; + _screen->setTextColorMap(_seqTextColorMap); break; case 1: - seq_setTextEntry(21, 140, 70, 20, 160); - if (_flags.isTalkie) - _sound->voicePlay(_sequenceSoundList[13]); - _seqFrameDelay = 200; + if (_flags.isTalkie) { + seq_playWsaSyncDialogue(21, 13, -1, 140, 70, 160, wsaObj, 0, 8, x, y); + } else { + seq_setTextEntry(21, 140, 70, 20, 160); + _seqFrameDelay = 200; + } break; case 2: case 11: case 21: - _seqFrameDelay = 12; + if (!_flags.isTalkie) + _seqFrameDelay = 12; + break; + + case 9: + if (_flags.isTalkie) + seq_playWsaSyncDialogue(13, 14, -1, 140, (_flags.lang == Common::FR_FRA + || _flags.lang == Common::DE_DEU) ? 50 : 70, 160, wsaObj, 9, 15, x, y); break; case 10: - seq_waitForTextsTimeout(); - seq_setTextEntry(13, 140, 50, _sequenceStringsDuration[13], 160); + if (!_flags.isTalkie) { + seq_waitForTextsTimeout(); + seq_setTextEntry(13, 140, 50, _sequenceStringsDuration[13], 160); + _seqFrameDelay = 300; + } + break; + + case 16: if (_flags.isTalkie) - _sound->voicePlay(_sequenceSoundList[14]); - _seqFrameDelay = 300; + seq_playWsaSyncDialogue(18, 15, -1, 140, (_flags.lang == Common::FR_FRA) ? 50 : + (_flags.lang == Common::DE_DEU ? 40 : 70), 160, wsaObj, 10, 16, x, y); break; - case 20: - seq_setTextEntry(18, 160, 50, _sequenceStringsDuration[17], 160); + case 17: if (_flags.isTalkie) - _sound->voicePlay(_sequenceSoundList[15]); - _seqFrameDelay = 200; - break; + _seqFrameDelay = 12; + break; + + case 20: + if (!_flags.isTalkie) { + seq_setTextEntry(18, 160, 50, _sequenceStringsDuration[17], 160); + _seqFrameDelay = 200; + } + break; case 19: case 26: @@ -664,17 +727,20 @@ int KyraEngine_v2::seq_introZanfaun(WSAMovieV2 *wsaObj, int x, int y, int frm) { break; case 46: - seq_waitForTextsTimeout(); - seq_setTextEntry(16, 200, 50, _sequenceStringsDuration[16], 120); - if (_flags.isTalkie) - _sound->voicePlay(_sequenceSoundList[16]); + if (_flags.isTalkie) { + seq_playWsaSyncDialogue(16, 16, -1, 200, 50, 120, wsaObj, 46, 46, x, y); + } else { + seq_waitForTextsTimeout(); + seq_setTextEntry(16, 200, 50, _sequenceStringsDuration[16], 120); + } + _seqEndTime = _system->getMillis() + 120 * _tickLength; break; default: break; - } - + } + _seqFrameCounter++; return 0; } @@ -695,10 +761,13 @@ int KyraEngine_v2::seq_introOver2(WSAMovieV2 *wsaObj, int x, int y, int frm) { } int KyraEngine_v2::seq_introForest(WSAMovieV2 *wsaObj, int x, int y, int frm) { - if (frm == 11) + if (frm == 11) { seq_waitForTextsTimeout(); - else if (frm == 12) + } else if (frm == 12) { + if (_flags.lang == Common::FR_FRA) + {}//// TODO seq_playTalkText(2); + } return frm; } @@ -755,6 +824,747 @@ int KyraEngine_v2::seq_introHand3(WSAMovieV2 *wsaObj, int x, int y, int frm) { return frm; } +int KyraEngine_v2::seq_finaleFunters(WSAMovieV2 *wsaObj, int x, int y, int frm) { + uint32 endtime = 0; + int chatX = 0; + int chatY = 0; + int chatW = 0; + int chatFirstFrame = 0; + int chatLastFrame = 0; + uint16 voiceIndex = 0; + + switch (frm) { + case -2: + seq_sequenceCommand(9); + break; + + case 0: + _sound->playTrack(3); + + _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; + memset(_seqTextColorMap, _seqTextColor[1], 16); + _seqTextColor[0] = _seqTextColorMap[1] = 0xff; + _screen->setTextColorMap(_seqTextColorMap); + + endtime = _system->getMillis() + 480 * _tickLength; + seq_printCreditsString(81, 240, 70, _seqTextColorMap, 252); + seq_printCreditsString(82, 240, 90, _seqTextColorMap, _seqTextColor[0]); + _screen->copyPage(2, 12); + delay(endtime - _system->getMillis()); + seq_playTalkText(_flags.isTalkie ? 28 : 24); + _seqTextColor[0] = 1; + + if (_flags.isTalkie) { + if (_flags.lang == Common::FR_FRA) { + chatX = 84; + chatY = 70; + } else { + chatX = 88; + chatY = 78; + } + chatFirstFrame = 9; + chatLastFrame = 15; + voiceIndex = 34; + } else { + chatX = 88; + chatY = 70; + chatFirstFrame = 0; + chatLastFrame = 8; + } + chatW = 100; + + seq_playWsaSyncDialogue(22, voiceIndex, 187, chatX, chatY, chatW, wsaObj, chatFirstFrame, chatLastFrame, x, y); + break; + + case 9: + case 16: + if (!((frm == 9 && !_flags.isTalkie) || (frm == 16 && _flags.isTalkie))) + break; + + _seqFrameDelay = 12; + + if (_flags.isTalkie) { + if (_flags.lang == Common::FR_FRA) { + chatW = 112; + chatX = 80; + } else { + chatW = 100; + chatX = (_flags.lang == Common::DE_DEU) ? 84 : 96; + } + chatFirstFrame = 0; + chatLastFrame = 8; + voiceIndex = 35; + } else { + chatX = 96; + chatW = 100; + chatFirstFrame = 9; + chatLastFrame = 15; + } + chatY = 70; + + seq_playWsaSyncDialogue(23, voiceIndex, 137, chatX, chatY, chatW, wsaObj, chatFirstFrame, chatLastFrame, x, y); + if (_flags.isTalkie) + _seqWsaCurrentFrame = 17; + + break; + + default: + break; + } + + _seqFrameCounter++; + return 0; +} + +int KyraEngine_v2::seq_finaleFerb(WSAMovieV2 *wsaObj, int x, int y, int frm) { + uint32 endtime = 0; + int chatX = 0; + int chatY = 0; + int chatW = 0; + int chatFirstFrame = 0; + int chatLastFrame = 0; + uint16 voiceIndex = 0; + + switch (frm) { + case -2: + seq_sequenceCommand(9); + endtime = _system->getMillis() + 480 * _tickLength; + seq_printCreditsString(34, 240, _flags.isTalkie ? 60 : 40, _seqTextColorMap, 252); + seq_printCreditsString(35, 240, _flags.isTalkie ? 70 : 50, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(36, 240, _flags.isTalkie ? 90 : 70, _seqTextColorMap, 252); + seq_printCreditsString(37, 240, _flags.isTalkie ? 100 : 90, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(38, 240, _flags.isTalkie ? 120 : 110, _seqTextColorMap, 252); + seq_printCreditsString(39, 240, _flags.isTalkie ? 130 : 120, _seqTextColorMap, _seqTextColor[0]); + if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) + seq_printCreditsString(103, 240, 130, _seqTextColorMap, _seqTextColor[0]); + delay(endtime - _system->getMillis()); + _seqEndTime = 0; + break; + + case 0: + _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; + memset(_seqTextColorMap, _seqTextColor[1], 16); + _seqTextColor[0] = _seqTextColorMap[1] = 255; + _screen->setTextColorMap(_seqTextColorMap); + + break; + + case 5: + if (!_flags.isTalkie) + seq_playTalkText(18); + _seqFrameDelay = 16; + + if (_flags.isTalkie) { + chatFirstFrame = 5; + chatLastFrame = 8; + voiceIndex = 22; + } else { + chatLastFrame = 14; + } + chatX = 116; + chatY = 90; + chatW = 60; + + seq_playWsaSyncDialogue(24, voiceIndex, 149, chatX, chatY, chatW, wsaObj, chatFirstFrame, chatLastFrame, x, y); + break; + + case 11: + if (_flags.isTalkie) + seq_playWsaSyncDialogue(24, 22, 149, 116, 90, 60, wsaObj, 11, 14, x, y); + + break; + + case 16: + seq_playTalkText(_flags.isTalkie ? 23 : 19); + _seqFrameDelay = _flags.isTalkie ? 20 : 16; + + if (_flags.isTalkie) { + if (_flags.lang == Common::FR_FRA) { + chatY = 48; + chatW = 88; + } else { + chatY = 60; + chatW = 100; + } + voiceIndex = 36; + } else { + chatY = 60; + chatW = 100; + } + chatX = 60; + + seq_playWsaSyncDialogue(25, voiceIndex, 143, chatX, chatY, chatW, wsaObj, 16, 25, x, y); + _seqFrameDelay = 16; + break; + + default: + break; + } + + _seqFrameCounter++; + return 0; +} + +int KyraEngine_v2::seq_finaleFish(WSAMovieV2 *wsaObj, int x, int y, int frm) { + uint32 endtime = 0; + int chatX = 0; + int chatY = 0; + int chatW = 0; + uint16 voiceIndex = 0; + + switch (frm) { + case -2: + seq_sequenceCommand(9); + endtime = _system->getMillis() + 480 * _tickLength; + + seq_printCreditsString(40, 240, _flags.isTalkie ? 55 : 40, _seqTextColorMap, 252); + seq_printCreditsString(41, 240, _flags.isTalkie ? 65 : 50, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(42, 240, _flags.isTalkie ? 75 : 60, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(43, 240, _flags.isTalkie ? 95 : 80, _seqTextColorMap, 252); + seq_printCreditsString(44, 240, _flags.isTalkie ? 105 : 90, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(93, 240, _flags.isTalkie ? 125 : 110, _seqTextColorMap, 252); + seq_printCreditsString(94, 240, _flags.isTalkie ? 135 : 120, _seqTextColorMap, _seqTextColor[0]); + delay(endtime - _system->getMillis()); + _seqEndTime = 0; + break; + + case 0: + _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; + memset(_seqTextColorMap, _seqTextColor[1], 16); + _seqTextColor[0] = _seqTextColorMap[1] = 0xff; + _screen->setTextColorMap(_seqTextColorMap); + break; + + case 4: + chatX = 94; + chatY = 42; + chatW = 100; + if (_flags.isTalkie) + voiceIndex = 37; + seq_playWsaSyncDialogue(26, voiceIndex, 149, chatX, chatY, chatW, wsaObj, 3, 12, x, y); + break; + + case 14: + seq_playTalkText(_flags.isTalkie ? 19 : 15); + break; + + case 23: + seq_playTalkText(_flags.isTalkie ? 20 : 16); + break; + + case 29: + if (_flags.isTalkie) { + if (_flags.lang == Common::DE_DEU) { + chatX = 82; + chatY = 35; + } else { + chatX = (_flags.lang == Common::FR_FRA) ? 92 : 88; + chatY = 40; + } + voiceIndex = 38; + } else { + chatX = 88; + chatY = 40; + } + chatW = 100; + + seq_playWsaSyncDialogue(27, voiceIndex, 187, chatX, chatY, chatW, wsaObj, 28, 34, x, y); + break; + + case 45: + seq_playTalkText(_flags.isTalkie ? 21 : 17); + break; + + case 50: + seq_playTalkText(_flags.isTalkie ? 29 : 25); + break; + + default: + break; + } + + _seqFrameCounter++; + return 0; +} + +int KyraEngine_v2::seq_finaleFheep(WSAMovieV2 *wsaObj, int x, int y, int frm) { + uint32 endtime = 0; + int chatX = 0; + int chatY = 0; + int chatW = 0; + int chatFirstFrame = 0; + int chatLastFrame = 0; + uint16 voiceIndex = 0; + + switch (frm) { + case -2: + _screen->copyPage(12, 2); + _screen->copyPage(2, 0); + _screen->updateScreen(); + seq_sequenceCommand(9); + endtime = _system->getMillis() + 480 * _tickLength; + seq_printCreditsString(49, 240, 20, _seqTextColorMap, 252); + seq_printCreditsString(50, 240, 30, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(51, 240, 40, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(52, 240, 50, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(53, 240, 60, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(54, 240, 70, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(55, 240, 80, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(56, 240, 90, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(57, 240, 100, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(58, 240, 110, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(60, 240, 120, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(61, 240, 130, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(62, 240, 140, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(63, 240, 150, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(64, 240, 160, _seqTextColorMap, _seqTextColor[0]); + + delay(endtime - _system->getMillis()); + _seqEndTime = 0; + break; + + case 0: + _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; + memset(_seqTextColorMap, _seqTextColor[1], 16); + _seqTextColor[0] = _seqTextColorMap[1] = 0xff; + _screen->setTextColorMap(_seqTextColorMap); + break; + + case 2: + seq_playTalkText(_flags.isTalkie ? 25 : 21); + + if (_flags.isTalkie) { + if (_flags.lang == Common::FR_FRA) { + chatX = 92; + chatY = 72; + } else { + chatX = (_flags.lang == Common::DE_DEU) ? 90 : 98; + chatY = 84; + } + chatFirstFrame = 8; + chatLastFrame = 9; + voiceIndex = 39; + } else { + chatX = 98; + chatY = 84; + chatFirstFrame = 2; + chatLastFrame = -8; + } + chatW = 100; + + seq_playWsaSyncDialogue(28, voiceIndex, -1, chatX, chatY, chatW, wsaObj, chatFirstFrame, chatLastFrame, x, y); + if (_flags.isTalkie) + _seqWsaCurrentFrame = 4; + break; + + case 9: + seq_playTalkText(_flags.isTalkie ? 24 : 20); + _seqFrameDelay = 100; + break; + + default: + break; + } + + _seqFrameCounter++; + return 0; +} + +int KyraEngine_v2::seq_finaleFarmer(WSAMovieV2 *wsaObj, int x, int y, int frm) { + uint32 endtime = 0; + int chatX = 0; + int chatY = 0; + int chatW = 0; + uint16 voiceIndex = 0; + + switch (frm) { + case -2: + _screen->copyPage(12, 2); + _screen->copyPage(2, 0); + _screen->updateScreen(); + seq_sequenceCommand(9); + endtime = _system->getMillis() + 480 * _tickLength; + seq_printCreditsString(45, 240, 40, _seqTextColorMap, 252); + seq_printCreditsString(46, 240, 50, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(47, 240, 60, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(83, 240, 80, _seqTextColorMap, 252); + seq_printCreditsString(48, 240, 90, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(65, 240, 110, _seqTextColorMap, 252); + seq_printCreditsString(66, 240, 120, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(67, 240, 130, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(68, 240, 140, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(69, 240, 150, _seqTextColorMap, _seqTextColor[0]); + if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) + seq_printCreditsString(104, 240, 160, _seqTextColorMap, _seqTextColor[0]); + delay(endtime - _system->getMillis()); + _seqEndTime = 0; + break; + + case 0: + _seqTextColor[1] = 1 + (_screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 254) & 0xff); + memset(_seqTextColorMap, _seqTextColor[1], 16); + _seqTextColorMap[1] = _seqTextColor[0] = 1 + (_screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 254) & 0xff); + _screen->setTextColorMap(_seqTextColorMap); + seq_playTalkText(_flags.isTalkie ? 30 : 26); + break; + + case 6: + if (_flags.isTalkie) + seq_playTalkText(18); + break; + + case 12: + if (!_flags.isTalkie) + seq_playTalkText(14); + + if (_flags.isTalkie) { + if (_flags.lang == Common::FR_FRA || _flags.lang == Common::DE_DEU) { + chatX = 75; + chatY = 25; + } else { + chatX = 90; + chatY = 30; + } + voiceIndex = 40; + } else { + chatX = 90; + chatY = 30; + } + chatW = 100; + + seq_playWsaSyncDialogue(29, voiceIndex, 150, chatX, chatY, chatW, wsaObj, 12, -21, x, y); + + break; + + default: + break; + } + + _seqFrameCounter++; + return 0; +} + +int KyraEngine_v2::seq_finaleFuards(WSAMovieV2 *wsaObj, int x, int y, int frm) { + uint32 endtime = 0; + int chatX = 0; + int chatY = 0; + int chatW = 0; + int chatFirstFrame = 0; + int chatLastFrame = 0; + int textCol = 0; + + uint16 voiceIndex = 0; + + switch (frm) { + case -2: + seq_sequenceCommand(9); + endtime = _system->getMillis() + 480 * _tickLength; + seq_printCreditsString(70, 240, 20, _seqTextColorMap, 252); + seq_printCreditsString(71, 240, 30, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(72, 240, 40, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(73, 240, 50, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(74, 240, 60, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(75, 240, 70, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(101, 240, 80, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(102, 240, 90, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(87, 240, 100, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(88, 240, 110, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(89, 240, 120, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(90, 240, 130, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(91, 240, 140, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(92, 240, 150, _seqTextColorMap, _seqTextColor[0]); + delay(endtime - _system->getMillis()); + _seqEndTime = 0; + break; + + case 0: + for (int i = 0; i < 0x300; i++) + _screen->getPalette(0)[i] &= 0x3f; + _seqTextColor[1] = 0xCf; + memset(_seqTextColorMap, _seqTextColor[1], 16); + _seqTextColor[0] = _seqTextColorMap[1] = 0xfe; + + _screen->setTextColorMap(_seqTextColorMap); + break; + + case 6: + _seqFrameDelay = 20; + + if (_flags.isTalkie) { + chatX = 82; + chatY = (_flags.lang == Common::FR_FRA || _flags.lang == Common::DE_DEU) ? 88 :100; + textCol = 143; + chatFirstFrame = 16; + chatLastFrame = 21; + voiceIndex = 41; + } else { + chatX = 62; + chatY = 100; + textCol = 137; + chatFirstFrame = 9; + chatLastFrame = 13; + } + chatW = 80; + + seq_playWsaSyncDialogue(30, voiceIndex, 137, chatX, chatY, chatW, wsaObj, chatFirstFrame, chatLastFrame, x, y); + if (_flags.isTalkie) + _seqWsaCurrentFrame = 8; + break; + + case 9: + case 16: + if (_flags.isTalkie) { + if (frm == 16) + break; + chatX = 64; + textCol = 137; + chatFirstFrame = 9; + chatLastFrame = 13; + voiceIndex = 42; + } else { + if (frm == 9) + break; + chatX = 80; + textCol = 143; + chatFirstFrame = 16; + chatLastFrame = 21; + } + chatY = 100; + chatW = 100; + + seq_playWsaSyncDialogue(31, voiceIndex, 143, chatX, chatY, chatW, wsaObj, chatFirstFrame, chatLastFrame, x, y); + if (_flags.isTalkie) + _seqWsaCurrentFrame = 21; + break; + + default: + break; + } + + _seqFrameCounter++; + return 0; +} + +int KyraEngine_v2::seq_finaleFirates(WSAMovieV2 *wsaObj, int x, int y, int frm) { + uint32 endtime = 0; + int chatX = 0; + int chatY = 0; + int chatW = 0; + uint16 voiceIndex = 0; + + switch (frm) { + case -2: + _screen->copyPage(12, 2); + _screen->copyPage(2, 0); + _screen->updateScreen(); + seq_sequenceCommand(9); + endtime = _system->getMillis() + 480 * _tickLength; + seq_printCreditsString(76, 240, 40, _seqTextColorMap, 252); + seq_printCreditsString(77, 240, 50, _seqTextColorMap, 252); + seq_printCreditsString(78, 240, 60, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(79, 240, 70, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(80, 240, 80, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(84, 240, 100, _seqTextColorMap, 252); + seq_printCreditsString(85, 240, 110, _seqTextColorMap, _seqTextColor[0]); + seq_printCreditsString(99, 240, 130, _seqTextColorMap, 252); + seq_printCreditsString(100, 240, 140, _seqTextColorMap, _seqTextColor[0]); + delay(endtime - _system->getMillis()); + _seqEndTime = 0; + break; + + case 0: + _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; + memset(_seqTextColorMap, _seqTextColor[1], 16); + _seqTextColor[0] = _seqTextColorMap[1] = 0xff; + _screen->setTextColorMap(_seqTextColorMap); + break; + + case 6: + seq_playTalkText(_flags.isTalkie ? 31 : 27); + break; + + case 14: + case 15: + if (!((frm == 15 && !_flags.isTalkie) || (frm == 14 && _flags.isTalkie))) + break; + + seq_playTalkText(_flags.isTalkie ? 31 : 27); + + if (_flags.isTalkie) { + if (_flags.lang == Common::DE_DEU) { + chatX = 82; + chatY = 84; + chatW = 140; + } else { + chatX = 74; + chatY = (_flags.lang == Common::FR_FRA) ? 96: 108; + chatW = 80; + } + voiceIndex = 43; + } else { + chatX = 74; + chatY = 108; + chatW = 80; + } + + seq_playWsaSyncDialogue(32, voiceIndex, 137, chatX, chatY, chatW, wsaObj, 14, 16, x, y); + break; + + case 28: + seq_playTalkText(_flags.isTalkie ? 32 : 28); + break; + + case 29: + seq_playTalkText(_flags.isTalkie ? 33 : 29); + break; + + case 31: + if (_flags.isTalkie) { + chatY = (_flags.lang == Common::DE_DEU) ? 60 : 76; + voiceIndex = 44; + } else { + chatY = 76; + } + chatX = 90; + chatW = 80; + + seq_playWsaSyncDialogue(33, voiceIndex, 143, chatX, chatY, chatW, wsaObj, 31, 34, x, y); + break; + + case 35: + _seqFrameDelay = 300; + break; + + default: + break; + } + + _seqFrameCounter++; + return 0; +} + +int KyraEngine_v2::seq_finaleFrash(WSAMovieV2 *wsaObj, int x, int y, int frm) { + //uint32 endtime = 0; + int tmp = 0; + + switch (frm) { + case -2: + _screen->setCurPage(2); + _screen->clearCurPage(); + _screen->copyPage(2, 12); + _screen->copyPage(2, 0); + _screen->updateScreen(); + _seqFrameCounter = 0; + seq_loadNestedSequence(0, kSequenceFiggle); + break; + + case -1: + // if (_flags.isTalkie) + // seq_finaleActorScreen(); + _seqSpecialFlag = true; + break; + + case 0: + if (_seqFrameCounter == 1) { + _sound->playTrack(4); + _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff; + memset(_seqTextColorMap, _seqTextColor[1], 16); + _seqTextColor[0] = _seqTextColorMap[1] = 0xff; + _screen->setTextColorMap(_seqTextColorMap); + } + _seqFrameDelay = 10; + break; + + case 1: + if (_seqFrameCounter < 20 && _seqSpecialFlag) { + _seqWsaCurrentFrame = 0; + } else { + _seqFrameDelay = 500; + seq_playTalkText(_flags.isTalkie ? 26 : 22); + if (_seqSpecialFlag) { + _seqFrameCounter = 3; + _seqSpecialFlag = false; + } + } + break; + + case 2: + _seqFrameDelay = 20; + break; + + case 3: + seq_playTalkText(_flags.isTalkie ? 27 : 23); + _seqFrameDelay = 500; + break; + + case 4: + _seqFrameDelay = 10; + break; + + case 5: + seq_playTalkText(_flags.isTalkie ? 27 : 23); + tmp = _seqFrameCounter / 6; + if (tmp == 2) + _seqFrameDelay = 7; + else if (tmp < 2) + _seqFrameDelay = 500; + break; + + case 6: + _seqFrameDelay = 10; + tmp = _seqFrameCounter / 6; + if (tmp == 2) + _seqWsaCurrentFrame = 4; + else if (tmp < 2) + _seqWsaCurrentFrame = 0; + break; + + case 7: + _seqFrameCounter = 0; + _seqFrameDelay = 5; + seq_playTalkText(_flags.isTalkie ? 26 : 22); + break; + + case 11: + if (_seqFrameCounter < 8) + _seqWsaCurrentFrame = 8; + break; + + default: + break; + } + + _seqFrameCounter++; + return 0; +} + +void KyraEngine_v2::seq_finaleActorScreen() { + _screen->loadBitmap("finale.cps", 3, 3, _screen->_currentPalette); + _screen->setFont(Screen::FID_GOLDFONT_FNT); + + _sound->setSoundFileList(_dosSoundFileList, _dosSoundFileListSize); + _sound->loadSoundFile(3); + _sound->playTrack(3); + + static const uint8 colormap[] = {0, 0, 102, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + _screen->setTextColorMap(colormap); + + // TODO + + _sound->setSoundFileList(_dosSoundFileListFinale, 1); + _sound->loadSoundFile(0); +} + +int KyraEngine_v2::seq_finaleFiggle(WSAMovieV2 *wsaObj, int x, int y, int frm) { + if (_seqFrameCounter == 10) + _seqEndTime = 0; + if (_seqFrameCounter == 10 || _seqFrameCounter == 5 || _seqFrameCounter == 7) + seq_playTalkText(_flags.isTalkie ? 45 : 30); + + _seqFrameCounter++; + return frm; +} + uint32 KyraEngine_v2::seq_activeTextsTimeLeft() { uint32 res = 0; @@ -820,7 +1630,7 @@ char *KyraEngine_v2::seq_preprocessString(const char *srcStr, int width) { char *dstStr = _seqProcessedString; int lineStart = 0; int linePos = 0; - + while (*srcStr) { while (*srcStr && *srcStr != 0x20) // Space dstStr[lineStart + linePos++] = *srcStr++; @@ -828,7 +1638,7 @@ char *KyraEngine_v2::seq_preprocessString(const char *srcStr, int width) { int len = _screen->getTextWidth(&dstStr[lineStart]); if (width >= len && *srcStr) { - dstStr[lineStart + linePos++] = *srcStr++; + dstStr[lineStart + linePos++] = *srcStr++; } else { dstStr[lineStart + linePos] = 0x0d; // Carriage return lineStart += linePos + 1; @@ -838,16 +1648,16 @@ char *KyraEngine_v2::seq_preprocessString(const char *srcStr, int width) { } } dstStr[lineStart + linePos] = 0; - + return strlen(_seqProcessedString) ? dstStr : 0; } void KyraEngine_v2::seq_sequenceCommand(int command) { uint8 pal[768]; - + for (int i = 0; i < 8; i++) seq_resetActiveWSA(i); - + switch (command) { case 0: memset(pal, 0, 0x300); @@ -881,7 +1691,7 @@ void KyraEngine_v2::seq_sequenceCommand(int command) { case 5: _screen->copyPage(2, 0); break; - + case 6: // UNUSED // seq_loadBLD("library.bld"); @@ -891,7 +1701,7 @@ void KyraEngine_v2::seq_sequenceCommand(int command) { // UNUSED // seq_loadBLD("marco.bld"); break; - + case 8: memset(pal, 0, 0x300); _screen->fadePalette(pal, 16); @@ -900,7 +1710,7 @@ void KyraEngine_v2::seq_sequenceCommand(int command) { delay(120 * _tickLength); break; - + case 9: for (int i = 0; i < 0x100; i++) { int pv = (_screen->getPalette(0)[3 * i] + _screen->getPalette(0)[3 * i + 1] + _screen->getPalette(0)[3 * i + 2]) / 3; @@ -922,11 +1732,11 @@ void KyraEngine_v2::seq_sequenceCommand(int command) { } void KyraEngine_v2::seq_cmpFadeFrame(const char * cmpFile) { - _screen->copyBlockToPage(2, 0, 0, 320, 200, _pageBuffer1); - _screen->copyRegionToBuffer(4, 0, 0, 320, 200, _pageBuffer1); + _screen->copyPage(10, 2); + _screen->copyPage(4, 10); _screen->clearPage(6); _screen->loadBitmap(cmpFile, 6, 6, 0); - _screen->copyBlockToPage(4, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(12, 4); for (int i = 0; i < 3; i++) { uint32 endtime = _system->getMillis() + 4 * _tickLength; @@ -940,12 +1750,12 @@ void KyraEngine_v2::seq_cmpFadeFrame(const char * cmpFile) { _screen->updateScreen(); _screen->copyPage(4, 2); _screen->copyPage(4, 6); - _screen->copyBlockToPage(4, 0, 0, 320, 200, _pageBuffer1); + _screen->copyPage(10, 4); } void KyraEngine_v2::seq_playTalkText(uint8 chatNum) { debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_playIntroChat(%i)", chatNum); - + assert(chatNum < _sequenceSoundListSize); if (chatNum < 12) @@ -956,7 +1766,7 @@ void KyraEngine_v2::seq_playTalkText(uint8 chatNum) { void KyraEngine_v2::seq_waitForTextsTimeout() { debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_waitForTextsTimeout()"); - + uint32 longest = seq_activeTextsTimeLeft() + _system->getMillis(); uint32 now = _system->getMillis(); if (longest > now) @@ -973,7 +1783,7 @@ void KyraEngine_v2::seq_resetAllTextEntries() { int KyraEngine_v2::seq_setTextEntry(uint16 strIndex, uint16 posX, uint16 posY, int duration, uint16 width) { debugC(9, kDebugLevelMain, "KyraEngine_v2::seq_setTextEntry(%i, %i, %i, %i, %i)", strIndex, posX, posY, duration, width); - + for (int i = 0; i < 10; i++) { if (_activeText[i].duration != -1) { if (i < 9) @@ -988,7 +1798,7 @@ int KyraEngine_v2::seq_setTextEntry(uint16 strIndex, uint16 posX, uint16 posY, i _activeText[i].duration = duration * _tickLength; _activeText[i].width = width; _activeText[i].startTime = _system->getMillis(); - _activeText[i].textcolor = -1; + _activeText[i].textcolor = -1; return i; } @@ -1000,11 +1810,11 @@ void KyraEngine_v2::seq_loadNestedSequence(int wsaNum, int seqNum) { if (_activeWSA[wsaNum].flags != -1) return; - + NestedSequence s = _nSequences[seqNum]; - + if (!_activeWSA[wsaNum].movie) { - _activeWSA[wsaNum].movie = new WSAMovieV2(this); + _activeWSA[wsaNum].movie = new WSAMovieV2(this); assert(_activeWSA[wsaNum].movie); } @@ -1023,9 +1833,9 @@ void KyraEngine_v2::seq_loadNestedSequence(int wsaNum, int seqNum) { _activeWSA[wsaNum].startFrame = _activeWSA[wsaNum].currentFrame = s.startframe; _activeWSA[wsaNum].frameDelay = s.frameDelay; _activeWSA[wsaNum].movie->setX(0); - _activeWSA[wsaNum].movie->setY(0); + _activeWSA[wsaNum].movie->setY(0); _activeWSA[wsaNum].movie->setDrawPage(_screen->_curPage); - _activeWSA[wsaNum].callback = s.callback; + _activeWSA[wsaNum].callback = s.callback; _activeWSA[wsaNum].control = s.wsaControl; _activeWSA[wsaNum].flags = s.flags | 1; @@ -1034,7 +1844,7 @@ void KyraEngine_v2::seq_loadNestedSequence(int wsaNum, int seqNum) { _activeWSA[wsaNum].startupCommand = s.startupCommand; _activeWSA[wsaNum].finalCommand = s.finalCommand; _activeWSA[wsaNum].lastFrame = 0xffff; - + seq_nestedSequenceFrame(s.startupCommand, wsaNum); if (!s.startupCommand) @@ -1074,7 +1884,7 @@ void KyraEngine_v2::seq_nestedSequenceFrame(int command, int wsaNum) { _activeWSA[wsaNum].movie->setY(0); seq_animatedSubFrame(8, 2, 7, 8, _activeWSA[wsaNum].movie->xAdd(), _activeWSA[wsaNum].movie->yAdd(), _activeWSA[wsaNum].movie->width(), _activeWSA[wsaNum].movie->height(), 1, 1); - break; + break; case 2: seq_waitForTextsTimeout(); @@ -1091,22 +1901,22 @@ void KyraEngine_v2::seq_nestedSequenceFrame(int command, int wsaNum) { break; case 3: - _screen->copyRegionToBuffer(2, 0, 0, 320, 200, _pageBuffer1); + _screen->copyPage(2, 10); _activeWSA[wsaNum].movie->setDrawPage(2); _activeWSA[wsaNum].movie->setX(0); _activeWSA[wsaNum].movie->setY(0); _activeWSA[wsaNum].movie->displayFrame(0, 0); - _screen->copyRegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(2, 12); seq_cmpFadeFrame("scene2.cmp"); break; case 4: - _screen->copyRegionToBuffer(2, 0, 0, 320, 200, _pageBuffer1); + _screen->copyPage(2, 10); _activeWSA[wsaNum].movie->setDrawPage(2); _activeWSA[wsaNum].movie->setX(0); _activeWSA[wsaNum].movie->setY(0); _activeWSA[wsaNum].movie->displayFrame(0, 0); - _screen->copyRegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(2, 12); seq_cmpFadeFrame("scene3.cmp"); break; @@ -1115,9 +1925,9 @@ void KyraEngine_v2::seq_nestedSequenceFrame(int command, int wsaNum) { } } -void KyraEngine_v2::seq_animatedSubFrame(int srcPage, int dstPage, int delaytime, int steps, +void KyraEngine_v2::seq_animatedSubFrame(int srcPage, int dstPage, int delaytime, int steps, int x, int y, int w, int h, int openClose, int directionFlags) { - + if (openClose) { for (int i = 1; i < steps; i++) { uint32 endtime = _system->getMillis() + delaytime * _tickLength; @@ -1134,7 +1944,7 @@ void KyraEngine_v2::seq_animatedSubFrame(int srcPage, int dstPage, int delaytime _screen->copyPage(dstPage, 0); _screen->updateScreen(); - _screen->copyBlockToPage(dstPage, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(12, dstPage); delayUntil(endtime); } @@ -1143,7 +1953,7 @@ void KyraEngine_v2::seq_animatedSubFrame(int srcPage, int dstPage, int delaytime _screen->copyPage(dstPage, 0); _screen->updateScreen(); } else { - _screen->copyBlockToPage(dstPage, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(12, dstPage); for (int i = steps; i; i--) { uint32 endtime = _system->getMillis() + delaytime * _tickLength; @@ -1159,7 +1969,7 @@ void KyraEngine_v2::seq_animatedSubFrame(int srcPage, int dstPage, int delaytime _screen->copyPage(dstPage, 0); _screen->updateScreen(); - _screen->copyBlockToPage(dstPage, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(12, dstPage); delayUntil(endtime); } } @@ -1185,17 +1995,17 @@ void KyraEngine_v2::seq_unloadWSA(int wsaNum) { bool KyraEngine_v2::seq_processNextSubFrame(int wsaNum) { uint32 currentFrame = _activeWSA[wsaNum].currentFrame; uint32 currentTime = _system->getMillis(); - + if (_activeWSA[wsaNum].callback && currentFrame != _activeWSA[wsaNum].lastFrame) { _activeWSA[wsaNum].lastFrame = currentFrame; - currentFrame = (this->*_activeWSA[wsaNum].callback)(_activeWSA[wsaNum].movie, _activeWSA[wsaNum].x, _activeWSA[wsaNum].y, currentFrame); + currentFrame = (this->*_activeWSA[wsaNum].callback)(_activeWSA[wsaNum].movie, _activeWSA[wsaNum].x, _activeWSA[wsaNum].y, currentFrame); } if (_activeWSA[wsaNum].movie) { _activeWSA[wsaNum].movie->setDrawPage(2); _activeWSA[wsaNum].movie->setX(_activeWSA[wsaNum].x); _activeWSA[wsaNum].movie->setY(_activeWSA[wsaNum].y); - + if (_activeWSA[wsaNum].flags & 0x20) { _activeWSA[wsaNum].movie->displayFrame(_activeWSA[wsaNum].control[currentFrame].frameIndex, 0x4000); _activeWSA[wsaNum].frameDelay = _activeWSA[wsaNum].control[currentFrame].frameDelay; @@ -1209,10 +2019,10 @@ bool KyraEngine_v2::seq_processNextSubFrame(int wsaNum) { } else { if (((int32)(currentTime - _activeWSA[wsaNum].nextFrame) / (int32)(_activeWSA[wsaNum].frameDelay * _tickLength)) > 0) { currentFrame++; - _activeWSA[wsaNum].nextFrame += (_activeWSA[wsaNum].frameDelay * _tickLength); + _activeWSA[wsaNum].nextFrame = currentTime; } } - + bool res = false; if (currentFrame >= _activeWSA[wsaNum].endFrame) { @@ -1221,7 +2031,7 @@ bool KyraEngine_v2::seq_processNextSubFrame(int wsaNum) { case 0: res = true; currentFrame = _activeWSA[wsaNum].endFrame; - _screen->copyRegionToBuffer(2, 0, 0, 320, 200, _pageBuffer2); + _screen->copyPage(2, 12); break; case 6: @@ -1245,9 +2055,104 @@ bool KyraEngine_v2::seq_processNextSubFrame(int wsaNum) { return res; } +void KyraEngine_v2::seq_printCreditsString(uint16 strIndex, int x, int y, uint8 * colorMap, uint8 textcolor) { + uint8 colormap[16]; + + memset(&_screen->getPalette(0)[0x2fa], 0x3f, 6); + _screen->getPalette(0)[0x2f6] = 0x3f; + _screen->getPalette(0)[0x2f5] = 0x20; + _screen->getPalette(0)[0x2f4] = 0x30; + colormap[0] = colorMap[0]; + colormap[1] = 0xfd; + memcpy(&colormap[2], &colorMap[2], 14); + uint8 seqTextColor0 = _seqTextColor[0]; + + _seqTextColor[0] = 0xfd; + _screen->setTextColorMap(colormap); + seq_resetAllTextEntries(); + seq_setTextEntry(strIndex, x, y, 0x80, 0x78); + seq_processText(); + _screen->copyPage(2, 6); + _screen->copyPage(2, 0); + _screen->updateScreen(); + _screen->getPalette(0)[0x2f7] = _screen->getPalette(0)[textcolor * 3]; + _screen->getPalette(0)[0x2f8] = _screen->getPalette(0)[textcolor * 3 + 1]; + _screen->getPalette(0)[0x2f9] = _screen->getPalette(0)[textcolor * 3 + 2]; + _screen->fadePalette(_screen->getPalette(0), 0x18); + + _seqTextColor[0] = textcolor; + _screen->setTextColorMap(colorMap); + seq_resetAllTextEntries(); + seq_setTextEntry(strIndex, x, y, 0x80, 0x78); + seq_processText(); + _screen->copyPage(2, 6); + _screen->copyPage(2, 0); + _screen->updateScreen(); + _screen->getPalette(0)[0x2f7] = _screen->getPalette(0)[0x2f8] = _screen->getPalette(0)[0x2f9] = 0; + _screen->fadePalette(_screen->getPalette(0), 1); + _screen->copyPage(2, 12); + seq_resetAllTextEntries(); + + _seqTextColor[0] = seqTextColor0; +} + +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) { + int dur = strlen(_sequenceStrings[strIndex]) * (_flags.isTalkie ? 7 : 15); + int entry = seq_setTextEntry(strIndex, x, y, dur, width); + _activeText[entry].textcolor = textColor; + uint32 chatTimeout = _system->getMillis() + dur * _tickLength; + int curframe = firstframe; + + if (vocIndex) + seq_playTalkText(vocIndex); + + while (_system->getMillis() < chatTimeout) { + if (lastframe < 0) { + int t = ABS(lastframe); + if (t < curframe) + curframe = t; + } + + if (ABS(lastframe) < curframe) + curframe = firstframe; + + uint32 frameTimeout = _seqEndTime = _system->getMillis() + _seqFrameDelay * _tickLength; + if (wsa) { + wsa->setDrawPage(2); + wsa->setX(wsaXpos); + wsa->setY(wsaYpos); + wsa->displayFrame(curframe % wsa->frames(), 0); + } + + _screen->copyPage(2, 12); + + seq_processText(); + + uint32 tm = _system->getMillis(); + if (frameTimeout > tm && chatTimeout > tm) + delay(MIN(frameTimeout - tm, chatTimeout - tm)); + + _screen->copyPage(2, 6); + _screen->copyPage(2, 0); + _screen->updateScreen(); + curframe++; + } + + + + if (lastframe < 0) { + int t = ABS(lastframe); + if (t < curframe) + curframe = t; + } + + if (curframe == firstframe) + curframe++; + + _seqWsaCurrentFrame = curframe; +} + void KyraEngine_v2::seq_init() { - _pageBuffer1 = new uint8[64000]; - _pageBuffer2 = new uint8[64000]; _seqProcessedString = new char[200]; _seqWsa = new WSAMovieV2(this); _activeWSA = new ActiveWSA[8]; @@ -1255,21 +2160,15 @@ void KyraEngine_v2::seq_init() { } void KyraEngine_v2::seq_uninit() { - delete [] _pageBuffer1; - _pageBuffer1 = NULL; - - delete [] _pageBuffer2; - _pageBuffer2 = NULL; - delete [] _seqProcessedString; _seqProcessedString = NULL; - + delete [] _activeWSA; _activeWSA = NULL; - + delete [] _activeText; _activeText = NULL; - + delete _seqWsa; _seqWsa = NULL; } @@ -1277,22 +2176,53 @@ void KyraEngine_v2::seq_uninit() { // static res // TODO: move to staticres.cpp -const Sequence KyraEngine_v2::_sequences[] = { +const Sequence KyraEngine_v2::_sequences_PC[] = { // flags, wsaFile, cpsFile, startupCommand, finalCommand, stringIndex1, stringIndex2, // startFrame, numFrames, frameDelay, xPos, yPos, callback, duration { 2, 0, "virgin.cps", 4, 0, -1, -1, 0, 1, 100, 0, 0, 0, 30 }, - { 1, "westwood.wsa", 0, 4, 0, -1, -1, 0, 18, 12, 0, 0, &KyraEngine_v2::seq_introWestwood, 10 }, + { 1, "westwood.wsa", 0, 4, 0, -1, -1, 0, 18, 6, 0, 0, &KyraEngine_v2::seq_introWestwood, 160 }, + { 1, "title.wsa", 0, 4, 0, -1, -1, 0, 26, 6, 0, 0, &KyraEngine_v2::seq_introTitle, 10 }, + { 2, 0, "over.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introOverview, 30 }, + { 2, 0, "library.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introLibrary, 30 }, + { 2, 0, "hand.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introHand, 90 }, + { 1, "point.wsa", 0, 4, 8, -1, -1, 0, 38, 7, 0, 0, &KyraEngine_v2::seq_introPoint, 200 }, + { 1, "zanfaun.wsa", 0, 4, 0, -1, -1, 0, 51, 16, 0, 0, &KyraEngine_v2::seq_introZanfaun, 240 }, + + { 1, "funters.wsa", 0, 4, 0, -1, -1, 0, 27, 12, 0, 0, &KyraEngine_v2::seq_finaleFunters, 30 }, + { 1, "ferb.wsa", 0, 4, 0, -1, -1, 0, 27, 16, 0, 0, &KyraEngine_v2::seq_finaleFerb, 30 }, + { 1, "fish.wsa", 0, 4, 0, -1, -1, 0, 56, 12, 0, 0, &KyraEngine_v2::seq_finaleFish, 30 }, + { 1, "fheep.wsa", 0, 4, 0, -1, -1, 0, 11, 12, 0, 0, &KyraEngine_v2::seq_finaleFheep, 30 }, + { 1, "farmer.wsa", 0, 4, 0, -1, -1, 0, 22, 12, 0, 0, &KyraEngine_v2::seq_finaleFarmer, 100 }, + { 1, "fuards.wsa", 0, 4, 0, -1, -1, 0, 24, 14, 0, 0, &KyraEngine_v2::seq_finaleFuards, 30 }, + { 1, "firates.wsa", 0, 4, 0, -1, -1, 0, 37, 12, 0, 0, &KyraEngine_v2::seq_finaleFirates, 30 }, + { 1, "frash.wsa", 0, 4, 0, -1, -1, 0, 12, 10, 0, 0, &KyraEngine_v2::seq_finaleFrash, 340 } +}; + +const Sequence KyraEngine_v2::_sequences_TOWNS[] = { + // flags, wsaFile, cpsFile, startupCommand, finalCommand, stringIndex1, stringIndex2, + // startFrame, numFrames, frameDelay, xPos, yPos, callback, duration + { 2, 0, "virgin.cps", 4, 0, -1, -1, 0, 1, 100, 0, 0, 0, 30 }, + { 1, "westwood.wsa", 0, 4, 0, -1, -1, 0, 18, 12, 0, 0, &KyraEngine_v2::seq_introWestwood, 160 }, { 1, "title.wsa", 0, 4, 0, -1, -1, 0, 26, 12, 0, 0, &KyraEngine_v2::seq_introTitle, 10 }, { 2, 0, "over.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introOverview, 30 }, { 2, 0, "library.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introLibrary, 30 }, { 2, 0, "hand.cps", 4, 0, -1, -1, 0, 1, 3600, 0, 0, &KyraEngine_v2::seq_introHand, 90 }, { 1, "point.wsa", 0, 4, 8, -1, -1, 0, 38, 7, 0, 0, &KyraEngine_v2::seq_introPoint, 200 }, { 1, "zanfaun.wsa", 0, 4, 0, -1, -1, 0, 51, 16, 0, 0, &KyraEngine_v2::seq_introZanfaun, 240 }, + + { 1, "funters.wsa", 0, 4, 0, -1, -1, 0, 27, 12, 0, 0, &KyraEngine_v2::seq_finaleFunters, 30 }, + { 1, "ferb.wsa", 0, 4, 0, -1, -1, 0, 27, 16, 0, 0, &KyraEngine_v2::seq_finaleFerb, 30 }, + { 1, "fish.wsa", 0, 4, 0, -1, -1, 0, 56, 12, 0, 0, &KyraEngine_v2::seq_finaleFish, 30 }, + { 1, "fheep.wsa", 0, 4, 0, -1, -1, 0, 11, 12, 0, 0, &KyraEngine_v2::seq_finaleFheep, 30 }, + { 1, "farmer.wsa", 0, 4, 0, -1, -1, 0, 22, 12, 0, 0, &KyraEngine_v2::seq_finaleFarmer, 100 }, + { 1, "fuards.wsa", 0, 4, 0, -1, -1, 0, 24, 14, 0, 0, &KyraEngine_v2::seq_finaleFuards, 30 }, + { 1, "firates.wsa", 0, 4, 0, -1, -1, 0, 37, 12, 0, 0, &KyraEngine_v2::seq_finaleFirates, 30 }, + { 1, "frash.wsa", 0, 4, 0, -1, -1, 0, 12, 10, 0, 0, &KyraEngine_v2::seq_finaleFrash, 340 } }; const NestedSequence KyraEngine_v2::_nSequences[] = { // flags, wsaFile, startframe, endFrame, frameDelay, callback, x, y, wsaControl, startupCommand, finalCommand, unk1; - { 0x0C, "figgle.wsa", 0, 3, 60, /*&KyraEngine_v2::seq_finaleFiggle*/0, 0, 0, 0, 0, 0, 0 }, + { 0x0C, "figgle.wsa", 0, 3, 60, &KyraEngine_v2::seq_finaleFiggle, 0, 0, 0, 0, 0, 0 }, { 8, "over1.wsa", 0, 10, 10, &KyraEngine_v2::seq_introOver1, 0, 0, 0, 0, 0, 0 }, { 8, "over2.wsa", 0, 11, 9, &KyraEngine_v2::seq_introOver2, 0, 0, 0, 0, 0, 0 }, @@ -1300,7 +2230,7 @@ const NestedSequence KyraEngine_v2::_nSequences[] = { { 8, "dragon.wsa", 0, 11, 6, &KyraEngine_v2::seq_introDragon, 0, 0, 0, 2, 0, 0 }, { 2, "darm.wsa", 0, 19, 9, &KyraEngine_v2::seq_introDarm, 0, 0, 0, 4, 0, 0 }, { 2, "library.wsa", 0, 33, 9, &KyraEngine_v2::seq_introLibrary2, 0, 0, 0, 4, 0, 0 }, - { 0x2A, "library.wsa", 0, 18, 9, &KyraEngine_v2::seq_introLibrary2, 0, 0, _wsaControlLibrary, 0, 0, 0 }, + { 0x2A, "library.wsa", 0, 19, 9, &KyraEngine_v2::seq_introLibrary2, 0, 0, _wsaControlLibrary, 0, 0, 0 }, { 0x0A, "marco.wsa", 0, 37, 9, &KyraEngine_v2::seq_introMarco, 0, 0, 0, 4, 0, 0 }, { 2, "hand1a.wsa", 0, 34, 9, &KyraEngine_v2::seq_introHand1a, 0, 0, 0, 0, 0, 0 }, { 0x2A, "hand1b.wsa", 0, 16, 9, &KyraEngine_v2::seq_introHand1b, 0, 0, _wsaControlHand1b, 0, 0, 0 }, @@ -1327,11 +2257,11 @@ const SequenceControl KyraEngine_v2::_wsaControlHand1c[] = { {0x00, 0x06}, {0x01, 0x06}, {0x02, 0x06}, {0x03, 0x06}, {0x04, 0x06}, {0x03, 0x06}, {0x04, 0x06}, {0x05, 0x40}, {0x05, 0x06} }; - + const SequenceControl KyraEngine_v2::_wsaControlHand2[] = { {0x00, 0x06}, {0x01, 0x06}, {0x00, 0x06}, {0x01, 0x06}, {0x00, 0x06}, {0x01, 0x06}, {0x00, 0x06}, {0x01, 0x06}, {0x00, 0x06}, {0x01, 0x06}, {0x00, 0x06}, {0x01, 0x06}, - {0x00, 0x06}, {0x01, 0x06}, {0x00, 0x06}, {0x01, 0x06} + {0x00, 0x06}, {0x01, 0x06}, {0x00, 0x06}, {0x01, 0x06} }; const SequenceControl KyraEngine_v2::_wsaControlHand3[] = { diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp index 2978475f0e..891f4cda1d 100644 --- a/engines/kyra/sound.cpp +++ b/engines/kyra/sound.cpp @@ -81,7 +81,7 @@ void Sound::voicePlay(const char *file) { } if (_currentVocFile) { - _mixer->stopHandle(_vocHandle); + //_mixer->stopHandle(_vocHandle); _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_vocHandle, _currentVocFile); } delete [] fileData; diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index a59b1f0bd0..ec2b24c784 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -1154,7 +1154,116 @@ const char *KyraEngine_v2::_mainMenuStrings[] = { // kyra 2 static res -const char *KyraEngine_v2::_sequenceStrings[] = { +const char *KyraEngine_v2::_sequenceStrings_PC_EN[] = { + "Kyrandia is disappearing!", + "Rock by rock...", + "...and tree by tree.", + "Kyrandia ceases to exist!", + "The Royal Mystics are baffled.", + "Every reference has been consulted.", + "Even Marko and his new valet have been allowed into the conference.", + "Luckily, the Hand was experienced in these matters.", + "And finally a plan was approved...", + "...that required a magic Anchor Stone...", + "...to be retrieved from the center of the world.", + "Zanthia, youngest of the Kyrandian Mystics, has been selected to retrieve the Stone.", + "Thank you for playing The Hand of Fate.", + "This should be enough blueberries to open a portal to the center of the world.", + " DUMMY STRING... ", + " DUMMY STRING... ", + "Hey! All my equipment has been stolen!", + " DUMMY STRING... ", + "If they think I'm going to walk all the way down there, they're nuts!", + " DUMMY STRING... ", + " DUMMY STRING... ", + "Hurry up Faun!", + + "Boy, that was a close call!", + "You said it pal. I, for one, am never going hunting again!", + "Ribbit.", + "How many times do I have to tell you? You're a toad.", + "Oh no! We're out of cheese!", + "Let's try this earwax. It's orange.", + "Mommy, when do I get the ivy?", + "Get out of here, shoo!", + "You cut, and I'll choose.", + "No. You cut and I'll choose.", + "I still say it was derivative drivel.", + "Aw, you still wouldn't recognize iambic pentameter if it bit you on the butt!", + + "Executive Producer", + "Brett W. Sperry", + "Direction & Design", + "Rick Gush", + "Lead Programmer", + "Michael Legg", + "Art Management", + "Louis Castle", + "Joseph B. Hewitt IV", + "Lead Artist", + "Rick Parks", + "Additional Coding by", + "Philip W. Gorrow", + "Mike Grayford", + "Mark McCubbin", + "Artists", + "Cameron Chun", + "Cary Averett", + "Cindy Chinn", + "Elie Arabian", + "Fei Cheng", + "Ferby Miguel", + "Frank Mendeola", + "Jack Martin", + "Jerry Moore", + "DUMMY STRING... ", + "Judith Peterson", + "Larry Miller", + "Lenny Lee", + "Louise Sandoval", + "Ren Olsen", + "Music & Sounds by", + "Paul Mudra", + "Frank Klepacki", + "Dwight Okahara", + "Pat Collins", + "Quality Assurance by", + "Glenn Sperry", + "Michael Lightner", + "William Foster", + "Jesse Clemit", + "Jeff Fillhaber", + "Manual, Package Design", + "& Fulfillment", + "Eydie Laramore", + "Lisa Marcinko", + "Lauren Rifkin", + "Congratulations!", + "Thank you for playing The Hand of Fate!", + "Guest Coding", + "Producer Liaison", + "Scott Duckett", + "Irvine Testers", + "Chris McFarland", + "Paul Moore", + "Chad Soares", + "Jared Brinkley", + "Jon Willliams", + "Chris Toft", + "Joe Kucan's Hair by", + "Theodore A. Morris", + "Load a game", + "Introduction", + "Start a new game", + "Exit the game", + "Special Thanks, to", + "Sake Joe Bostic-san", + "Tim Fritz", + "Kenny Dunne", + "Thank you for playing \"The Hand of Fate\." +}; + +const char *KyraEngine_v2::_sequenceStrings_TOWNS_EN[] = { "Kyrandia is disappearing!", "Rock by rock...", "...and tree by tree.", @@ -1264,9 +1373,10 @@ const char *KyraEngine_v2::_sequenceStrings[] = { "Takeshi Abo (Japan)" }; -const int KyraEngine_v2::_sequenceStringsSize = ARRAYSIZE(KyraEngine_v2::_sequenceStrings); +const int KyraEngine_v2::_sequenceStringsSize_PC_EN = ARRAYSIZE(KyraEngine_v2::_sequenceStrings_PC_EN); +const int KyraEngine_v2::_sequenceStringsSize_TOWNS_EN = ARRAYSIZE(KyraEngine_v2::_sequenceStrings_TOWNS_EN); -const char *KyraEngine_v2::_sequenceSoundListPC[] = { +const char *KyraEngine_v2::_sequenceSoundList_PC[] = { "eintro1", "eintro2", "eintro3", @@ -1317,7 +1427,44 @@ const char *KyraEngine_v2::_sequenceSoundListPC[] = { "theend" }; -const int KyraEngine_v2::_sequenceSoundListPCSize = ARRAYSIZE(KyraEngine_v2::_sequenceSoundListPC); +const char *KyraEngine_v2::_sequenceSoundList_TOWNS[] = { + "intro1.pcm", + "intro2.pcm", + "intro3.pcm", + "intro4.pcm", + "intro5.pcm", + "intro6.pcm", + "intro7.pcm", + "intro8.pcm", + "intro9.pcm", + "intro10.pcm", + "intro11.pcm", + "intro12.pcm", + "glow.pcm", + + "asong.pcm", + "crowcaw.pcm", + "eyerub2.pcm", + "pluck3.pcm", + "rodnreel.pcm", + "frog1.pcm", + "scavmov2.pcm", + "lambmom3.pcm", + "lambkid1.pcm", + "thunder2.pcm", + "thunder3.pcm", + "wind6.pcm", + "h2odrop2.pcm", + "gasleak.pcm", + "polgulp1.pcm", + "hndslap1.pcm", + "burp1.pcm", + "scream1.pcm", + "theend.pcm" +}; + +const int KyraEngine_v2::_sequenceSoundListSize_PC = ARRAYSIZE(KyraEngine_v2::_sequenceSoundList_PC); +const int KyraEngine_v2::_sequenceSoundListSize_TOWNS = ARRAYSIZE(KyraEngine_v2::_sequenceSoundList_TOWNS); const uint8 KyraEngine_v2::_seqTextColorPresets[] = { 0x01, 0x01, 0x00, 0x3f, 0x3f, 0x3f }; @@ -1374,6 +1521,9 @@ const byte KyraEngine_v2::_itemStringMap[] = { 0, 2, 0, 0, 0, 0, 0, 0 }; +const char *KyraEngine_v2::_dosSoundFileListIntro[] = { "K2INTRO" }; +const char *KyraEngine_v2::_dosSoundFileListFinale[] = { "K2FINALE" }; + const char *KyraEngine_v2::_dosSoundFileList[] = { "K2TEST1", "K2TEST2", diff --git a/engines/kyra/text_v2.cpp b/engines/kyra/text_v2.cpp index 74eb80d6c7..9bf842a7a8 100644 --- a/engines/kyra/text_v2.cpp +++ b/engines/kyra/text_v2.cpp @@ -30,7 +30,7 @@ namespace Kyra { TextDisplayer_v2::TextDisplayer_v2(KyraEngine_v2 *vm, Screen_v2 *screen) - : _vm(vm), TextDisplayer(vm, screen) { + : TextDisplayer(vm, screen), _vm(vm) { } void TextDisplayer_v2::backupTalkTextMessageBkgd(int srcPage, int dstPage) { diff --git a/engines/kyra/wsamovie.h b/engines/kyra/wsamovie.h index aef99199d8..53f1819b30 100644 --- a/engines/kyra/wsamovie.h +++ b/engines/kyra/wsamovie.h @@ -39,7 +39,7 @@ class KyraEngine_v2; class Movie { public: - Movie(KyraEngine *vm) : _x(-1), _y(-1), _drawPage(-1), _vm(vm), _opened(false) {} + Movie(KyraEngine *vm) : _vm(vm), _opened(false), _x(-1), _y(-1), _drawPage(-1) {} virtual ~Movie() {} virtual bool opened() { return _opened; } |