diff options
author | Johannes Schickel | 2007-10-13 19:17:58 +0000 |
---|---|---|
committer | Johannes Schickel | 2007-10-13 19:17:58 +0000 |
commit | 706888358dc3086e8c96f6f8b88b06e969427151 (patch) | |
tree | 095c238cfb5e6d3263cd2c7e72ba2d980a3ce156 /engines/kyra | |
parent | 8d678b8705849b405d0180ad960da24d84f3e9aa (diff) | |
download | scummvm-rg350-706888358dc3086e8c96f6f8b88b06e969427151.tar.gz scummvm-rg350-706888358dc3086e8c96f6f8b88b06e969427151.tar.bz2 scummvm-rg350-706888358dc3086e8c96f6f8b88b06e969427151.zip |
HoF:
- implemented opcodes
-> o2_checkForItem 32
-> o2_countItemInInventory 37
-> o2_setMousePos 47
-> o2_countItemInstances 136
svn-id: r29211
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 | 60 |
3 files changed, 68 insertions, 4 deletions
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 32fb7c8ad0..306cdbed14 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -1505,13 +1505,13 @@ void KyraEngine_v2::setupOpcodeTable() { OpcodeUnImpl(), OpcodeUnImpl(), // 0x20 - OpcodeUnImpl(), + Opcode(o2_checkForItem), OpcodeUnImpl(), OpcodeUnImpl(), Opcode(o2_defineItem), // 0x24 OpcodeUnImpl(), - OpcodeUnImpl(), + Opcode(o2_countItemInInventory), OpcodeUnImpl(), Opcode(o2_queryGameFlag), // 0x28 @@ -1523,7 +1523,7 @@ void KyraEngine_v2::setupOpcodeTable() { Opcode(o2_handItemSet), Opcode(o2_hideMouse), Opcode(o2_addSpecialExit), - OpcodeUnImpl(), + Opcode(o2_setMousePos), // 0x30 Opcode(o2_showMouse), OpcodeUnImpl(), @@ -1635,7 +1635,7 @@ void KyraEngine_v2::setupOpcodeTable() { OpcodeUnImpl(), OpcodeUnImpl(), // 0x88 - OpcodeUnImpl(), + Opcode(o2_countItemInstances), OpcodeUnImpl(), OpcodeUnImpl(), OpcodeUnImpl(), diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index 4b866d7da9..f8ac4fb763 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -559,7 +559,9 @@ protected: int o2_displayWsaFrame(ScriptState *script); int o2_displayWsaSequentialFrames(ScriptState *script); int o2_wsaOpen(ScriptState *script); + int o2_checkForItem(ScriptState *script); int o2_defineItem(ScriptState *script); + int o2_countItemInInventory(ScriptState *script); int o2_queryGameFlag(ScriptState *script); int o2_resetGameFlag(ScriptState *script); int o2_setGameFlag(ScriptState *script); @@ -567,6 +569,7 @@ protected: int o2_handItemSet(ScriptState *script); int o2_hideMouse(ScriptState *script); int o2_addSpecialExit(ScriptState *script); + int o2_setMousePos(ScriptState *script); int o2_showMouse(ScriptState *script); //int o2_playSoundEffect(ScriptState *script); int o2_delay(ScriptState *script); @@ -594,6 +597,7 @@ protected: int o2_defineSceneAnim(ScriptState *script); int o2_updateSceneAnim(ScriptState *script); int o2_defineRoom(ScriptState *script); + int o2_countItemInstances(ScriptState *script); int o2_setSpecialSceneScriptState(ScriptState *script); int o2_clearSpecialSceneScriptState(ScriptState *script); int o2_querySpecialSceneScriptState(ScriptState *script); diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp index 167d9ea329..83f68c3747 100644 --- a/engines/kyra/script_v2.cpp +++ b/engines/kyra/script_v2.cpp @@ -248,6 +248,11 @@ int KyraEngine_v2::o2_wsaOpen(ScriptState *script) { 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; +} + int KyraEngine_v2::o2_defineItem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o2_defineItem(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); @@ -263,6 +268,22 @@ int KyraEngine_v2::o2_defineItem(ScriptState *script) { return freeItem; } +int KyraEngine_v2::o2_countItemInInventory(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "o2_countItemInInventory(%p) (%d)", (const void *)script, stackPos(0)); + uint16 item = stackPos(0); + int count = 0; + + for (int i = 0; i < 20; ++i) { + if (_mainCharacter.inventory[i] == item) + ++count; + } + + if (_itemInHand == int16(item)) + ++count; + + return count; +} + int KyraEngine_v2::o2_queryGameFlag(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o2_queryGameFlag(%p) (%d)", (const void *)script, stackPos(0)); return queryGameFlag(stackPos(0)); @@ -309,6 +330,12 @@ int KyraEngine_v2::o2_addSpecialExit(ScriptState *script) { return 0; } +int KyraEngine_v2::o2_setMousePos(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "o2_setMousePos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); + _system->warpMouse(stackPos(0), stackPos(1)); + return 0; +} + int KyraEngine_v2::o2_showMouse(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o2_showMouse(%p) ()", (const void *)script); _screen->showMouse(); @@ -607,6 +634,39 @@ int KyraEngine_v2::o2_defineRoom(ScriptState *script) { return 0; } +int KyraEngine_v2::o2_countItemInstances(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "o2_countItemInstances(%p) (%d)", (const void *)script, stackPos(0)); + uint16 item = stackPos(0); + + int count = 0; + for (int i = 0; i < 20; ++i) { + if (_mainCharacter.inventory[i] == item) + ++count; + } + + if (_itemInHand == int16(item)) + ++count; + + for (int i = 0; i < 30; ++i) { + if (_itemList[i].id == item) + ++count; + } + + /*XXX + if (_unkTable3[0] == item && _newChapterFile == 1) + ++count; + if (_unkTable3[1] == item && _newChapterFile == 1) + ++count; + if (_unkTable3[2] == item && _newChapterFile == 2) + ++count; + if (_unkTable3[3] == item && _newChapterFile == 2) + ++count; + if (_unkTable3[4] == item && _newChapterFile == 1) + ++count;*/ + + return count; +} + int KyraEngine_v2::o2_setSpecialSceneScriptState(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o2_setSpecialSceneScriptState(%p) (%d)", (const void *)script, stackPos(0)); _specialSceneScriptState[stackPos(0)] = 1; |