aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authorMatthew Hoops2011-03-07 10:56:55 -0500
committerMatthew Hoops2011-03-07 11:00:41 -0500
commit10dad00a799aeb5e05e0fec865d25b21e7745956 (patch)
tree7786906fe2c2708fd6aee0b83aab11bcd37bf3cc /engines/mohawk
parentad7400524b8e024577169f7dd4cb4d586ee37fa0 (diff)
downloadscummvm-rg350-10dad00a799aeb5e05e0fec865d25b21e7745956.tar.gz
scummvm-rg350-10dad00a799aeb5e05e0fec865d25b21e7745956.tar.bz2
scummvm-rg350-10dad00a799aeb5e05e0fec865d25b21e7745956.zip
MOHAWK: Improve error handling when data isn't found
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/cursors.cpp2
-rw-r--r--engines/mohawk/cursors.h7
-rw-r--r--engines/mohawk/riven.cpp25
3 files changed, 28 insertions, 6 deletions
diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp
index fdf19b624a..4a9fcb2ff2 100644
--- a/engines/mohawk/cursors.cpp
+++ b/engines/mohawk/cursors.cpp
@@ -198,6 +198,8 @@ MacCursorManager::MacCursorManager(const Common::String &appName) {
delete _resFork;
_resFork = 0;
}
+ } else {
+ _resFork = 0;
}
}
diff --git a/engines/mohawk/cursors.h b/engines/mohawk/cursors.h
index ae48b558b7..e6c417948f 100644
--- a/engines/mohawk/cursors.h
+++ b/engines/mohawk/cursors.h
@@ -81,6 +81,7 @@ public:
virtual void hideCursor();
virtual void setCursor(uint16 id);
virtual void setDefaultCursor();
+ virtual bool hasSource() const { return false; }
protected:
// Set a Mac XOR/AND map cursor to the screen
@@ -95,6 +96,7 @@ public:
~DefaultCursorManager() {}
void setCursor(uint16 id);
+ bool hasSource() const { return true; }
private:
MohawkEngine *_vm;
@@ -112,6 +114,7 @@ public:
void hideCursor();
void setCursor(uint16 id);
void setDefaultCursor();
+ bool hasSource() const { return true; }
private:
MohawkEngine_Myst *_vm;
@@ -125,6 +128,7 @@ public:
~NECursorManager();
void setCursor(uint16 id);
+ bool hasSource() const { return _exe != 0; }
private:
Common::NEResources *_exe;
@@ -137,6 +141,7 @@ public:
~MacCursorManager();
void setCursor(uint16 id);
+ bool hasSource() const { return _resFork != 0; }
private:
Common::MacResManager *_resFork;
@@ -150,6 +155,7 @@ public:
~LivingBooksCursorManager_v2();
void setCursor(uint16 id);
+ bool hasSource() const { return _sysArchive != 0; }
private:
MohawkArchive *_sysArchive;
@@ -162,6 +168,7 @@ public:
~PECursorManager();
void setCursor(uint16 id);
+ bool hasSource() const { return _exe != 0; }
private:
Common::PEResources *_exe;
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 19adf3fe2f..f4a3ad00c8 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -121,8 +121,10 @@ Common::Error MohawkEngine_Riven::run() {
_optionsDialog = new RivenOptionsDialog(this);
_scriptMan = new RivenScriptManager(this);
+ _rnd = new Common::RandomSource();
+ g_eventRec.registerRandomSource(*_rnd, "riven");
+
// Create the cursor manager
- // TODO: Error handling when none can be found
if (Common::File::exists("rivendmo.exe"))
_cursor = new PECursorManager("rivendmo.exe");
else if (Common::File::exists("riven.exe"))
@@ -130,16 +132,27 @@ Common::Error MohawkEngine_Riven::run() {
else // last resort: try the Mac executable
_cursor = new MacCursorManager("Riven");
- _rnd = new Common::RandomSource();
- g_eventRec.registerRandomSource(*_rnd, "riven");
-
initVars();
+ // We need to have a cursor source, or the game won't work
+ if (!_cursor->hasSource()) {
+ Common::String message = "You're missing a Riven executable. The Windows executable is 'riven.exe' or 'rivendemo.exe'. ";
+ message += "Using the 'arcriven.z' installer file also works. In addition, you can use the Mac 'Riven' executable.";
+ GUIErrorMessage(message);
+ warning("%s", message.c_str());
+ return Common::kNoGameDataFoundError;
+ }
+
// Open extras.mhk for common images
_extrasFile = new MohawkArchive();
- if (!_extrasFile->open("extras.mhk"))
- error("Could not open extras.mhk");
+ // We need extras.mhk for inventory images, marble images, and credits images
+ if (!_extrasFile->open("extras.mhk")) {
+ Common::String message = "You're missing a extras.mhk. Using the 'arcriven.z' installer file also works.";
+ GUIErrorMessage(message);
+ warning("%s", message.c_str());
+ return Common::kNoGameDataFoundError;
+ }
// Start at main cursor
_cursor->setCursor(kRivenMainCursor);