diff options
author | Johannes Schickel | 2008-03-28 00:13:43 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-03-28 00:13:43 +0000 |
commit | 98f9a47619681943d9dc797f6982abca3a1f4c44 (patch) | |
tree | b148ec5f5399d1d431909673b88ac13946ea46cb | |
parent | 221e6bb84f67e8fd808d922a0ff347956b78e166 (diff) | |
download | scummvm-rg350-98f9a47619681943d9dc797f6982abca3a1f4c44.tar.gz scummvm-rg350-98f9a47619681943d9dc797f6982abca3a1f4c44.tar.bz2 scummvm-rg350-98f9a47619681943d9dc797f6982abca3a1f4c44.zip |
Implemented opcodes:
- 38: o2_countItemsInScene
- 57: o2_setTimerDelay
- 84: o2_getSceneExitToFacing
- 137: o2_removeItemFromScene
svn-id: r31279
-rw-r--r-- | engines/kyra/kyra_v2.h | 4 | ||||
-rw-r--r-- | engines/kyra/script_v2.cpp | 51 |
2 files changed, 51 insertions, 4 deletions
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index 5d57c4ca66..226d0ed330 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -984,6 +984,7 @@ protected: int o2_defineItem(ScriptState *script); int o2_removeItemFromInventory(ScriptState *script); int o2_countItemInInventory(ScriptState *script); + int o2_countItemsInScene(ScriptState *script); int o2_queryGameFlag(ScriptState *script); int o2_resetGameFlag(ScriptState *script); int o2_setGameFlag(ScriptState *script); @@ -1000,6 +1001,7 @@ protected: //int o2_playSoundEffect(ScriptState *script); int o2_delaySecs(ScriptState *script); int o2_delay(ScriptState *script); + int o2_setTimerDelay(ScriptState *script); int o2_setScaleTableItem(ScriptState *script); int o2_setDrawLayerTableItem(ScriptState *script); int o2_setCharPalEntry(ScriptState *script); @@ -1022,6 +1024,7 @@ protected: int o2_switchScene(ScriptState *script); int o2_getShapeFlag1(ScriptState *script); int o2_setPathfinderFlag(ScriptState *script); + int o2_getSceneExitToFacing(ScriptState *script); int o2_setLayerFlag(ScriptState *script); int o2_setZanthiaPos(ScriptState *script); int o2_loadMusicTrack(ScriptState *script); @@ -1066,6 +1069,7 @@ protected: int o2_getColorCodeValue(ScriptState *script); int o2_setColorCodeValue(ScriptState *script); int o2_countItemInstances(ScriptState *script); + int o2_removeItemFromScene(ScriptState *script); int o2_initObject(ScriptState *script); int o2_npcChat(ScriptState *script); int o2_deinitObject(ScriptState *script); diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp index ac0a7e955f..4eb8f51535 100644 --- a/engines/kyra/script_v2.cpp +++ b/engines/kyra/script_v2.cpp @@ -502,6 +502,16 @@ int KyraEngine_v2::o2_countItemInInventory(ScriptState *script) { return count; } +int KyraEngine_v2::o2_countItemsInScene(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_countItemsInScene(%p) (%d)", (const void *)script, stackPos(0)); + int count = 0; + for (int i = 0; i < 30; ++i) { + if (_itemList[i].sceneId == stackPos(0) && _itemList[i].id != 0xFFFF) + ++count; + } + return count; +} + int KyraEngine_v2::o2_queryGameFlag(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_queryGameFlag(%p) (%d)", (const void *)script, stackPos(0)); return queryGameFlag(stackPos(0)); @@ -625,6 +635,12 @@ int KyraEngine_v2::o2_delay(ScriptState *script) { return 0; } +int KyraEngine_v2::o2_setTimerDelay(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setTimerDelay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); + _timer->setDelay(stackPos(0), stackPos(1)); + return 0; +} + int KyraEngine_v2::o2_setScaleTableItem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setScaleTableItem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); setScaleTableItem(stackPos(0), stackPos(1)); @@ -826,6 +842,22 @@ int KyraEngine_v2::o2_setPathfinderFlag(ScriptState *script) { return 0; } +int KyraEngine_v2::o2_getSceneExitToFacing(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getSceneExitToFacing(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); + const int scene = stackPos(0); + const int facing = stackPos(1); + + if (facing == 0) + return (int16)_sceneList[scene].exit1; + else if (facing == 2) + return (int16)_sceneList[scene].exit2; + else if (facing == 4) + return (int16)_sceneList[scene].exit3; + else if (facing == 6) + return (int16)_sceneList[scene].exit4; + return -1; +} + int KyraEngine_v2::o2_setLayerFlag(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setLayerFlag(%p) (%d)", (const void *)script, stackPos(0)); int layer = stackPos(0); @@ -1344,6 +1376,17 @@ int KyraEngine_v2::o2_countItemInstances(ScriptState *script) { return count; } +int KyraEngine_v2::o2_removeItemFromScene(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_removeItemFromScene(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); + const int scene = stackPos(0); + const uint16 item = stackPos(1); + for (int i = 0; i < 30; ++i) { + if (_itemList[i].sceneId == scene && _itemList[i].id == item) + _itemList[i].id = 0xFFFF; + } + return 0; +} + int KyraEngine_v2::o2_initObject(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_initObject(%p) (%d)", (const void *)script, stackPos(0)); initTalkObject(stackPos(0)); @@ -1781,7 +1824,7 @@ void KyraEngine_v2::setupOpcodeTable() { // 0x24 Opcode(o2_removeItemFromInventory), Opcode(o2_countItemInInventory), - OpcodeUnImpl(), + Opcode(o2_countItemsInScene), Opcode(o2_queryGameFlag), // 0x28 Opcode(o2_resetGameFlag), @@ -1805,7 +1848,7 @@ void KyraEngine_v2::setupOpcodeTable() { Opcode(o2_delay), // 0x38 Opcode(o2_dummy), - OpcodeUnImpl(), + Opcode(o2_setTimerDelay), Opcode(o2_setScaleTableItem), Opcode(o2_setDrawLayerTableItem), // 0x3c @@ -1839,7 +1882,7 @@ void KyraEngine_v2::setupOpcodeTable() { Opcode(o2_getShapeFlag1), Opcode(o2_setPathfinderFlag), // 0x54 - OpcodeUnImpl(), + Opcode(o2_getSceneExitToFacing), Opcode(o2_setLayerFlag), Opcode(o2_setZanthiaPos), Opcode(o2_loadMusicTrack), @@ -1905,7 +1948,7 @@ void KyraEngine_v2::setupOpcodeTable() { Opcode(o2_setColorCodeValue), // 0x88 Opcode(o2_countItemInstances), - OpcodeUnImpl(), + Opcode(o2_removeItemFromScene), Opcode(o2_initObject), Opcode(o2_npcChat), // 0x8c |