aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/riven.cpp11
-rw-r--r--engines/mohawk/riven.h1
-rw-r--r--engines/mohawk/riven_card.cpp1
-rw-r--r--engines/mohawk/riven_scripts.cpp14
-rw-r--r--engines/mohawk/riven_stacks/aspit.cpp16
-rw-r--r--engines/mohawk/riven_stacks/aspit.h4
6 files changed, 46 insertions, 1 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 6e386129d9..9b9080da8a 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -580,6 +580,17 @@ void MohawkEngine_Riven::delay(uint32 ms) {
}
}
+void MohawkEngine_Riven::startNewGame() {
+ // Clear all the state data
+ _menuSavedStack = -1;
+ _menuSavedCard = -1;
+
+ _vars.clear();
+ initVars();
+
+ _zipModeData.clear();
+}
+
void MohawkEngine_Riven::runLoadDialog() {
GUI::SaveLoadChooser slc(_("Load game:"), _("Load"), false);
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index 36bb2008b8..548ee6ee58 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -175,6 +175,7 @@ public:
void goToMainMenu();
void resumeFromMainMenu();
bool isGameStarted() const;
+ void startNewGame();
};
} // End of namespace Mohawk
diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index 304f596780..6ef833f112 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -403,6 +403,7 @@ void RivenCard::applyPropertiesPatchE2E(uint32 globalId) {
addMenuHotspot(25, Common::Rect(485, 283, 602, 300), 5, RivenStacks::ASpit::kExternalResume, "xaResumeGame");
addMenuHotspot(26, Common::Rect(485, 309, 602, 326), 6, RivenStacks::ASpit::kExternalOptions, "xaOptions");
addMenuHotspot(27, Common::Rect(485, 335, 602, 352), 7, RivenStacks::ASpit::kExternalQuit, "xademoquit");
+ _vm->getStack()->registerName(kExternalCommandNames, RivenStacks::ASpit::kExternalNewGame, "xaNewGame");
}
}
diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp
index c12989bca6..a2dd69d49a 100644
--- a/engines/mohawk/riven_scripts.cpp
+++ b/engines/mohawk/riven_scripts.cpp
@@ -27,6 +27,7 @@
#include "mohawk/riven_scripts.h"
#include "mohawk/riven_sound.h"
#include "mohawk/riven_stack.h"
+#include "mohawk/riven_stacks/aspit.h"
#include "mohawk/riven_video.h"
#include "common/memstream.h"
@@ -363,6 +364,19 @@ void RivenScript::applyCardPatches(MohawkEngine_Riven *vm, uint32 cardGlobalId,
debugC(kRivenDebugPatches, "Applied incorrect steam sounds (1/2) to card %x", cardGlobalId);
}
+ // Override the main menu new game script to call an external command.
+ // This way we can reset all the state when starting a new game while a game is already started.
+ if (cardGlobalId == 0xE2E && scriptType == kMouseDownScript && hotspotId == 16) {
+ shouldApplyPatches = true;
+ _commands.clear();
+
+ RivenSimpleCommand::ArgumentArray arguments;
+ arguments.push_back(RivenStacks::ASpit::kExternalNewGame);
+ arguments.push_back(0);
+ _commands.push_back(RivenCommandPtr(new RivenSimpleCommand(vm, kRivenCommandRunExternal, arguments)));
+ debugC(kRivenDebugPatches, "Applied override new game script patch to card %x", cardGlobalId);
+ }
+
if (shouldApplyPatches) {
for (uint i = 0; i < _commands.size(); i++) {
_commands[i]->applyCardPatches(cardGlobalId, scriptType, hotspotId);
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index b72ba01fe0..eb03ac82f0 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -68,6 +68,7 @@ ASpit::ASpit(MohawkEngine_Riven *vm) :
REGISTER_COMMAND(ASpit, xaSaveGame);
REGISTER_COMMAND(ASpit, xaResumeGame);
REGISTER_COMMAND(ASpit, xaOptions);
+ REGISTER_COMMAND(ASpit, xaNewGame);
}
struct MenuItemText {
@@ -394,6 +395,21 @@ void ASpit::xaOptions(const ArgumentArray &args) {
_vm->runOptionsDialog();
}
+void ASpit::xaNewGame(const ArgumentArray &args) {
+ _vm->startNewGame();
+
+ RivenScriptPtr script = _vm->_scriptMan->createScriptFromData(2,
+ kRivenCommandTransition, 1, kRivenTransitionBlend,
+ kRivenCommandChangeCard, 1, 2);
+
+ script->addCommand(RivenCommandPtr(new RivenStackChangeCommand(_vm, 0, 0x6E9A, false)));
+
+ script += _vm->_scriptMan->createScriptFromData(1,
+ kRivenCommandStopSound, 1, 2);
+
+ _vm->_scriptMan->runScript(script, false);
+}
+
void ASpit::xadisablemenureturn(const ArgumentArray &args) {
// This function would normally enable the Windows menu item for
// returning to the main menu. Ctrl+r will do this instead.
diff --git a/engines/mohawk/riven_stacks/aspit.h b/engines/mohawk/riven_stacks/aspit.h
index 3ab02d7c17..2a6d88f936 100644
--- a/engines/mohawk/riven_stacks/aspit.h
+++ b/engines/mohawk/riven_stacks/aspit.h
@@ -40,7 +40,8 @@ public:
kExternalRestoreGame = 21,
kExternalResume = 22,
kExternalOptions = 23,
- kExternalQuit = 24
+ kExternalQuit = 24,
+ kExternalNewGame = 25
};
@@ -72,6 +73,7 @@ public:
void xaSaveGame(const ArgumentArray &args);
void xaResumeGame(const ArgumentArray &args);
void xaOptions(const ArgumentArray &args);
+ void xaNewGame(const ArgumentArray &args);
// External commands - Demo-specific
void xadisablemenureturn(const ArgumentArray &args);