diff options
author | Florian Kagerer | 2009-05-30 14:13:27 +0000 |
---|---|---|
committer | Florian Kagerer | 2009-05-30 14:13:27 +0000 |
commit | 9823f60146bedae98f2e649e7938614390fc4525 (patch) | |
tree | 33d27aa8ccda1ca4817819f0eefb8b2cc4546b26 | |
parent | a21f34cf916e98f5d2ed558d79456a58ec9fa683 (diff) | |
download | scummvm-rg350-9823f60146bedae98f2e649e7938614390fc4525.tar.gz scummvm-rg350-9823f60146bedae98f2e649e7938614390fc4525.tar.bz2 scummvm-rg350-9823f60146bedae98f2e649e7938614390fc4525.zip |
LOL: - fixed crash that occured when entering yvel city
- added another opcode for yvel woods
svn-id: r41031
-rw-r--r-- | engines/kyra/lol.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/lol.h | 1 | ||||
-rw-r--r-- | engines/kyra/script_lol.cpp | 33 |
3 files changed, 33 insertions, 3 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index a5abd5395b..350bdc230e 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -833,7 +833,7 @@ void LoLEngine::startupNew() { _currentLevel = 1; giveCredits(41, 0); - _inventory[0] = makeItem(216, 0, 0); + _inventory[0] = makeItem(132, 0, 0); _inventory[1] = makeItem(217, 0, 0); _inventory[2] = makeItem(218, 0, 0); diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 803b17e9c6..e9a40cb79d 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -741,6 +741,7 @@ private: int olol_paralyzePoisonCharacter(EMCState *script); int olol_drawCharPortrait(EMCState *script); int olol_assignSpecialGuiShape(EMCState *script); + int olol_findInventoryItem(EMCState *script); int olol_changeItemTypeOrFlag(EMCState *script); int olol_placeInventoryItemInHand(EMCState *script); int olol_castSpell(EMCState *script); diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 188ba681ee..8633f15114 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -227,7 +227,7 @@ int LoLEngine::olol_testGameFlag(EMCState *script) { int LoLEngine::olol_loadLevelGraphics(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_loadLevelGraphics(%p) (%s, %d, %d, %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); - loadLevelGraphics(stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), (stackPos(5) == -1) ? 0 : stackPosString(5)); + loadLevelGraphics(stackPosString(0), stackPos(1), stackPos(2), (uint16)stackPos(3), (uint16)stackPos(4), (stackPos(5) == -1) ? 0 : stackPosString(5)); return 1; } @@ -1893,6 +1893,35 @@ int LoLEngine::olol_assignSpecialGuiShape(EMCState *script) { return 1; } +int LoLEngine::olol_findInventoryItem(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_findInventoryItem(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); + if (stackPos(0) == 0) { + for (int i = 0; i < 48; i++) { + if (!_inventory[i]) + continue; + if (_itemsInPlay[_inventory[i]].itemPropertyIndex == stackPos(2)) + return 0; + } + } + int cur = stackPos(1); + int last = cur; + if (stackPos(1) == -1) { + cur = 0; + last = 4; + } + for (;cur < last; cur++) { + if (!(_characters[cur].flags & 1)) + continue; + for (int i = 0; i < 11; i++) { + if (!_characters[cur].items[i]) + continue; + if (_itemsInPlay[_characters[cur].items[i]].itemPropertyIndex == stackPos(2)) + return cur; + } + } + return -1; +} + int LoLEngine::olol_changeItemTypeOrFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_changeItemTypeOrFlag(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); if (stackPos(0) < 1) @@ -2545,7 +2574,7 @@ void LoLEngine::setupOpcodeTable() { // 0xA4 Opcode(olol_assignSpecialGuiShape); - OpcodeUnImpl(); + Opcode(olol_findInventoryItem); OpcodeUnImpl(); OpcodeUnImpl(); |