SCUMM: Fix bug #13196 - Invalid phrase with GIVE crashes Monkey EGA Demo

* SCUMM: Fix Invalid phrase with GIVE crashes Monkey Island EGA Demo
* SCUMM: Suggested changes on Pull #3731
* SCUMM: specify game id in Pull #3731
* SCUMM: seperated AMIGA monkey VGA and VGA Demo variants. Assigned GF_DEMO flags
This commit is contained in:
Pragyansh Chaturvedi 2022-03-07 15:58:09 +05:30 committed by GitHub
parent c569f4b40d
commit 34bc417d12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 4 deletions

View file

@ -882,6 +882,23 @@ void ScummEngine_v5::o5_doSentence() {
int objectA = getVarOrDirectWord(PARAM_2);
int objectB = getVarOrDirectWord(PARAM_3);
// HACK: breath mint(object 458) should only be given to actors.
// Giving it to non-actor objects crashes the game.
// The sentence doesn't run a script if the recipient is not an actor.
// Trac #13196
// This bug occurred always when breath mint was given to non-actor objects
// and sometimes when other non actor objects were given to breathe mint
// Giving pot or red herring to breath mint triggered the bug as these two objects' scripts
// reverse the sentence (in case if the user had reversed the items), effectively making the sentence
// such that the breath mint is being given to the pot/red herring.
// But giving hunk o' meat to breath mint didn't trigger the bug as such reversal is not done
// by hunk o' meat's script.
if (((_game.id == GID_MONKEY_VGA && (_game.features & GF_DEMO)) ||
(_game.id == GID_MONKEY_EGA && (_game.features & GF_DEMO)))
&& verb == 3 && objectA == 458 && !isValidActor(objectB))
return;
doSentence(verb, objectA, objectB);
}