diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/xeen/debugger.cpp | 4 | ||||
-rw-r--r-- | engines/xeen/map.cpp | 49 | ||||
-rw-r--r-- | engines/xeen/map.h | 8 |
3 files changed, 36 insertions, 25 deletions
diff --git a/engines/xeen/debugger.cpp b/engines/xeen/debugger.cpp index 5128aa6553..68d2c0cbd4 100644 --- a/engines/xeen/debugger.cpp +++ b/engines/xeen/debugger.cpp @@ -151,7 +151,7 @@ bool Debugger::cmdMap(int argc, const char **argv) { return true; } else { int mapId = strToInt(argv[1]); - bool side = argc < 3 ? g_vm->_files->_isDarkCc : strToInt(argv[2]) != 0; + bool side = argc < 3 ? files._isDarkCc : strToInt(argv[2]) != 0; int x = argc < 4 ? 8 : strToInt(argv[3]); int y = argc < 5 ? 8 : strToInt(argv[4]); @@ -174,7 +174,7 @@ bool Debugger::cmdPos(int argc, const char **argv) { party._mazePosition.x = strToInt(argv[1]); party._mazePosition.y = strToInt(argv[2]); party._stepped = true; - return true; + return false; } } diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp index cf7ef8245c..27b746e427 100644 --- a/engines/xeen/map.cpp +++ b/engines/xeen/map.cpp @@ -659,6 +659,12 @@ bool MobStruct::synchronize(XeenSerializer &s) { return _id != 0xff || _pos.x != -1 || _pos.y != -1; } +void MobStruct::endOfList() { + _pos.x = _pos.y = -1; + _id = 0xff; + _direction = (Direction)-1; +} + /*------------------------------------------------------------------------*/ MazeObject::MazeObject() { @@ -754,8 +760,7 @@ void MonsterObjectData::synchronize(XeenSerializer &s, MonsterData &monsterData) mobStruct._direction = _objects[i]._direction; mobStruct.synchronize(s); } - mobStruct._pos.x = mobStruct._pos.y = -1; - mobStruct._id = 0xff; + mobStruct.endOfList(); mobStruct.synchronize(s); // Save monsters @@ -765,13 +770,13 @@ void MonsterObjectData::synchronize(XeenSerializer &s, MonsterData &monsterData) mobStruct._direction = DIR_NORTH; mobStruct.synchronize(s); } - mobStruct._pos.x = mobStruct._pos.y = -1; - mobStruct._id = 0xff; + mobStruct.endOfList(); mobStruct.synchronize(s); // Save wall items if (_wallItems.size() == 0) { MobStruct nullStruct; + nullStruct._pos.x = nullStruct._pos.y = 0x80; nullStruct.synchronize(s); } else { for (uint i = 0; i < _wallItems.size(); ++i) { @@ -781,8 +786,7 @@ void MonsterObjectData::synchronize(XeenSerializer &s, MonsterData &monsterData) mobStruct.synchronize(s); } } - mobStruct._pos.x = mobStruct._pos.y = -1; - mobStruct._id = 0xff; + mobStruct.endOfList(); mobStruct.synchronize(s); } else { @@ -1421,16 +1425,6 @@ void Map::saveEvents() { fEvents.finalize(); } -void Map::saveMonsters() { - int mapId = _mazeData[0]._mazeId; - Common::String filename = Common::String::format("maze%c%03d.mob", - (mapId >= 100) ? 'x' : '0', mapId); - OutFile fMob(filename); - XeenSerializer sMob(nullptr, &fMob); - _mobData.synchronize(sMob, _monsterData); - fMob.finalize(); -} - void Map::saveMap() { FileManager &files = *g_vm->_files; Party &party = *g_vm->_party; @@ -1446,13 +1440,12 @@ void Map::saveMap() { datFile.finalize(); if (!files._isDarkCc && mapId == 15) { - MazeMonster &mon0 = _mobData._monsters[0]; - MazeMonster &mon1 = _mobData._monsters[1]; - MazeMonster &mon2 = _mobData._monsters[2]; - if ((mon0._position.x > 31 || mon0._position.y > 31) || - (mon1._position.x > 31 || mon1._position.y > 31) || - (mon2._position.x > 31 || mon2._position.y > 31)) { - party._gameFlags[0][56] = true; + for (uint idx = 0; idx < MIN(_mobData._monsters.size(), (uint)3); ++idx) { + MazeMonster &mon = _mobData._monsters[idx]; + if (mon._position.x > 31 || mon._position.y > 31) { + party._gameFlags[0][56] = true; + break; + } } } @@ -1472,6 +1465,16 @@ void Map::saveMap() { } } +void Map::saveMonsters() { + int mapId = _mazeData[0]._mazeId; + Common::String filename = Common::String::format("maze%c%03d.mob", + (mapId >= 100) ? 'x' : '0', mapId); + OutFile fMob(filename); + XeenSerializer sMob(nullptr, &fMob); + _mobData.synchronize(sMob, _monsterData); + fMob.finalize(); +} + void Map::saveMaze() { int mazeNum = _mazeData[0]._mazeNumber; if (!mazeNum || (mazeNum == 85 && !_vm->_files->_isDarkCc)) diff --git a/engines/xeen/map.h b/engines/xeen/map.h index 6734f3f16c..fe626858c8 100644 --- a/engines/xeen/map.h +++ b/engines/xeen/map.h @@ -233,7 +233,15 @@ public: public: MobStruct(); + /** + * Synchronizes the data for the item + */ bool synchronize(XeenSerializer &s); + + /** + * Sets up the entry as an end of list marker + */ + void endOfList(); }; struct MazeObject { |