mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 09:23:37 +00:00
XEEN: Fix removing Paladin rocks in Dark Side desert
This commit is contained in:
parent
e65001405b
commit
87c3e6d5d3
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,6 +208,7 @@ public:
|
||||
int _tavernTips;
|
||||
bool _seenTiles[MAP_HEIGHT][MAP_WIDTH];
|
||||
bool _steppedOnTiles[MAP_HEIGHT][MAP_WIDTH];
|
||||
Common::Array<bool> _objectsPresent;
|
||||
|
||||
// Misc fields
|
||||
int _mazeId;
|
||||
@ -508,6 +509,11 @@ public:
|
||||
*/
|
||||
MazeData &mazeData() { return _mazeData[0]; }
|
||||
|
||||
/**
|
||||
* Returns the data for the primary active map
|
||||
*/
|
||||
const MazeData *mazeDataSurrounding() { return _mazeData; }
|
||||
|
||||
/**
|
||||
* Returns the data for the currently indexed map
|
||||
*/
|
||||
|
@ -35,6 +35,14 @@ struct ScriptEntry {
|
||||
const byte *_data;
|
||||
};
|
||||
|
||||
struct ObjectEntry {
|
||||
int _gameId; ///< Game Id
|
||||
int _removeMazeId; ///< Maze Id of copy to remove
|
||||
int _removeObjNumber; ///< Object number of copy to remove
|
||||
int _refMazeId; ///< Reference object maze id
|
||||
int _refObjNumber; ///< Reference object's number
|
||||
};
|
||||
|
||||
const byte DS_MAP54_LINE8[] = { 8, 10, 10, DIR_EAST, 8, OP_MoveWallObj, 20, 100, 100 };
|
||||
const byte SW_MAP53_LINE8[] = { 5, 14, 6, DIR_EAST, 8, OP_Exit };
|
||||
const byte DS_MAP116[] = { 9, 10, 6, 4, 2, OP_TakeOrGive, 0, 0, 103, 127 };
|
||||
@ -50,6 +58,21 @@ static const ScriptEntry SCRIPT_PATCHES[] = {
|
||||
{ GType_DarkSide, 62, DS_MAP62_PIT2 } // Fix fall position for pit
|
||||
};
|
||||
|
||||
// List of objects that that need to be removed. Most of these are for copies of objects that appear in
|
||||
// the distance on the edge of other maps, so they don't simply pop into existance when the map changes.
|
||||
// When the main object is removed, the original didn't properly also removie the object copies
|
||||
#define REMOVE_OBJECTS_COUNT 6
|
||||
static const ObjectEntry REMOVE_OBJECTS[] = {
|
||||
// Floating statue in the distance off SE corner of map
|
||||
{ GType_Clouds, 24, 15, 0, 0 },
|
||||
// Desert Paladin stones
|
||||
{ GType_DarkSide, 10, 9, 14, 1 },
|
||||
{ GType_DarkSide, 11, 5, 10, 0 },
|
||||
{ GType_DarkSide, 15, 5, 14, 4 },
|
||||
{ GType_DarkSide, 15, 6, 14, 5 },
|
||||
{ GType_DarkSide, 10, 10, 14, 5 }
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
void Patcher::patch() {
|
||||
@ -94,11 +117,36 @@ void Patcher::patchObjects() {
|
||||
FileManager &files = *g_vm->_files;
|
||||
Map &map = *g_vm->_map;
|
||||
Party &party = *g_vm->_party;
|
||||
const MazeData *mapData = map.mazeDataSurrounding();
|
||||
|
||||
if ((g_vm->getGameID() == GType_Clouds || (g_vm->getGameID() == GType_WorldOfXeen && !files._ccNum)) &&
|
||||
party._mazeId == 24) {
|
||||
// Remove floating statue in the distance off SE corner of Clouds of Xeen map
|
||||
map._mobData._objects[15]._position = Common::Point(-128, -128);
|
||||
int gameId = g_vm->getGameID();
|
||||
if (gameId == GType_WorldOfXeen)
|
||||
gameId = files._ccNum ? GType_DarkSide : GType_Clouds;
|
||||
|
||||
for (int roCtr = 0; roCtr < REMOVE_OBJECTS_COUNT; ++roCtr) {
|
||||
const ObjectEntry &oe = REMOVE_OBJECTS[roCtr];
|
||||
if (oe._gameId != gameId || oe._removeMazeId != party._mazeId)
|
||||
continue;
|
||||
|
||||
MazeObject &mazeObj = map._mobData._objects[oe._removeObjNumber];
|
||||
|
||||
// If specified object has a linked reference object, we need to check if it's removed
|
||||
if (oe._refMazeId) {
|
||||
int mazeIndex = -1;
|
||||
while (++mazeIndex < 9) {
|
||||
if (mapData[mazeIndex]._mazeId == oe._refMazeId)
|
||||
break;
|
||||
}
|
||||
if (mazeIndex == 9)
|
||||
error("Could not find specified reference maze in object patcher");
|
||||
|
||||
if (mapData[mazeIndex]._objectsPresent[oe._refObjNumber])
|
||||
// Object linked to is still present, so we don't remove the object yet
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ensure the object is marked as removed
|
||||
mazeObj._position.x = mazeObj._position.y = 128;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user