[Scummvm-cvs-logs] CVS: scummvm/sword1 animation.cpp,1.10.2.6,1.10.2.7 resman.cpp,1.16,1.16.2.1 sword1.cpp,1.39.2.1,1.39.2.2

James Brown ender at users.sourceforge.net
Sat Jul 10 21:38:03 CEST 2004


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

Modified Files:
      Tag: branch-0-6-0
	animation.cpp resman.cpp sword1.cpp 
Log Message:
Bump version, backport launcher 'Path' changes. Add Sword1 support, and better error messages referring to the forthcoming new manual. Still needs work, Sword1 CD changing isn't working as expected.CVS: ----------------------------------------------------------------------


Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/animation.cpp,v
retrieving revision 1.10.2.6
retrieving revision 1.10.2.7
diff -u -d -r1.10.2.6 -r1.10.2.7
--- animation.cpp	14 Mar 2004 13:50:38 -0000	1.10.2.6
+++ animation.cpp	11 Jul 2004 04:36:56 -0000	1.10.2.7
@@ -26,6 +26,8 @@
 
 #include "sword1/animation.h"
 
+#include "common/config-manager.h"
+#include "common/str.h"
 namespace Sword1 {
 
 AnimationState::AnimationState(Screen *scr, SoundMixer *snd, OSystem *sys)
@@ -49,6 +51,8 @@
 }
 
 bool AnimationState::init(const char *basename) {
+	const Common::String ePath = ConfMan.get("extrapath");
+
 #ifdef USE_MPEG2
 
 	char tempFile[512];
@@ -66,7 +70,7 @@
 	sprintf(tempFile, "%s.pal", basename);
 	File f;
 
-	if (!f.open(tempFile)) {
+	if (!f.open(tempFile) && !f.open(tempFile, ePath)) {
 		warning("Cutscene: %s.pal palette missing", basename);
 		return false;
 	}
@@ -117,7 +121,7 @@
 	// Open MPEG2 stream
 	mpgfile = new File();
 	sprintf(tempFile, "%s.mp2", basename);
-	if (!mpgfile->open(tempFile)) {
+	if (!mpgfile->open(tempFile) && !mpgfile->open(tempFile, ePath)) {
 		warning("Cutscene: Could not open %s", tempFile);
 		return false;
 	}
@@ -139,7 +143,7 @@
 
 #ifdef USE_VORBIS
 	sprintf(tempFile, "%s.ogg", basename);
-	if (sndfile->open(tempFile)) 
+	if (sndfile->open(tempFile) || sndfile->open(tempFile, ePath)) 
 		bgSoundStream = makeVorbisStream(sndfile, sndfile->size());				
 #endif
 
@@ -403,8 +407,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->update_screen();

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/resman.cpp,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -u -d -r1.16 -r1.16.2.1
--- resman.cpp	11 Jan 2004 16:27:36 -0000	1.16
+++ resman.cpp	11 Jul 2004 04:36:56 -0000	1.16.2.1
@@ -25,10 +25,32 @@
 #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.
+		// First sets a dummy palette to allow cursor visibility - just in case
+		// we're aborting before the initial palette was loaded...
+		const byte dummy_palette[] = {
+			0, 0, 0, 0, 0, 0, 171, 0, 0, 171, 0, 0,0, 171, 171, 0,
+			171, 0, 0, 0, 171, 0, 171, 0, 171, 87, 0, 0, 171, 171,
+			171, 0, 87, 87, 87, 0, 87, 87, 255, 0, 87, 255, 87, 0,
+			87, 255, 255, 0, 255, 87, 87, 0, 255, 87, 255, 0, 255,
+			255, 87, 0, 255, 255, 255, 0
+		};
+		g_system->set_palette(dummy_palette, 0, 16);
+
+		GUI::MessageDialog dialog(msg);
+		dialog.runModal();
+		error(msg);
+}
 
 #define MAX_PATH_LEN 260
 
@@ -44,8 +66,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, ePath);
+	}
+
+	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 +265,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, ePath);
+	}
+
+	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.39.2.1
retrieving revision 1.39.2.2
diff -u -d -r1.39.2.1 -r1.39.2.2
--- sword1.cpp	3 Mar 2004 07:38:20 -0000	1.39.2.1
+++ sword1.cpp	11 Jul 2004 04:36:56 -0000	1.39.2.2
@@ -41,6 +41,9 @@
 #include "music.h"
 #include "control.h"
 
+#include "gui/message.h"
+#include "gui/newgui.h"
+
 using namespace Sword1;
 
 /* Broken Sword 1 */
@@ -1050,8 +1053,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;
@@ -1061,8 +1068,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