diff options
author | Paul Gilbert | 2015-01-18 08:57:23 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-01-18 08:57:23 -0500 |
commit | 258ab0209679a84e0e8ef96718fe442dd47e2d7d (patch) | |
tree | c4f5769d9a2929f34b980dad5c3c3879c2ed50e4 | |
parent | b860745a8e1a89bfd34e1c3f263597bef59126ca (diff) | |
download | scummvm-rg350-258ab0209679a84e0e8ef96718fe442dd47e2d7d.tar.gz scummvm-rg350-258ab0209679a84e0e8ef96718fe442dd47e2d7d.tar.bz2 scummvm-rg350-258ab0209679a84e0e8ef96718fe442dd47e2d7d.zip |
XEEN: Load sprites from the correct archive
-rw-r--r-- | engines/xeen/files.cpp | 17 | ||||
-rw-r--r-- | engines/xeen/files.h | 2 | ||||
-rw-r--r-- | engines/xeen/interface_map.cpp | 4 | ||||
-rw-r--r-- | engines/xeen/map.cpp | 37 | ||||
-rw-r--r-- | engines/xeen/map.h | 5 | ||||
-rw-r--r-- | engines/xeen/sprites.cpp | 9 | ||||
-rw-r--r-- | engines/xeen/sprites.h | 4 |
7 files changed, 60 insertions, 18 deletions
diff --git a/engines/xeen/files.cpp b/engines/xeen/files.cpp index 8ab1f35fcb..f15a08b184 100644 --- a/engines/xeen/files.cpp +++ b/engines/xeen/files.cpp @@ -198,11 +198,22 @@ Common::SeekableReadStream *CCArchive::createReadStreamForMember(const Common::S */ FileManager::FileManager(XeenEngine *vm) { Common::File f; + int sideNum = 0; _isDarkCc = vm->getGameID() != GType_Clouds; - if (_isDarkCc) - SearchMan.add("dark", new CCArchive("dark.cc", "dark", true)); - SearchMan.add("xeen", new CCArchive("xeen.cc", "xeen", true)); + _sideArchives[0] = _sideArchives[1] = nullptr; + + if (vm->getGameID() != GType_DarkSide) { + _sideArchives[0] = new CCArchive("xeen.cc", "xeen", true); + SearchMan.add("xeen", _sideArchives[0]); + sideNum = 1; + } + + if (vm->getGameID() == GType_DarkSide || vm->getGameID() == GType_WorldOfXeen) { + _sideArchives[sideNum] = new CCArchive("dark.cc", "dark", true); + SearchMan.add("dark", _sideArchives[sideNum]); + } + SearchMan.add("intro", new CCArchive("intro.cc", "intro", true)); } diff --git a/engines/xeen/files.h b/engines/xeen/files.h index a8343c1653..f350e34166 100644 --- a/engines/xeen/files.h +++ b/engines/xeen/files.h @@ -33,6 +33,7 @@ namespace Xeen { class XeenEngine; +class CCArchive; #define SYNC_AS(SUFFIX,STREAM,TYPE,SIZE) \ template<typename T> \ @@ -53,6 +54,7 @@ class XeenEngine; class FileManager { public: bool _isDarkCc; + CCArchive *_sideArchives[2]; public: FileManager(XeenEngine *vm); diff --git a/engines/xeen/interface_map.cpp b/engines/xeen/interface_map.cpp index ba6288eacb..1310e19950 100644 --- a/engines/xeen/interface_map.cpp +++ b/engines/xeen/interface_map.cpp @@ -855,7 +855,7 @@ void InterfaceMap::setIndoorsObjects() { } else if (_wo[22] && _wo[24]) { } else if (_wo[21] && _wo[19]) { } else if (_wo[24] && _wo[19]) { - } else if (!_wo[14] && !_wo[10] && !_indoorList._objects11._frame == -1) { + } else if (!_wo[14] && !_wo[10] && _indoorList._objects11._frame == -1) { _indoorList._objects11._x = INDOOR_OBJECT_X[listOffset][11]; _indoorList._objects11._y = INDOOR_OBJECT_Y[listOffset][11]; _indoorList._objects11._frame = mazeObject._frame; @@ -1948,6 +1948,8 @@ void InterfaceMap::drawIndoors() { _charsShooting = _isShooting; // TODO + SpriteResource *spr = _vm->_map->_mobData._objects[41]._sprites; + spr->draw(*_vm->_screen, 0); } } // End of namespace Xeen diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp index 86f60852f6..10143edec3 100644 --- a/engines/xeen/map.cpp +++ b/engines/xeen/map.cpp @@ -850,8 +850,9 @@ void AnimationInfo::load(const Common::String &name) { Map::Map(XeenEngine *vm) : _vm(vm), _mobData(vm) { _townPortalSide = 0; - _sideObj = 0; - _sideMon = 0; + _sideObjects = 0; + _sideMonsters = 0; + _sidePictures = 0; _isOutdoors = false; _stepped = false; _mazeDataIndex = 0; @@ -871,6 +872,7 @@ void Map::load(int mapId) { Screen &screen = *_vm->_screen; IndoorDrawList &indoorList = _vm->_interface->_indoorList; OutdoorDrawList &outdoorList = _vm->_interface->_outdoorList; + int sideNumber = 0; if (_vm->_falling) { Window &w = screen._windows[9]; @@ -884,7 +886,9 @@ void Map::load(int mapId) { _vm->_party._mazeId = mapId; _vm->_events->clearEvents(); - + _sideObjects = 1; + _sideMonsters = 1; + _sidePictures = 1; if (mapId >= 113 && mapId <= 127) { _townPortalSide = 0; } else { @@ -896,6 +900,9 @@ void Map::load(int mapId) { _animationInfo.load("clouds.dat"); _monsterData.load("xeen.mon"); _wallPicSprites.load("xeenpic.dat"); + _sidePictures = 0; + _sideMonsters = 0; + _sideObjects = 0; } else { switch (mapId) { case 113: @@ -906,7 +913,7 @@ void Map::load(int mapId) { _animationInfo.load("clouds.dat"); _monsterData.load("dark.mon"); _wallPicSprites.load("darkpic.dat"); - _sideObj = 0; + _sideObjects = 0; break; case 117: case 118: @@ -916,8 +923,8 @@ void Map::load(int mapId) { _animationInfo.load("clouds.dat"); _monsterData.load("xeen.mon"); _wallPicSprites.load("darkpic.dat"); - _sideObj = 0; - _sideMon = 0; + _sideObjects = 0; + _sideMonsters = 0; break; case 125: case 126: @@ -925,6 +932,8 @@ void Map::load(int mapId) { _animationInfo.load("clouds.dat"); _monsterData.load("dark.mon"); _wallPicSprites.load("xeenpic.dat"); + _sideObjects = 0; + _sidePictures = 0; break; default: _animationInfo.load("dark.dat"); @@ -1034,28 +1043,34 @@ void Map::load(int mapId) { filename = "085.obj"; _mobData._objectSprites[0]._spriteId = 85; } else { - filename = Common::String::format("%03d.%cbj", + filename = Common::String::format("xeen|%03d.%cbj", _mobData._objectSprites[i]._spriteId, _mobData._objectSprites[i]._spriteId >= 100 ? '0' : 'o'); } // Read in the object sprites - _mobData._objectSprites[i]._sprites.load(filename); + _mobData._objectSprites[i]._sprites.load(filename, + *_vm->_files->_sideArchives[_sideObjects]); } // Load sprites for the monsters for (uint i = 0; i < _mobData._monsterSprites.size(); ++i) { + CCArchive *archive = _vm->_files->_sideArchives[ + _mobData._monsterSprites[i]._spriteId == 91 && _vm->getGameID() == GType_WorldOfXeen ? + 0 : _sideMonsters]; + filename = Common::String::format("%03d.mon", _mobData._monsterSprites[i]._spriteId); - _mobData._monsterSprites[i]._sprites.load(filename); + _mobData._monsterSprites[i]._sprites.load(filename, *archive); filename = Common::String::format("%03d.att", _mobData._monsterSprites[i]._spriteId); - _mobData._monsterSprites[i]._attackSprites.load(filename); + _mobData._monsterSprites[i]._attackSprites.load(filename, *archive); } // Load wall picture sprite resources for (uint i = 0; i < _mobData._wallItemSprites.size(); ++i) { filename = Common::String::format("%03d.pic", _mobData._wallItems[i]._spriteId); - _mobData._wallItemSprites[i]._sprites.load(filename); + _mobData._wallItemSprites[i]._sprites.load(filename, + *_vm->_files->_sideArchives[_sidePictures]); } // Handle loading miscellaneous sprites for the map diff --git a/engines/xeen/map.h b/engines/xeen/map.h index 8e6fee2811..5c3e5a3fed 100644 --- a/engines/xeen/map.h +++ b/engines/xeen/map.h @@ -356,8 +356,9 @@ private: Common::String _mazeName; SpriteResource _wallPicSprites; int _townPortalSide; - int _sideObj; - int _sideMon; + int _sidePictures; + int _sideObjects; + int _sideMonsters; bool _stepped; int _mazeDataIndex; bool _currentSteppedOn; diff --git a/engines/xeen/sprites.cpp b/engines/xeen/sprites.cpp index 85ca91bde3..8a14ec0178 100644 --- a/engines/xeen/sprites.cpp +++ b/engines/xeen/sprites.cpp @@ -59,9 +59,16 @@ SpriteResource &SpriteResource::operator=(const SpriteResource &src) { } void SpriteResource::load(const Common::String &filename) { - // Open the resource File f(filename); + load(f); +} + +void SpriteResource::load(const Common::String &filename, Common::Archive &archive) { + File f(filename, archive); + load(f); +} +void SpriteResource::load(Common::SeekableReadStream &f) { // Read in a copy of the file _filesize = f.size(); delete[] _data; diff --git a/engines/xeen/sprites.h b/engines/xeen/sprites.h index c240059c15..973875cfed 100644 --- a/engines/xeen/sprites.h +++ b/engines/xeen/sprites.h @@ -45,6 +45,8 @@ private: int32 _filesize; byte *_data; + void load(Common::SeekableReadStream &f); + void drawOffset(XSurface &dest, uint16 offset, const Common::Point &destPos, int flags) const; public: SpriteResource(); @@ -56,6 +58,8 @@ public: void load(const Common::String &filename); + void load(const Common::String &filename, Common::Archive &archive); + void clear(); void draw(XSurface &dest, int frame, const Common::Point &destPos, int flags = 0) const; |