diff options
author | Johannes Schickel | 2008-03-16 13:39:40 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-03-16 13:39:40 +0000 |
commit | 3bfa70bc3e2bc080cae30e06d023b5cd4de678e0 (patch) | |
tree | 4ea9eea7b428a3c5df09736bd115635289fe0910 | |
parent | 2a95c653ebccc354cdda601f61b63eb2a48216f5 (diff) | |
download | scummvm-rg350-3bfa70bc3e2bc080cae30e06d023b5cd4de678e0.tar.gz scummvm-rg350-3bfa70bc3e2bc080cae30e06d023b5cd4de678e0.tar.bz2 scummvm-rg350-3bfa70bc3e2bc080cae30e06d023b5cd4de678e0.zip |
Implemented opcode 30: o2_addItemToCurScene
svn-id: r31140
-rw-r--r-- | engines/kyra/kyra_v2.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_v2.h | 1 | ||||
-rw-r--r-- | engines/kyra/script_v2.cpp | 22 |
3 files changed, 24 insertions, 1 deletions
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 12743311d2..304da30cf9 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -2117,7 +2117,7 @@ void KyraEngine_v2::setupOpcodeTable() { // 0x1c OpcodeUnImpl(), OpcodeUnImpl(), - OpcodeUnImpl(), + Opcode(o2_addItemToCurScene), OpcodeUnImpl(), // 0x20 Opcode(o2_checkForItem), diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index dc8f19d19e..4f82556582 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -952,6 +952,7 @@ protected: int o2_wsaOpen(ScriptState *script); int o2_displayWsaSequentialFrames(ScriptState *script); int o2_displayWsaSequence(ScriptState *script); + int o2_addItemToCurScene(ScriptState *script); int o2_checkForItem(ScriptState *script); int o2_defineItem(ScriptState *script); int o2_removeItemFromInventory(ScriptState *script); diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp index e46fdc0ed5..d45f07c360 100644 --- a/engines/kyra/script_v2.cpp +++ b/engines/kyra/script_v2.cpp @@ -311,6 +311,28 @@ int KyraEngine_v2::o2_displayWsaSequence(ScriptState *script) { return 0; } +int KyraEngine_v2::o2_addItemToCurScene(ScriptState *script) { + debugC(3, kDebugLevelScriptFuncs, "o2_addItemToCurScene(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); + const int16 id = stackPos(0); + int x = stackPos(1); + int y = stackPos(2); + + int freeItem = findFreeItem(); + x = MAX(14, x); + x = MIN(304, x); + y = MAX(14, y); + y = MIN(136, y); + if (freeItem >= 0) { + _itemList[freeItem].id = id; + _itemList[freeItem].x = x; + _itemList[freeItem].y = y; + _itemList[freeItem].sceneId = _mainCharacter.sceneId; + addItemToAnimList(freeItem); + refreshAnimObjectsIfNeed(); + } + 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; |