mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-24 18:56:33 +00:00
XEEN: Fix incorrect Throne sprites in Northern Sphinx
The Northern Sphinx used a list of object sprites that had an empty entry mid-list. This commit fixes the problem by allow such entries, but will only apply for new games
This commit is contained in:
parent
a595599928
commit
4b6578603d
@ -383,12 +383,24 @@ void MonsterObjectData::synchronize(XeenSerializer &s, MonsterData &monsterData)
|
||||
_wallItems.clear();
|
||||
}
|
||||
|
||||
for (uint i = 0; i < 16; ++i) {
|
||||
b = (i >= _objectSprites.size()) ? 0xff : _objectSprites[i]._spriteId;
|
||||
s.syncAsByte(b);
|
||||
if (s.isLoading() && b != 0xff)
|
||||
_objectSprites.push_back(SpriteResourceEntry(b));
|
||||
byte objSprites[16];
|
||||
int maxSprite = 0;
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
objSprites[i] = (i >= (int)_objectSprites.size()) ? 0xff : _objectSprites[i]._spriteId;
|
||||
s.syncAsByte(objSprites[i]);
|
||||
if (s.isLoading() && objSprites[i] != 0xff)
|
||||
maxSprite = i;
|
||||
}
|
||||
|
||||
if (s.isLoading()) {
|
||||
for (int i = 0; i <= maxSprite; ++i) {
|
||||
if (objSprites[i] == 0xff)
|
||||
_objectSprites.push_back(SpriteResourceEntry());
|
||||
else
|
||||
_objectSprites.push_back(SpriteResourceEntry(objSprites[i]));
|
||||
}
|
||||
}
|
||||
|
||||
for (uint i = 0; i < 16; ++i) {
|
||||
b = (i >= _monsterSprites.size()) ? 0xff : _monsterSprites[i]._spriteId;
|
||||
s.syncAsByte(b);
|
||||
@ -810,7 +822,8 @@ void Map::load(int mapId) {
|
||||
}
|
||||
|
||||
// Read in the object sprites
|
||||
_mobData._objectSprites[i]._sprites.load(filename);
|
||||
if (!_mobData._objectSprites[i].isEmpty())
|
||||
_mobData._objectSprites[i]._sprites.load(filename);
|
||||
}
|
||||
|
||||
// Load sprites for the monsters
|
||||
|
@ -319,6 +319,11 @@ public:
|
||||
|
||||
SpriteResourceEntry() { _spriteId = -1; }
|
||||
SpriteResourceEntry(int spriteId): _spriteId(spriteId) { }
|
||||
|
||||
/**
|
||||
* Returns true if no sprite id is specified
|
||||
*/
|
||||
bool isEmpty() const { return _spriteId == -1; }
|
||||
};
|
||||
private:
|
||||
XeenEngine *_vm;
|
||||
|
Loading…
Reference in New Issue
Block a user