aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBastien Bouclet2018-06-18 09:36:40 +0200
committerBastien Bouclet2018-06-29 13:31:54 +0200
commit86e0089cc6233964ca8ac858f627e0572078b199 (patch)
tree69c1eb14f55a233912a821f7ed7f098ec4dc322e /engines
parent23c889db4473815686cf5410662a0e32ae68abeb (diff)
downloadscummvm-rg350-86e0089cc6233964ca8ac858f627e0572078b199.tar.gz
scummvm-rg350-86e0089cc6233964ca8ac858f627e0572078b199.tar.bz2
scummvm-rg350-86e0089cc6233964ca8ac858f627e0572078b199.zip
MOHAWK: RIVEN: Patch in the load menu for the game versions missing it
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/riven_card.cpp85
-rw-r--r--engines/mohawk/riven_card.h5
-rw-r--r--engines/mohawk/riven_stacks/aspit.cpp1
-rw-r--r--engines/mohawk/riven_stacks/aspit.h3
4 files changed, 58 insertions, 36 deletions
diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index d2f8d4f42d..ffbbc69cae 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -396,44 +396,63 @@ void RivenCard::applyPropertiesPatchE2E(uint32 globalId) {
// The main menu in the Myst 25th anniversary version is patched to include new items:
// - Save game
if (globalId == 0xE2E) {
- uint16 patchData[] = {
- 24, // blstId
- 0xFFFF, // name
- 485, // left
- 311, // top
- 602, // right
- 326, // bottom
- 0, // u0
- kRivenMainCursor, // cursor
- 4, // index
- 0xFFFF, // transition offset
- 0, // flags
- 2, // script count
-
- kMouseDownScript, // script type
- 1, // command count
- kRivenCommandRunExternal, // command type
- 2, // argument count
- RivenStacks::ASpit::kExternalSaveGame, // external command name id
- 0, // external argument count
-
- kMouseInsideScript, // script type
- 1, // command count
- kRivenCommandChangeCursor, // command type
- 1, // argument count
- kRivenOpenHandCursor // cursor
+ addMenuHotspot(23, Common::Rect(485, 283, 602, 300), 3, RivenStacks::ASpit::kExternalRestoreGame, "xarestoregame");
+ addMenuHotspot(24, Common::Rect(485, 311, 602, 326), 4, RivenStacks::ASpit::kExternalSaveGame, "xaSaveGame");
+ }
+}
+
+void RivenCard::addMenuHotspot(uint16 blstId, const Common::Rect &position, uint16 index,
+ uint16 externalCommandNameId, const char *externalCommandName) {
+ RivenHotspot *existingHotspot = getHotspotByBlstId(blstId);
+ if (existingHotspot) {
+ return; // Don't add the hotspot if it already exists
+ }
+
+ // Add the external command id => name mapping if it is missing
+ int16 existingCommandNameId = _vm->getStack()->getIdFromName(kExternalCommandNames, externalCommandName);
+ if (existingCommandNameId < 0) {
+ _vm->getStack()->registerName(kExternalCommandNames, externalCommandNameId, externalCommandName);
+ } else {
+ externalCommandNameId = existingCommandNameId;
+ }
+
+ uint16 patchData[] = {
+ blstId,
+ 0xFFFF, // name
+ (uint16) position.left,
+ (uint16) position.top,
+ (uint16) position.right,
+ (uint16) position.bottom,
+ 0, // u0
+ kRivenMainCursor, // cursor
+ index,
+ 0xFFFF, // transition offset
+ 0, // flags
+ 2, // script count
+
+ kMouseDownScript, // script type
+ 1, // command count
+ kRivenCommandRunExternal, // command type
+ 2, // argument count
+ externalCommandNameId,
+ 0, // external argument count
+
+ kMouseInsideScript, // script type
+ 1, // command count
+ kRivenCommandChangeCursor, // command type
+ 1, // argument count
+ kRivenOpenHandCursor // cursor
};
- // Script data is expected to be in big endian
- for (uint i = 0; i < ARRAYSIZE(patchData); i++) {
+ // Script data is expected to be in big endian
+ for (uint i = 0; i < ARRAYSIZE(patchData); i++) {
patchData[i] = TO_BE_16(patchData[i]);
}
- // Add the new hotspot to the existing ones
- Common::MemoryReadStream patchStream((const byte *)(patchData), ARRAYSIZE(patchData) * sizeof(uint16));
- RivenHotspot *newHotspot = new RivenHotspot(_vm, &patchStream);
- _hotspots.push_back(newHotspot);
- }
+ // Add the new hotspot to the existing ones
+ Common::MemoryReadStream patchStream((const byte *)(patchData), ARRAYSIZE(patchData) * sizeof(uint16));
+ RivenHotspot *newHotspot = new RivenHotspot(_vm, &patchStream);
+ _hotspots.push_back(newHotspot);
}
void RivenCard::enter(bool unkMovies) {
diff --git a/engines/mohawk/riven_card.h b/engines/mohawk/riven_card.h
index f285ba1a1b..acf20faee8 100644
--- a/engines/mohawk/riven_card.h
+++ b/engines/mohawk/riven_card.h
@@ -152,11 +152,15 @@ private:
void loadCardHotspotEnableList(uint16 id);
void loadCardWaterEffectList(uint16 id);
void applyPatches(uint16 id);
+ void applyPropertiesPatchE2E(uint32 globalId);
void applyPropertiesPatch8EB7(uint32 globalId);
void applyPropertiesPatch2E76(uint32 globalId);
void applyPropertiesPatch22118(uint32 globalId);
void setCurrentCardVariable();
+ void addMenuHotspot(uint16 blstId, const Common::Rect &position, uint16 index,
+ uint16 externalCommandNameId, const char *externalCommandName);
+
RivenScriptPtr getScript(uint16 scriptType) const;
void defaultLoadScript();
@@ -193,7 +197,6 @@ private:
Common::Array<HotspotEnableRecord> _hotspotEnableList;
Common::Array<WaterEffectRecord> _waterEffectList;
- void applyPropertiesPatchE2E(uint32 globalId);
};
struct MLSTRecord {
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index c4ae09684c..de5747cbc2 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -66,7 +66,6 @@ ASpit::ASpit(MohawkEngine_Riven *vm) :
REGISTER_COMMAND(ASpit, xaexittomain);
REGISTER_COMMAND(ASpit, xaSaveGame);
- registerName(kExternalCommandNames, kExternalSaveGame, "xaSaveGame");
}
struct MenuItemText {
diff --git a/engines/mohawk/riven_stacks/aspit.h b/engines/mohawk/riven_stacks/aspit.h
index 75b9fd3e64..ba6f3c31f2 100644
--- a/engines/mohawk/riven_stacks/aspit.h
+++ b/engines/mohawk/riven_stacks/aspit.h
@@ -36,7 +36,8 @@ public:
ASpit(MohawkEngine_Riven *vm);
enum PatchedExternalCommandNameId {
- kExternalSaveGame = 20
+ kExternalSaveGame = 20,
+ kExternalRestoreGame = 21
};
// External commands - Main Menu