aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/patcher.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2019-08-26 20:26:54 -0700
committerPaul Gilbert2019-08-26 20:27:05 -0700
commit87c3e6d5d37ec5ee8d9f4062058cc7b1ae8e01bb (patch)
treeb4a4fb69bf19a5d68e03a5ac57fbcc64e00b2b46 /engines/xeen/patcher.cpp
parente65001405b79ec5eae56657b0ca5e2258c46872a (diff)
downloadscummvm-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/patcher.cpp')
-rw-r--r--engines/xeen/patcher.cpp56
1 files changed, 52 insertions, 4 deletions
diff --git a/engines/xeen/patcher.cpp b/engines/xeen/patcher.cpp
index c8939e95f0..b401549442 100644
--- a/engines/xeen/patcher.cpp
+++ b/engines/xeen/patcher.cpp
@@ -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();
+
+ 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;
- 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);
+ 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;
}
}