aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Kagerer2009-06-05 21:34:18 +0000
committerFlorian Kagerer2009-06-05 21:34:18 +0000
commit90ee879d89ad974df64a5119ae92d40141309496 (patch)
tree91010c0ddca5db726fcb9431aad5b56be89e49c4
parent7c84cca81d4fd7eeadd3d6903d80e1e856c2d5a0 (diff)
downloadscummvm-rg350-90ee879d89ad974df64a5119ae92d40141309496.tar.gz
scummvm-rg350-90ee879d89ad974df64a5119ae92d40141309496.tar.bz2
scummvm-rg350-90ee879d89ad974df64a5119ae92d40141309496.zip
LOL: implemented another opcode
svn-id: r41199
-rw-r--r--engines/kyra/lol.h1
-rw-r--r--engines/kyra/script_lol.cpp27
2 files changed, 27 insertions, 1 deletions
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 87df7de47c..3b5c862141 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -771,6 +771,7 @@ private:
int olol_getNextActiveCharacter(EMCState *script);
int olol_paralyzePoisonCharacter(EMCState *script);
int olol_drawCharPortrait(EMCState *script);
+ int olol_removeInventoryItem(EMCState *script);
int olol_getAnimationLastPart(EMCState *script);
int olol_assignSpecialGuiShape(EMCState *script);
int olol_findInventoryItem(EMCState *script);
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index 75651a2a9a..33edfa0e24 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -1896,6 +1896,31 @@ int LoLEngine::olol_drawCharPortrait(EMCState *script) {
return 1;
}
+int LoLEngine::olol_removeInventoryItem(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_removeInventoryItem(%p) (%d)", (const void *)script, stackPos(0));
+ int itemType = stackPos(0);
+ for (int i = 0; i < 48; i++) {
+ if (!_inventory[i] || _itemsInPlay[_inventory[i]].itemPropertyIndex != itemType)
+ continue;
+ _inventory[i] = 0;
+ gui_drawInventory();
+ return 1;
+ }
+
+ for (int i = 0; i < 4; i++) {
+ if (!(_characters[i].flags & 1))
+ continue;
+
+ for (int ii = 0; ii < 11; ii++) {
+ if (!_characters[i].items[ii] || _itemsInPlay[_characters[i].items[ii]].itemPropertyIndex != itemType)
+ continue;
+ _characters[i].items[ii] = 0;
+ return 1;
+ }
+ }
+ return 0;
+}
+
int LoLEngine::olol_getAnimationLastPart(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_getAnimationLastPart(%p) (%d)", (const void *)script, stackPos(0));
return _tim->resetAnimationLastPart(stackPos(0));
@@ -2730,7 +2755,7 @@ void LoLEngine::setupOpcodeTable() {
Opcode(olol_drawCharPortrait);
// 0xA0
- OpcodeUnImpl();
+ Opcode(olol_removeInventoryItem);
OpcodeUnImpl();
OpcodeUnImpl();
Opcode(olol_getAnimationLastPart);