diff options
author | Johannes Schickel | 2008-03-15 21:03:35 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-03-15 21:03:35 +0000 |
commit | db3e317ab3eebe6d8edeca5a87e8e0426ca08a62 (patch) | |
tree | f55496ada046955fb1837774c601f16bfb5d1854 /engines/kyra | |
parent | fd7ed046bb89f91c767b762dd1ea336b798a3bbf (diff) | |
download | scummvm-rg350-db3e317ab3eebe6d8edeca5a87e8e0426ca08a62.tar.gz scummvm-rg350-db3e317ab3eebe6d8edeca5a87e8e0426ca08a62.tar.bz2 scummvm-rg350-db3e317ab3eebe6d8edeca5a87e8e0426ca08a62.zip |
Implemented opcodes:
- 27: o2_displayWsaSequence
- 99: o2_setDrawNoShapeFlag
- 129: o2_chapterChange
- 159: o2_processPaletteIndex
svn-id: r31133
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/kyra_v2.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/kyra_v2.h | 4 | ||||
-rw-r--r-- | engines/kyra/script_v2.cpp | 81 |
3 files changed, 87 insertions, 6 deletions
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 43a94201e8..57a144107c 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -2116,7 +2116,7 @@ void KyraEngine_v2::setupOpcodeTable() { Opcode(o2_displayWsaSequentialFramesLooping), Opcode(o2_wsaOpen), Opcode(o2_displayWsaSequentialFrames), - OpcodeUnImpl(), + Opcode(o2_displayWsaSequence), // 0x1c OpcodeUnImpl(), OpcodeUnImpl(), @@ -2206,7 +2206,7 @@ void KyraEngine_v2::setupOpcodeTable() { Opcode(o2_getRand), OpcodeUnImpl(), OpcodeUnImpl(), - OpcodeUnImpl(), + Opcode(o2_setDrawNoShapeFlag), // 0x64 OpcodeUnImpl(), Opcode(o2_showLetter), @@ -2244,7 +2244,7 @@ void KyraEngine_v2::setupOpcodeTable() { Opcode(o2_pressColorKey), // 0x80 Opcode(o2_objectChat), - OpcodeUnImpl(), + Opcode(o2_chapterChange), Opcode(o2_getColorCodeFlag1), Opcode(o2_setColorCodeFlag1), // 0x84 @@ -2281,7 +2281,7 @@ void KyraEngine_v2::setupOpcodeTable() { OpcodeUnImpl(), OpcodeUnImpl(), OpcodeUnImpl(), - OpcodeUnImpl(), + Opcode(o2_processPaletteIndex), // 0xa0 OpcodeUnImpl(), OpcodeUnImpl(), diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index 221485aaa4..e2ccac50b0 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -951,6 +951,7 @@ protected: int o2_displayWsaSequentialFramesLooping(ScriptState *script); int o2_wsaOpen(ScriptState *script); int o2_displayWsaSequentialFrames(ScriptState *script); + int o2_displayWsaSequence(ScriptState *script); int o2_checkForItem(ScriptState *script); int o2_defineItem(ScriptState *script); int o2_removeItemFromInventory(ScriptState *script); @@ -987,6 +988,7 @@ protected: int o2_playWanderScoreViaMap(ScriptState *script); int o2_playSoundEffect(ScriptState *script); int o2_getRand(ScriptState *script); + int o2_setDrawNoShapeFlag(ScriptState *script); int o2_showLetter(ScriptState *script); int o2_fillRect(ScriptState *script); int o2_encodeShape(ScriptState *script); @@ -1007,6 +1009,7 @@ protected: int o2_getCountDown(ScriptState *script); int o2_pressColorKey(ScriptState *script); int o2_objectChat(ScriptState *script); + int o2_chapterChange(ScriptState *script); int o2_getColorCodeFlag1(ScriptState *script); int o2_setColorCodeFlag1(ScriptState *script); int o2_getColorCodeFlag2(ScriptState *script); @@ -1027,6 +1030,7 @@ protected: int o2_mushroomEffect(ScriptState *script); int o2_customChat(ScriptState *script); int o2_customChatFinish(ScriptState *script); + int o2_processPaletteIndex(ScriptState *script); int o2_getBoolFromStack(ScriptState *script); int o2_setVocHigh(ScriptState *script); int o2_getVocHigh(ScriptState *script); diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp index c926683194..6a2b596cf3 100644 --- a/engines/kyra/script_v2.cpp +++ b/engines/kyra/script_v2.cpp @@ -280,6 +280,37 @@ int KyraEngine_v2::o2_displayWsaSequentialFrames(ScriptState *script) { return 0; } +int KyraEngine_v2::o2_displayWsaSequence(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "o2_displayWsaSequence(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); + + const int frameDelay = stackPos(2) * _tickLength; + const int index = stackPos(3); + const bool doUpdate = (stackPos(4) != 0); + const uint16 copyParam = stackPos(5) | 0xc000; + + _wsaSlots[index]->setX(stackPos(0)); + _wsaSlots[index]->setY(stackPos(1)); + _wsaSlots[index]->setDrawPage(0); + + _screen->hideMouse(); + + int currentFrame = 0; + const int lastFrame = _wsaSlots[index]->frames(); + + while (currentFrame <= lastFrame) { + uint32 endTime = _system->getMillis() + frameDelay; + _wsaSlots[index]->displayFrame(currentFrame++, copyParam); + if (doUpdate) + update(); + _screen->updateScreen(); + delayUntil(endTime); + } + + _screen->showMouse(); + + return 0; +} + int KyraEngine_v2::o2_checkForItem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o2_checkForItem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); return findItem(stackPos(0), stackPos(1)) == -1 ? 0 : 1; @@ -591,6 +622,12 @@ int KyraEngine_v2::o2_getRand(ScriptState *script) { return _rnd.getRandomNumberRng(stackPos(0), stackPos(1)); } +int KyraEngine_v2::o2_setDrawNoShapeFlag(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "o2_setDrawNoShapeFlag(%p) (%d)", (const void *)script, stackPos(0)); + _drawNoShapeFlag = (stackPos(0) != 0); + return 0; +} + int KyraEngine_v2::o2_showLetter(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o2_showLetter(%p) (%d)", (const void *)script, stackPos(0)); const int letter = stackPos(0); @@ -863,8 +900,30 @@ int KyraEngine_v2::o2_objectChat(ScriptState *script) { return 0; } +int KyraEngine_v2::o2_chapterChange(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "o2_chapterChange(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); + const int chapter = stackPos(0); + const int scene = stackPos(1); + + resetItemList(); + + _newChapterFile = chapter; + runStartScript(chapter, 0); + + _mainCharacter.dlgIndex = 0; + memset(_newSceneDlgState, 0, 32); + + static const int zShapeList[] = { 1, 2, 2, 2, 4 }; + assert(chapter > 1 && chapter <= ARRAYSIZE(zShapeList)); + loadZShapes(zShapeList[chapter-1]); + + enterNewScene(scene, (chapter == 2) ? 2 : 0, 0, 0, 0); + + return 0; +} + int KyraEngine_v2::o2_getColorCodeFlag1(ScriptState *script) { - debugC(3, kDebugLevelScriptFuncs, "o2_getColorCodeFlag1(%p)", (const void *)script); + debugC(3, kDebugLevelScriptFuncs, "o2_getColorCodeFlag1(%p) ()", (const void *)script); return _colorCodeFlag1; } @@ -875,7 +934,7 @@ int KyraEngine_v2::o2_setColorCodeFlag1(ScriptState *script) { } int KyraEngine_v2::o2_getColorCodeFlag2(ScriptState *script) { - debugC(3, kDebugLevelScriptFuncs, "o2_getColorCodeFlag2(%p)", (const void *)script); + debugC(3, kDebugLevelScriptFuncs, "o2_getColorCodeFlag2(%p) ()", (const void *)script); return _colorCodeFlag2; } @@ -1035,6 +1094,24 @@ int KyraEngine_v2::o2_customChatFinish(ScriptState *script) { return 0; } +int KyraEngine_v2::o2_processPaletteIndex(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "o2_processPaletteIndex(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); + uint8 *palette = _screen->getPalette(0); + const int index = stackPos(0); + const bool updatePalette = (stackPos(4) != 0); + const int delayTime = stackPos(5); + palette[index*3+0] = (stackPos(1) * 0x3F) / 100; + palette[index*3+1] = (stackPos(2) * 0x3F) / 100; + palette[index*3+2] = (stackPos(3) * 0x3F) / 100; + if (updatePalette) { + if (delayTime > 0) + _screen->fadePalette(palette, delayTime, &_updateFunctor); + else + _screen->setScreenPalette(palette); + } + return 0; +} + int KyraEngine_v2::o2_getBoolFromStack(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o2_getBoolFromStack(%p) ()", (const void *)script); return stackPos(0) ? 1 : 0; |