From 7db298ecd15c40aad2daffb5c046c67d045bef51 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Tue, 2 Jan 2007 02:46:53 +0000 Subject: workaround a scripting bug (see tracker item #1623356) svn-id: r24968 --- engines/touche/opcodes.cpp | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'engines/touche') diff --git a/engines/touche/opcodes.cpp b/engines/touche/opcodes.cpp index ad0b8b2e31..e545d9d404 100644 --- a/engines/touche/opcodes.cpp +++ b/engines/touche/opcodes.cpp @@ -760,13 +760,40 @@ void ToucheEngine::op_unlockWalkPath() { void ToucheEngine::op_addItemToInventoryAndRedraw() { debugC(9, kDebugOpcodes, "ToucheEngine::op_addItemToInventoryAndRedraw()"); - int16 inventory = _script.readNextWord(); + int16 keyChar = _script.readNextWord(); int16 item = *_script.stackDataPtr; - if (inventory == 256) { - inventory = _currentKeyCharNum; + if (keyChar == 256) { + keyChar = _currentKeyCharNum; + } + + // Workaround for bug #1623356. The original script allows you to either use the + // "waxy knife" (object 72) or the dagger (object 7) on the rope. But in both + // situations, only the dagger is put back in the inventory. + // + // [1A35] (1D) ST[0] = FLAGS[119] + // [1A38] (06) PUSH + // [1A39] (13) ST[0] = 7 + // [1A3C] (11) ST[0] = ST[1] == ST[0] + // [1A3D] (06) PUSH + // [1A3E] (1D) ST[0] = FLAGS[119] + // [1A41] (06) PUSH + // [1A42] (13) ST[0] = 72 + // [1A45] (11) ST[0] = ST[1] == ST[0] + // [1A46] (0E) OR + // [1A47] (02) JZ 0x1B1B + // [xxxx] ... + // [1B05] (13) ST[0] = 7 + // [1B08] (53) ADD_ITEM_TO_INVENTORY_AND_REDRAW(keychar=1) + + if (_currentEpisodeNum == 92 && keyChar == 1 && item == 7) { + if (_flagsTable[119] == 72) { + debug(0, "Workaround waxy knife not re-appearing in the inventory"); + item = 72; + } } - addItemToInventory(inventory, item); - if (_currentKeyCharNum == inventory && !_hideInventoryTexts) { + + addItemToInventory(keyChar, item); + if (_currentKeyCharNum == keyChar && !_hideInventoryTexts) { drawInventory(_currentKeyCharNum, 1); } } -- cgit v1.2.3