diff options
author | Paul Gilbert | 2019-08-26 20:26:54 -0700 |
---|---|---|
committer | Paul Gilbert | 2019-08-26 20:27:05 -0700 |
commit | 87c3e6d5d37ec5ee8d9f4062058cc7b1ae8e01bb (patch) | |
tree | b4a4fb69bf19a5d68e03a5ac57fbcc64e00b2b46 /engines/xeen/map.cpp | |
parent | e65001405b79ec5eae56657b0ca5e2258c46872a (diff) | |
download | scummvm-rg350-87c3e6d5d37ec5ee8d9f4062058cc7b1ae8e01bb.tar.gz scummvm-rg350-87c3e6d5d37ec5ee8d9f4062058cc7b1ae8e01bb.tar.bz2 scummvm-rg350-87c3e6d5d37ec5ee8d9f4062058cc7b1ae8e01bb.zip |
XEEN: Fix removing Paladin rocks in Dark Side desert
Diffstat (limited to 'engines/xeen/map.cpp')
-rw-r--r-- | engines/xeen/map.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp index f2a9395b28..bc5d55f1fc 100644 --- a/engines/xeen/map.cpp +++ b/engines/xeen/map.cpp @@ -730,7 +730,7 @@ void Map::load(int mapId) { // mazes in each of the four cardinal directions int ccNum = files._ccNum; MazeData *mazeDataP = &_mazeData[0]; - bool textLoaded = false; + bool mapDataLoaded = false; for (int idx = 0; idx < 9; ++idx, ++mazeDataP) { mazeDataP->_mazeId = mapId; @@ -755,14 +755,14 @@ void Map::load(int mapId) { _isOutdoors = (mazeDataP->_mazeFlags2 & FLAG_IS_OUTDOORS) != 0; - // Handle loading text data - if (!textLoaded) { - textLoaded = true; + Common::String mobName = Common::String::format("maze%c%03d.mob", (mapId >= 100) ? 'x' : '0', mapId); + + if (!mapDataLoaded) { + // Called once for the main map being loaded + mapDataLoaded = true; _mazeName = getMazeName(mapId, ccNum); // Load the monster/object data - Common::String mobName = Common::String::format("maze%c%03d.mob", - (mapId >= 100) ? 'x' : '0', mapId); File mobFile(mobName); XeenSerializer sMob(&mobFile, nullptr); _mobData.synchronize(sMob, _monsterData); @@ -781,6 +781,20 @@ void Map::load(int mapId) { party._gameFlags[0][56] = true; } } + } else if (File::exists(mobName)) { + // For surrounding maps, set up flags for whether objects are present + // Load the monster/object data + File mobFile(mobName); + XeenSerializer sMob(&mobFile, nullptr); + MonsterObjectData mobData(_vm); + mobData.synchronize(sMob, _monsterData); + mobFile.close(); + + mazeDataP->_objectsPresent.resize(mobData._objects.size()); + for (uint objIndex = 0; objIndex < mobData._objects.size(); ++objIndex) { + const Common::Point &pt = mobData._objects[objIndex]._position; + mazeDataP->_objectsPresent[objIndex] = ABS(pt.x) != 128 && ABS(pt.y) != 128; + } } } |