diff options
author | athrxx | 2011-06-19 00:58:16 +0200 |
---|---|---|
committer | athrxx | 2011-06-19 00:59:16 +0200 |
commit | 48e5bd36e9722d87787d077e34ca28a454cc14f1 (patch) | |
tree | 8a3c224a9b3d7546702f6a9b875fec903412b6f1 /engines/kyra | |
parent | 0246bdf74ea815623e9997b84b88d26b6ef075cf (diff) | |
download | scummvm-rg350-48e5bd36e9722d87787d077e34ca28a454cc14f1.tar.gz scummvm-rg350-48e5bd36e9722d87787d077e34ca28a454cc14f1.tar.bz2 scummvm-rg350-48e5bd36e9722d87787d077e34ca28a454cc14f1.zip |
LOL: fix bug reported on forum
In cases where the script failed to delete a certain character from the party (because that character was not a party member) it would add this character to the party instead. E.g. when returning to Gladstone without having picked up Timothy, he would get added to the party after the throne room scene. The same happened with Lora at the Draracle if she wasn't picked up on the way.
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/lol.h | 2 | ||||
-rw-r--r-- | engines/kyra/script_lol.cpp | 34 |
2 files changed, 15 insertions, 21 deletions
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 943bb7f8d5..06a4f29f63 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -717,7 +717,7 @@ private: int olol_setScriptTimer(EMCState *script); int olol_createHandItem(EMCState *script); int olol_playAttackSound(EMCState *script); - int olol_characterJoinsParty(EMCState *script); + int olol_addRemoveCharacter(EMCState *script); int olol_giveItem(EMCState *script); int olol_loadTimScript(EMCState *script); int olol_runTimScript(EMCState *script); diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 695528b8d1..1afefcffa4 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -1088,33 +1088,27 @@ int LoLEngine::olol_playAttackSound(EMCState *script) { return 1; } -int LoLEngine::olol_characterJoinsParty(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_characterJoinsParty(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); +int LoLEngine::olol_addRemoveCharacter(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_addRemoveCharacter(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); int16 id = stackPos(0); - if (id < 0) + if (id < 0) { id = -id; + for (int i = 0; i < 4; i++) { + if (!(_characters[i].flags & 1) || _characters[i].id != id) + continue; - for (int i = 0; i < 4; i++) { - if (!(_characters[i].flags & 1) || _characters[i].id != id) - continue; - - _characters[i].flags &= 0xfffe; - calcCharPortraitXpos(); + _characters[i].flags &= 0xfffe; + calcCharPortraitXpos(); - if (!_updateFlags) { - gui_enableDefaultPlayfieldButtons(); - gui_drawPlayField(); + if (_selectedCharacter == i) + _selectedCharacter = 0; + break; } - - if (_selectedCharacter == i) - _selectedCharacter = 0; - - return 1; + } else { + addCharacter(id); } - addCharacter(id); - if (!_updateFlags) { gui_enableDefaultPlayfieldButtons(); gui_drawPlayField(); @@ -2823,7 +2817,7 @@ void LoLEngine::setupOpcodeTable() { Opcode(olol_setScriptTimer); Opcode(olol_createHandItem); Opcode(olol_playAttackSound); - Opcode(olol_characterJoinsParty); + Opcode(olol_addRemoveCharacter); // 0x4C Opcode(olol_giveItem); |