SCUMM: Add workaround for Pete Wheeler softlock

This workaround fixes a script bug in Backyard Baseball 2001 and 2003 where bunting a foul ball as Pete Wheeler may softlock the game if the ball goes far left or right field.

The original Backyard Baseball 1997 release does not seem to have this bug in my testing.
This commit is contained in:
Little Cat 2021-04-08 23:16:50 -03:00 committed by Eugene Sandulenko
parent 4a65b0d6f1
commit 71f490e550

View File

@ -1409,7 +1409,25 @@ void ScummEngine_v6::o6_getActorAnimCounter() {
void ScummEngine_v6::o6_getAnimateVariable() {
int var = pop();
Actor *a = derefActor(pop(), "o6_getAnimateVariable");
push(a->getAnimVar(var));
// WORKAROUND: In Backyard Baseball 2001 and 2003,
// bunting a foul ball as Pete Wheeler may softlock the game
// with an animation loop if the ball goes way into
// the left or right field line.
//
// This is a script bug because Pete's actor variable never
// sets to 1 in this condition and script room-4-2105
// (or room-3-2105 in 2003) will always break.
// We fix that by forcing Pete to play the return animation
// regardless if the ball's foul or not.
if ((_game.id == GID_BASEBALL2001 || _game.id == GID_BASEBALL2003) && \
_currentRoom == ((_game.id == GID_BASEBALL2001) ? 4 : 3) && \
vm.slot[_currentScript].number == 2105 && \
a->_costume == ((_game.id == GID_BASEBALL2001) ? 107 : 99) && \
readVar(0x8000 + 5) != 0)
push(1);
else
push(a->getAnimVar(var));
}
void ScummEngine_v6::o6_isActorInBox() {