diff options
author | Paul Gilbert | 2015-01-11 18:29:36 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-01-11 18:29:36 -0500 |
commit | 892a504009e0d7d6d6304d485bf2fad9519781e9 (patch) | |
tree | c93772ef32327ee6cf0c1e054b65089950748d22 /engines/xeen/map.cpp | |
parent | 4745bfe182fa0824aee2525ff196d93060c2cd0c (diff) | |
download | scummvm-rg350-892a504009e0d7d6d6304d485bf2fad9519781e9.tar.gz scummvm-rg350-892a504009e0d7d6d6304d485bf2fad9519781e9.tar.bz2 scummvm-rg350-892a504009e0d7d6d6304d485bf2fad9519781e9.zip |
XEEN: Implemented loading of object animation data
Diffstat (limited to 'engines/xeen/map.cpp')
-rw-r--r-- | engines/xeen/map.cpp | 53 |
1 files changed, 48 insertions, 5 deletions
diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp index c70b0cfe6d..836680c24f 100644 --- a/engines/xeen/map.cpp +++ b/engines/xeen/map.cpp @@ -809,6 +809,49 @@ void HeadData::synchronize(Common::SeekableReadStream &s) { /*------------------------------------------------------------------------*/ +/** + * Synchronize data for an entry within an animation entry + */ +void AnimationFrame::synchronize(Common::SeekableReadStream &s) { + _left = s.readByte(); + _back = s.readByte(); + _right = s.readByte(); + _front = s.readByte(); +} + +/** + * Synchronize data for an animation entry + */ +void AnimationEntry::synchronize(Common::SeekableReadStream &s) { + _frame1.synchronize(s); + _flipped.synchronize(s); + _frame2.synchronize(s); +} + +/** + * Synchronize data for object animations within the game + */ +void AnimationInfo::synchronize(Common::SeekableReadStream &s) { + AnimationEntry entry; + + clear(); + while (s.pos() < s.size()) { + entry.synchronize(s); + push_back(entry); + } +} + +/** + * Load the animation info objects in the game + */ +void AnimationInfo::load(const Common::String &name) { + File f(name); + synchronize(f); + f.close(); +} + +/*------------------------------------------------------------------------*/ + Map::Map(XeenEngine *vm) : _vm(vm), _mobData(vm) { _townPortalSide = 0; _sideObj = 0; @@ -849,7 +892,7 @@ void Map::load(int mapId) { if (_vm->getGameID() == GType_WorldOfXeen) { if (_vm->_loadDarkSide) { - _objPicSprites.load("clouds.dat"); + _animationInfo.load("clouds.dat"); _monsterData.load("xeen.mon"); _wallPicSprites.load("xeenpic.dat"); } else { @@ -859,7 +902,7 @@ void Map::load(int mapId) { case 115: case 116: case 128: - _objPicSprites.load("clouds.dat"); + _animationInfo.load("clouds.dat"); _monsterData.load("dark.mon"); _wallPicSprites.load("darkpic.dat"); _sideObj = 0; @@ -869,7 +912,7 @@ void Map::load(int mapId) { case 119: case 120: case 124: - _objPicSprites.load("clouds.dat"); + _animationInfo.load("clouds.dat"); _monsterData.load("xeen.mon"); _wallPicSprites.load("darkpic.dat"); _sideObj = 0; @@ -878,12 +921,12 @@ void Map::load(int mapId) { case 125: case 126: case 127: - _objPicSprites.load("clouds.dat"); + _animationInfo.load("clouds.dat"); _monsterData.load("dark.mon"); _wallPicSprites.load("xeenpic.dat"); break; default: - _objPicSprites.load("dark.dat"); + _animationInfo.load("dark.dat"); _monsterData.load("ddark.mon"); _wallPicSprites.load("darkpic.dat"); break; |