aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-02-21 15:52:01 -0500
committerPaul Gilbert2015-02-21 15:52:01 -0500
commitdf5742eee41abe7e74a2b47a0ddcc183bf52fe09 (patch)
treebc4cec2ae69df246ad682d2ed772292acdf8f1f3
parent4f6f0fb148133df632104071185efa049c7d5fea (diff)
downloadscummvm-rg350-df5742eee41abe7e74a2b47a0ddcc183bf52fe09.tar.gz
scummvm-rg350-df5742eee41abe7e74a2b47a0ddcc183bf52fe09.tar.bz2
scummvm-rg350-df5742eee41abe7e74a2b47a0ddcc183bf52fe09.zip
MADS: Fix player animation when getting blown up by mine
-rw-r--r--engines/mads/player.cpp10
-rw-r--r--engines/mads/sprites.cpp7
2 files changed, 9 insertions, 8 deletions
diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp
index 1622031c6c..8720aeead3 100644
--- a/engines/mads/player.cpp
+++ b/engines/mads/player.cpp
@@ -240,8 +240,13 @@ void Player::updateFrame() {
return;
Scene &scene = _vm->_game->_scene;
+ assert(scene._sprites[idx] != nullptr);
SpriteAsset &spriteSet = *scene._sprites[idx];
- assert(spriteSet._charInfo);
+
+ // WORKAROUND: Certain cutscenes set up player sprites that don't have any
+ // character info. In such cases, simply ignore player updates
+ if (!spriteSet._charInfo)
+ return;
if (!spriteSet._charInfo->_numEntries) {
_frameNumber = 1;
@@ -515,8 +520,7 @@ void Player::idle() {
return;
SpriteAsset &spriteSet = *scene._sprites[idx];
- assert(spriteSet._charInfo);
- if (spriteSet._charInfo->_numEntries == 0)
+ if (spriteSet._charInfo == nullptr || spriteSet._charInfo->_numEntries == 0)
// No entries, so exit immediately
return;
diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp
index fd73930475..f74edafc93 100644
--- a/engines/mads/sprites.cpp
+++ b/engines/mads/sprites.cpp
@@ -371,16 +371,13 @@ int SpriteSets::add(SpriteAsset *asset, int idx) {
if (idx)
idx = idx + 49;
else
- idx = size();
+ idx = _assetCount++;
if (idx >= (int)size())
resize(idx + 1);
- if ((*this)[idx]) {
+ if ((*this)[idx])
delete (*this)[idx];
- } else {
- ++_assetCount;
- }
(*this)[idx] = asset;
return idx;