diff options
author | Paul Gilbert | 2015-01-07 08:47:24 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-01-07 08:47:24 -0500 |
commit | be53adbefc09f58325015b52b88f9290509a39f1 (patch) | |
tree | c5450787a245bfdb65d891bed6c5a7335c67276b | |
parent | fa0d7722f1c7826887b6f2b28d2d6829c77c717a (diff) | |
download | scummvm-rg350-be53adbefc09f58325015b52b88f9290509a39f1.tar.gz scummvm-rg350-be53adbefc09f58325015b52b88f9290509a39f1.tar.bz2 scummvm-rg350-be53adbefc09f58325015b52b88f9290509a39f1.zip |
XEEN: Implemented map loading of wall item sprites
-rw-r--r-- | engines/xeen/map.cpp | 44 | ||||
-rw-r--r-- | engines/xeen/map.h | 18 |
2 files changed, 51 insertions, 11 deletions
diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp index f7620b1852..fae9efe4d6 100644 --- a/engines/xeen/map.cpp +++ b/engines/xeen/map.cpp @@ -629,6 +629,24 @@ MazeObject::MazeObject() { /*------------------------------------------------------------------------*/ +MazeMonster::MazeMonster() { + _frame = 0; + _id = 0; + _refId = 0; + _hp = 0; + _effect1 = _effect2 = 0; + _effect3 = 0; +} + +/*------------------------------------------------------------------------*/ + +MazeWallItem::MazeWallItem() { + _id = 0; + _direction = DIR_NORTH; +} + +/*------------------------------------------------------------------------*/ + MonsterObjectData::MonsterObjectData(XeenEngine *vm): _vm(vm) { } @@ -636,12 +654,13 @@ void MonsterObjectData::synchronize(Common::SeekableReadStream &s, bool isOutdoors, MonsterData monsterData) { _objects.clear(); _monsters.clear(); - _wallPicIds.clear(); - _wallImages.clear(); + _wallItems.clear(); Common::Array<int> objectSprites; Common::Array<int> monsterIds; + Common::Array<int> wallPicIds; Common::Array<MobStruct> objData; Common::Array<MobStruct> monData; + Common::Array<MobStruct> wallItemData; byte b; for (int i = 0; i < 16; ++i) { @@ -654,7 +673,7 @@ void MonsterObjectData::synchronize(Common::SeekableReadStream &s, } for (int i = 0; i < 16; ++i) { if ((b = s.readByte()) != 0xff) - _wallPicIds.push_back(b); + wallPicIds.push_back(b); } MobStruct mobStruct; @@ -664,7 +683,7 @@ void MonsterObjectData::synchronize(Common::SeekableReadStream &s, monData.push_back(mobStruct); if (!isOutdoors) { while (mobStruct.synchronize(s)) - _wallImages.push_back(mobStruct); + wallItemData.push_back(mobStruct); } // Merge up objects @@ -693,6 +712,16 @@ void MonsterObjectData::synchronize(Common::SeekableReadStream &s, if (mon._animationEffect) dest._effect3 = _vm->getRandomNumber(7); } + + // Merge up wall items + _wallItems.clear(); + for (uint i = 0; i < wallItemData.size(); ++i) { + MazeWallItem &dest = _wallItems[i]; + dest._position = wallItemData[i]._pos; + dest._id = wallItemData[i]._id; + dest._refId = wallPicIds[dest._id]; + dest._direction = wallItemData[i]._direction; + } } /*------------------------------------------------------------------------*/ @@ -915,10 +944,9 @@ void Map::load(int mapId) { } // Load wall picture sprite resources - for (uint i = 0; i < _mobData._wallImages.size(); ++i) { - filename = Common::String::format("%03u.pic", _mobData._wallImages[i]._id); - // TODO: Form WallImages struct like _monsters and _objects has - //_mobData._wallImages[i]._sprites.load(filename); + for (uint i = 0; i < _mobData._wallItems.size(); ++i) { + filename = Common::String::format("%03u.pic", _mobData._wallItems[i]._refId); + _mobData._wallItems[i]._sprites.load(filename); } } diff --git a/engines/xeen/map.h b/engines/xeen/map.h index c4ab348c91..f39f2d8622 100644 --- a/engines/xeen/map.h +++ b/engines/xeen/map.h @@ -208,7 +208,7 @@ public: Direction _direction; bool _flipped; Common::Array<byte> _objBj; -public: + MazeObject(); }; @@ -222,6 +222,19 @@ struct MazeMonster { int _effect3; SpriteResource _sprites; SpriteResource _attackSprites; + + MazeMonster(); +}; + +class MazeWallItem { +public: + Common::Point _position; + int _id; + int _refId; + Direction _direction; + SpriteResource _sprites; +public: + MazeWallItem(); }; class MonsterObjectData { @@ -230,8 +243,7 @@ private: public: Common::Array<MazeObject> _objects; Common::Array<MazeMonster> _monsters; - Common::Array<int> _wallPicIds; - Common::Array<MobStruct> _wallImages; + Common::Array<MazeWallItem> _wallItems; public: MonsterObjectData(XeenEngine *vm); |