[Scummvm-cvs-logs] CVS: scummvm/sword1 animation.cpp,1.25,1.26 resman.cpp,1.17,1.18 sword1.cpp,1.46,1.47

James Brown ender at users.sourceforge.net
Sat Jul 10 21:42:16 CEST 2004


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32342/sword1

Modified Files:
	animation.cpp resman.cpp sword1.cpp 
Log Message:
Use extrapath in Sword1 engine (from 0.6.0 branch). More verbose errors to go with the forthcoming new manual. Sword1 CD swapping doesn't work as expected HERE, either :)


Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/animation.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- animation.cpp	28 Mar 2004 16:30:49 -0000	1.25
+++ animation.cpp	11 Jul 2004 04:41:48 -0000	1.26
@@ -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 @@
 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 @@
 #endif
 }
 
-} // End of namespace Sword2
+} // End of namespace Sword1

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/resman.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- resman.cpp	27 Jun 2004 22:14:32 -0000	1.17
+++ resman.cpp	11 Jul 2004 04:41:48 -0000	1.18
@@ -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 @@
 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 @@
 	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;
 }
 

Index: sword1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- sword1.cpp	28 Jun 2004 08:45:09 -0000	1.46
+++ sword1.cpp	11 Jul 2004 04:41:48 -0000	1.47
@@ -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 @@
 			_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 @@
 			_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);
+		}
 	}
 }
 





More information about the Scummvm-git-logs mailing list