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.
This commit is contained in:
athrxx 2011-06-19 00:58:16 +02:00
parent 0246bdf74e
commit 48e5bd36e9
2 changed files with 15 additions and 21 deletions

View File

@ -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);

View File

@ -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);