MADS: Fix player animation when getting blown up by mine

This commit is contained in:
Paul Gilbert 2015-02-21 15:52:01 -05:00
parent 4f6f0fb148
commit df5742eee4
2 changed files with 9 additions and 8 deletions

View File

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

View File

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