[Scummvm-cvs-logs] CVS: scummvm/scumm resource.cpp,1.47,1.48 scumm.h,1.125,1.126 scummvm.cpp,2.30,2.31 sound.cpp,1.68,1.69

James Brown ender at users.sourceforge.net
Thu Jan 2 02:37:22 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv21456/scumm

Modified Files:
	resource.cpp scumm.h scummvm.cpp sound.cpp 
Log Message:
Plop in some better disk switching code for CMI - I have no idea how well this will work transitioning from a disk1 room to a disk2 
room in-game, but it works for bootparams and saved games..



Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- resource.cpp	31 Dec 2002 02:09:56 -0000	1.47
+++ resource.cpp	2 Jan 2003 10:36:17 -0000	1.48
@@ -27,9 +27,8 @@
 #include "scumm/sound.h"
 #include "common/map.h"
 #include "common/str.h"
-
-#include <stdio.h>
-
+#include "gui/message.h"
+#include "dialogs.h"
 
 uint16 newTag2Old(uint32 oldTag);
 
@@ -75,9 +74,11 @@
 		}
 		if (!(_features & GF_SMALL_HEADER)) {
 
-			if (_features & GF_AFTER_V7)
+			if (_features & GF_AFTER_V7) {
+				if (room > 0)
+					_vars[VAR_CURRENTDISK] = res.roomno[rtRoom][room];
 				sprintf(buf, "%s.la%d", _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
-			else if (_features & GF_HUMONGOUS)
+			} else if (_features & GF_HUMONGOUS)
 				sprintf(buf, "%s.he%.1d", _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
 			else
 				sprintf(buf, "%s.%.3d",  _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
@@ -90,10 +91,10 @@
 				if (openResourceFile(buf)) {
 					return;
 				}
-				askForDisk(buf);
+				askForDisk(buf, room == 0 ? 0 : res.roomno[rtRoom][room]);
 
 			} else {
-				sprintf(buf, "disk%.2d.lec",  res.roomno[rtRoom][room]);
+				sprintf(buf, "disk%.2d.lec", room == 0 ? 0 : res.roomno[rtRoom][room]);
 				_encbyte = 0x69;
 			}
 		} else {
@@ -115,7 +116,7 @@
 			error("Room %d not in %s", room, buf);
 			return;
 		}
-		askForDisk(buf);
+		askForDisk(buf, room == 0 ? 0 : res.roomno[rtRoom][room]);
 	}
 
 	do {
@@ -123,7 +124,7 @@
 		_encbyte = 0;
 		if (openResourceFile(buf))
 			break;
-		askForDisk(buf);
+		askForDisk(buf, room == 0 ? 0 : res.roomno[rtRoom][room]);
 	} while (1);
 
 	deleteRoomOffsets();
@@ -199,9 +200,25 @@
 	return _fileHandle.isOpen();
 }
 
-void Scumm::askForDisk(const char *filename)
+void Scumm::askForDisk(const char *filename, int disknum)
 {
-	error("ask Cannot find '%s'", filename);
+	char buf[128];
+
+	if (_features & GF_AFTER_V8) {
+		char result;
+
+		sprintf(buf, "Cannot find file: '%s'\nInsert disk %d into drive %s\nHit Ok to retry, Cancel to exit", filename, disknum, getResDataPath());
+
+		result = displayError(true, buf);
+		if (result == 2)
+			error("Cannot find file: '%s'", filename);
+	} else { 
+		sprintf(buf, "Cannot find file: '%s'", filename);
+		InfoDialog* dialog = new InfoDialog(_newgui, this, (char*)buf);
+		runDialog (dialog);
+		delete dialog;
+		error("Cannot find file: '%s'", filename);
+	}
 }
 
 void Scumm::readIndexFile()

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -d -r1.125 -r1.126
--- scumm.h	1 Jan 2003 18:22:41 -0000	1.125
+++ scumm.h	2 Jan 2003 10:36:17 -0000	1.126
@@ -321,7 +321,7 @@
 	void pauseDialog();
 	void saveloadDialog();
 	void optionsDialog();
-	void displayError(const char *message, ...);
+	char displayError(bool showCancel, const char *message, ...);
 
 	// Misc startup/event functions
 	void main();
@@ -512,7 +512,7 @@
 	void closeRoom();
 	void deleteRoomOffsets();
 	void readRoomsOffsets();
-	void askForDisk(const char *filename);
+	void askForDisk(const char *filename, int disknum);
 	bool openResourceFile(const char *filename);
 	void loadPtrToResource(int type, int i, byte *ptr);
 	void readResTypeList(int id, uint32 tag, const char *name);

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.30
retrieving revision 2.31
diff -u -d -r2.30 -r2.31
--- scummvm.cpp	2 Jan 2003 08:39:33 -0000	2.30
+++ scummvm.cpp	2 Jan 2003 10:36:17 -0000	2.31
@@ -474,7 +474,7 @@
 
 		makeSavegameName(filename, _saveLoadSlot, _saveLoadCompatible);
 		if (!success) {
-			displayError(errMsg, filename);
+			displayError(false, errMsg, filename);
 		} else if (_saveLoadFlag == 1 && _saveLoadSlot != 0 && !_saveLoadCompatible) {
 			// Display "Save succesful" message, except for auto saves
 			char buf[1024];
@@ -1065,18 +1065,20 @@
 	runDialog(_optionsDialog);
 }
 
-void Scumm::displayError(const char *message, ...)
+char Scumm::displayError(bool showCancel, const char *message, ...)
 {
-	char buf[1024];
+	char buf[1024], result;
 	va_list va;
 
 	va_start(va, message);
 	vsprintf(buf, message, va);
 	va_end(va);
 
-	Dialog *dialog = new MessageDialog(_newgui, buf);
-	runDialog(dialog);
+	Dialog *dialog = new MessageDialog(_newgui, buf, 0, true, showCancel);
+	result = runDialog(dialog);
 	delete dialog;
+
+	return result;
 }
 
 void Scumm::shutDown(int i)

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- sound.cpp	1 Jan 2003 20:59:59 -0000	1.68
+++ sound.cpp	2 Jan 2003 10:36:17 -0000	1.69
@@ -958,8 +958,10 @@
 		// FIXME: we have MUSDISK1.BUN and MUSDISK2.BUN in COMI.
 		_outputMixerSize = 66150; // ((22050 * 2 * 2) / 4) * 3
 		if (_scumm->_gameId == GID_CMI) {
+			char bunfile[20];
+			sprintf(bunfile, "musdisk%d.bun", _scumm->_vars[_scumm->VAR_CURRENTDISK]);
 			printf("Opening bundle\n");
-			if (_scumm->_bundle->openMusicFile("musdisk1.bun", _scumm->getGameDataPath()) == false)
+			if (_scumm->_bundle->openMusicFile(bunfile, _scumm->getGameDataPath()) == false)
 				return;
 			_outputMixerSize = 88140; // ((22050 * 2 * 2)
 		} else {
@@ -1123,11 +1125,11 @@
 	byte * ptr;
 	bool result;
 	
-	if (_scumm->_gameId == GID_CMI)
-		// FIXME: HACK! There are actually two voice files in COMI... I dunno how to do this
-		// right, though :-/
-		result = _scumm->_bundle->openVoiceFile("voxdisk1.bun", _scumm->getGameDataPath());
-	else if (_scumm->_gameId == GID_DIG)
+	if (_scumm->_gameId == GID_CMI) {
+		char voxfile[20];
+		sprintf(voxfile, "voxdisk%d.bun", _scumm->_vars[_scumm->VAR_CURRENTDISK]);
+		result = _scumm->_bundle->openVoiceFile(voxfile, _scumm->getGameDataPath());
+	} else if (_scumm->_gameId == GID_DIG)
 		result = _scumm->_bundle->openVoiceFile("digvoice.bun", _scumm->getGameDataPath());
 	else
 		error("Don't know which bundle file to load");





More information about the Scummvm-git-logs mailing list