diff options
author | Paul Gilbert | 2018-01-24 08:03:32 -0500 |
---|---|---|
committer | Paul Gilbert | 2018-01-24 08:03:32 -0500 |
commit | 266c17ab8c70e5a47fb1ee9110a7afac776b8c8f (patch) | |
tree | 6b1153fef146958902d90b1ef29b9624286d2a57 /engines | |
parent | 5551241c516f40bbc52960e46236a9e79561b87a (diff) | |
download | scummvm-rg350-266c17ab8c70e5a47fb1ee9110a7afac776b8c8f.tar.gz scummvm-rg350-266c17ab8c70e5a47fb1ee9110a7afac776b8c8f.tar.bz2 scummvm-rg350-266c17ab8c70e5a47fb1ee9110a7afac776b8c8f.zip |
XEEN: Fix map loading for Shangri-la
Diffstat (limited to 'engines')
-rw-r--r-- | engines/xeen/map.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp index b7f573c6f5..ec58a0f14d 100644 --- a/engines/xeen/map.cpp +++ b/engines/xeen/map.cpp @@ -799,8 +799,13 @@ void MonsterObjectData::synchronize(XeenSerializer &s, MonsterData &monsterData) obj._id = mobStruct._id; obj._direction = mobStruct._direction; obj._frame = 100; - obj._spriteId = _objectSprites[obj._id]._spriteId; - obj._sprites = &_objectSprites[obj._id]._sprites; + + if (obj._id < (int)_objectSprites.size()) { + obj._spriteId = _objectSprites[obj._id]._spriteId; + obj._sprites = &_objectSprites[obj._id]._sprites; + } else { + assert(!obj._id); + } _objects.push_back(obj); mobStruct.synchronize(s); @@ -812,12 +817,17 @@ void MonsterObjectData::synchronize(XeenSerializer &s, MonsterData &monsterData) MazeMonster mon; mon._position = mobStruct._pos; mon._id = mobStruct._id; - mon._spriteId = _monsterSprites[mon._id]._spriteId; - mon._sprites = &_monsterSprites[mon._id]._sprites; - mon._attackSprites = &_monsterSprites[mon._id]._attackSprites; mon._monsterData = &monsterData[mon._spriteId]; mon._frame = _vm->getRandomNumber(7); + if (mon._id < (int)_monsterSprites.size()) { + mon._spriteId = _monsterSprites[mon._id]._spriteId; + mon._sprites = &_monsterSprites[mon._id]._sprites; + mon._attackSprites = &_monsterSprites[mon._id]._attackSprites; + } else { + assert(!mon._id); + } + MonsterStruct &md = *mon._monsterData; mon._hp = md._hp; mon._effect1 = mon._effect2 = md._animationEffect; |