aboutsummaryrefslogtreecommitdiff
path: root/sword1
diff options
context:
space:
mode:
Diffstat (limited to 'sword1')
-rw-r--r--sword1/animation.cpp7
-rw-r--r--sword1/resman.cpp44
-rw-r--r--sword1/sword1.cpp19
3 files changed, 60 insertions, 10 deletions
diff --git a/sword1/animation.cpp b/sword1/animation.cpp
index a0962f0237..6dee00941a 100644
--- a/sword1/animation.cpp
+++ b/sword1/animation.cpp
@@ -25,6 +25,8 @@
#include "sound/audiostream.h"
+#include "common/config-manager.h"
+#include "common/str.h"
namespace Sword1 {
AnimationState::AnimationState(Screen *scr, SoundMixer *snd, OSystem *sys)
@@ -63,8 +65,9 @@ MoviePlayer::MoviePlayer(Screen *scr, SoundMixer *snd, OSystem *sys)
void MoviePlayer::play(const char *filename) {
#ifdef USE_MPEG2
AnimationState *anim = new AnimationState(_scr, _snd, _sys);
+ bool initOK = anim->init(filename);
- if (anim->init(filename)) {
+ if (initOK) {
while (anim->decodeFrame()) {
#ifndef BACKEND_8BIT
_sys->updateScreen();
@@ -98,4 +101,4 @@ void MoviePlayer::play(const char *filename) {
#endif
}
-} // End of namespace Sword2
+} // End of namespace Sword1
diff --git a/sword1/resman.cpp b/sword1/resman.cpp
index 49123ddba3..2cd0205286 100644
--- a/sword1/resman.cpp
+++ b/sword1/resman.cpp
@@ -25,10 +25,24 @@
#include "resman.h"
#include "sworddefs.h"
#include "base/engine.h"
+#include "common/config-manager.h"
#include "common/util.h"
+#include "common/str.h"
#include "swordres.h"
+#include "gui/message.h"
+#include "gui/newgui.h"
+
namespace Sword1 {
+ void guiFatalError(char *msg) {
+ // Displays a dialog on-screen before terminating the engine.
+ // TODO: We really need to setup a special palette for cases when
+ // the engine is erroring before setting one... otherwise invisible cursor :)
+
+ GUI::MessageDialog dialog(msg);
+ dialog.runModal();
+ error(msg);
+}
#define MAX_PATH_LEN 260
@@ -44,8 +58,19 @@ ResMan::~ResMan(void) {
void ResMan::loadCluDescript(const char *fileName) {
File resFile;
resFile.open(fileName);
- if (!resFile.isOpen())
- error("ResMan::loadCluDescript(): File %s not found!", fileName);
+ if (!resFile.isOpen()) {
+ // Uh-uh, file not found. Perhaps we're playing straight from CD2?
+ // Check the Extra Path.
+ const Common::String ePath = ConfMan.get("extrapath");
+ resFile.open(fileName, File::kFileReadMode, ePath.c_str());
+ }
+
+ if (!resFile.isOpen()) {
+ char msg[512];
+ sprintf(msg, "Couldn't open CLU description '%s'\n\nIf you are running from CD, please ensure you have read the ScummVM documentation regarding multi-cd games.", fileName);
+ guiFatalError(msg);
+ }
+
_prj.noClu = resFile.readUint32LE();
_prj.clu = new Clu*[_prj.noClu];
@@ -232,8 +257,19 @@ File *ResMan::openClusterFile(uint32 id) {
char fileName[15];
sprintf(fileName, "%s.CLU", _prj.clu[(id >> 24)-1]->label);
clusFile->open(fileName);
- if (!clusFile->isOpen())
- error("Can't open cluster file %s", fileName);
+ if (!clusFile->isOpen()) {
+ // Uh-uh, file not found. Perhaps we're playing straight from CD2,
+ // and its looking for something like SCRIPTS.CLU. Check the Extra Path.
+ const Common::String ePath = ConfMan.get("extrapath");
+ clusFile->open(fileName, File::kFileReadMode, ePath.c_str());
+ }
+
+ if (!clusFile->isOpen()) {
+ char msg[512];
+ sprintf(msg, "Couldn't open game cluster file '%s'\n\nIf you are running from CD, please ensure you have read the ScummVM documentation regarding multi-cd games.", fileName);
+ guiFatalError(msg);
+ }
+
return clusFile;
}
diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp
index da41398659..b29ad6f09b 100644
--- a/sword1/sword1.cpp
+++ b/sword1/sword1.cpp
@@ -41,6 +41,9 @@
#include "music.h"
#include "control.h"
+#include "gui/message.h"
+#include "gui/newgui.h"
+
using namespace Sword1;
/* Broken Sword 1 */
@@ -1062,8 +1065,12 @@ void SwordEngine::checkCdFiles(void) { // check if we're running from cd, hdd or
_systemVars.runningFromCd = false;
_systemVars.playSpeech = true;
return ;
- } else
- error("SPEECH2.CLU not found.\nPlease copy the SPEECH.CLU from CD2 and rename it to SPEECH2.CLU");
+ } else {
+ const char msg[] = "SPEECH2.CLU not found.\nPlease copy the SPEECH.CLU from CD2 and rename it to SPEECH2.CLU";
+ GUI::MessageDialog dialog(msg);
+ dialog.runModal();
+ error(msg);
+ }
} else { // speech1.clu & speech2.clu not present. are we running from cd?
if (test.open("cd1.id")) {
_systemVars.runningFromCd = true;
@@ -1073,8 +1080,12 @@ void SwordEngine::checkCdFiles(void) { // check if we're running from cd, hdd or
_systemVars.runningFromCd = true;
_systemVars.currentCD = 2;
test.close();
- } else
- error("Unable to find files.\nPlease read the instructions again");
+ } else {
+ const char msg[] = "Unable to find the game files.\nPlease read the ScummVM documentation";
+ GUI::MessageDialog dialog(msg);
+ dialog.runModal();
+ error(msg);
+ }
}
}