diff options
author | Adrian Frühwirth | 2018-03-12 20:07:32 +0100 |
---|---|---|
committer | Adrian Frühwirth | 2018-03-17 21:00:33 +0100 |
commit | 578f9d2e5c754e49750ac854404f553790555926 (patch) | |
tree | 872d725ffa70a3e2abc130bc5b57436bae00ee29 /engines/tucker/tucker.cpp | |
parent | b7f7159f8f20615221443e77c5bc586ae43ff161 (diff) | |
download | scummvm-rg350-578f9d2e5c754e49750ac854404f553790555926.tar.gz scummvm-rg350-578f9d2e5c754e49750ac854404f553790555926.tar.bz2 scummvm-rg350-578f9d2e5c754e49750ac854404f553790555926.zip |
TUCKER: Fix incorrect transition of Lola animation
The original game unconditionally reads into _sprC02Table[] in
updateSprite() which results in out-of-bounds reads when a sprite's
_state is -1. To make sure that sprites update correctly under all
circumstances we always reset a sprite's animation data when it is
disabled (_state == -1). This most prominently fixes a bug where
Lola's transition from dancing -> sitting happens too late.
Fixes Trac#6644.
Diffstat (limited to 'engines/tucker/tucker.cpp')
-rw-r--r-- | engines/tucker/tucker.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index 56247a126d..5cd0f4af79 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -2948,7 +2948,15 @@ void TuckerEngine::updateSprite(int i) { _spritesTable[i]._animationFrame = 1; } if (_spritesTable[i]._state < 0 || !_sprC02Table[_spritesTable[i]._state]) { -// warning("Invalid state %d for sprite %d location %d", _spritesTable[i].state, i, _locationNum); + // WORKAROUND + // The original game unconditionally reads into _sprC02Table[] below which + // results in out-of-bounds reads when _spritesTable[i]._state == -1. + // We reset the sprite's animation data in this case so sprite updates + // are triggered correctly. This most prominently fixes a bug where Lola's + // transition from dancing -> sitting happens too late. + // This fixes Trac#6644. + _spritesTable[i]._animationData = nullptr; + _spritesTable[i]._firstFrame = 0; return; } _spritesTable[i]._animationData = _sprC02Table[_spritesTable[i]._state]; |