[Scummvm-cvs-logs] CVS: scummvm/scumm bundle.cpp,1.3,1.4 bundle.h,1.2,1.3 resource.cpp,1.6,1.7 script_v2.cpp,1.9,1.10 scummvm.cpp,1.16,1.17 sound.cpp,1.8,1.9

Pawe? Ko?odziejski aquadran at users.sourceforge.net
Sun Sep 15 12:29:02 CEST 2002


Update of /cvsroot/scummvm/scummvm/scumm
In directory usw-pr-cvs1:/tmp/cvs-serv26315/scumm

Modified Files:
	bundle.cpp bundle.h resource.cpp script_v2.cpp scummvm.cpp 
	sound.cpp 
Log Message:
improved open function in File class

Index: bundle.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/bundle.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- bundle.cpp	31 Aug 2002 09:50:36 -0000	1.3
+++ bundle.cpp	15 Sep 2002 19:28:34 -0000	1.4
@@ -31,13 +31,13 @@
 Bundle::~Bundle() {
 }
 
-bool Bundle::openVoiceFile(char *filename) {
+bool Bundle::openVoiceFile(const char *filename, const char *directory) {
 	int32 tag, offset;
 
 	if (_voiceFile.isOpen() == true)
 		return true;
 
-	if (_voiceFile.open(filename) == false) {
+	if (_voiceFile.open(filename, directory) == false) {
 		warning("Bundle: Can't open voice bundle file: %s", filename);
 		return false;
 	}
@@ -71,13 +71,13 @@
 	return true;
 }
 
-bool Bundle::openMusicFile(char *filename) {
+bool Bundle::openMusicFile(const char *filename, const char *directory) {
 	int32 tag, offset;
 
 	if (_musicFile.isOpen() == true)
 		return true;
 
-	if (_musicFile.open(filename) == false) {
+	if (_musicFile.open(filename, directory) == false) {
 		warning("Bundle: Can't open music bundle file: %s", filename);
 		return false;
 	}

Index: bundle.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/bundle.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- bundle.h	31 Aug 2002 09:50:36 -0000	1.2
+++ bundle.h	15 Sep 2002 19:28:34 -0000	1.3
@@ -56,8 +56,8 @@
 	  Bundle();
 	 ~Bundle();
 
-	bool openVoiceFile(char *filename);
-	bool openMusicFile(char *filename);
+	bool openVoiceFile(const char *filename, const char *directory);
+	bool openMusicFile(const char *filename, const char *directory);
 	int32 decompressVoiceSampleByName(char *name, byte *comp_final);
 	int32 decompressVoiceSampleByIndex(int32 index, byte *comp_final);
 	int32 decompressMusicSampleByName(char *name, int32 number, byte *comp_final);

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- resource.cpp	10 Sep 2002 07:34:27 -0000	1.6
+++ resource.cpp	15 Sep 2002 19:28:34 -0000	1.7
@@ -73,16 +73,16 @@
 		if (!(_features & GF_SMALL_HEADER)) {
 
 			if (_features & GF_AFTER_V7)
-				sprintf(buf, "%s%s.la%d", _gameDataPath, _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
+				sprintf(buf, "%s.la%d", _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
 			else if (_features & GF_HUMONGOUS)
-				sprintf(buf, "%s%s.he%.1d", _gameDataPath, _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
+				sprintf(buf, "%s.he%.1d", _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
 			else
-				sprintf(buf, "%s%s.%.3d", _gameDataPath, _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
+				sprintf(buf, "%s.%.3d",  _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
 
 			_encbyte = (_features & GF_USE_KEY) ? 0x69 : 0;
 		} else if (!(_features & GF_SMALL_NAMES)) {
 			if (room == 0 || room >= 900) {
-				sprintf(buf, "%s%.3d.lfl", _gameDataPath, room);
+				sprintf(buf, "%.3d.lfl", room);
 				_encbyte = 0;
 				if (openResourceFile(buf)) {
 					return;
@@ -90,11 +90,11 @@
 				askForDisk(buf);
 
 			} else {
-				sprintf(buf, "%sdisk%.2d.lec", _gameDataPath, res.roomno[rtRoom][room]);
+				sprintf(buf, "disk%.2d.lec",  res.roomno[rtRoom][room]);
 				_encbyte = 0x69;
 			}
 		} else {
-			sprintf(buf, "%s%.2d.lfl", _gameDataPath, room);
+			sprintf(buf, "%.2d.lfl", room);
 			if (_features & GF_OLD_BUNDLE)
 				_encbyte = 0xFF;
 			else
@@ -186,26 +186,7 @@
 	}
 
 	strcpy(buf, filename);
-	_fileHandle.open(buf, 1, _encbyte);
-	if (_fileHandle.isOpen() == false) {
-		char *e = strrchr(buf, '/');
-		if (!e)
-			e = buf;
-		do
-			*e = tolower(*e);
-		while (*e++);
-		_fileHandle.open(buf, 1, _encbyte);
-	}
-
-	if (_fileHandle.isOpen() == false) {
-		char *e = strrchr(buf, '/');
-		if (!e)
-			e = buf;
-		do
-			*e = toupper(*e);
-		while (*e++);
-		_fileHandle.open(buf, 1, _encbyte);
-	}
+	_fileHandle.open(buf, getGameDataPath(), 1, _encbyte);
 
 	return _fileHandle.isOpen();
 }

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- script_v2.cpp	15 Sep 2002 05:38:03 -0000	1.9
+++ script_v2.cpp	15 Sep 2002 19:28:34 -0000	1.10
@@ -2719,9 +2719,8 @@
  				SmushPlayer sp(&sr);
  				char filename[512];
  				strcpy(filename, _gameDataPath);
- 				strcat(filename, "video/");
  				strcat(filename, (char*)getStringAddressVar(VAR_VIDEONAME));
- 				sp.play(filename);
+ 				sp.play(filename, getGameDataPath());
  			}
 			break;
 		case 7:

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- scummvm.cpp	13 Sep 2002 16:29:07 -0000	1.16
+++ scummvm.cpp	15 Sep 2002 19:28:34 -0000	1.17
@@ -871,9 +871,9 @@
 	sprintf(buf, "dumps/%s%d.dmp", tag, idx);
 #endif
 
-	out.open(buf, 1);
+	out.open(buf, "", 1);
 	if (out.isOpen() == false) {
-		out.open(buf, 2);
+		out.open(buf, "", 2);
 		if (out.isOpen() == false)
 			return;
 		out.write(ptr, size);

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- sound.cpp	15 Sep 2002 05:38:03 -0000	1.8
+++ sound.cpp	15 Sep 2002 19:28:34 -0000	1.9
@@ -751,10 +751,9 @@
 #ifdef COMPRESSED_SOUND_FILE
 	offset_table = NULL;
 
-	sprintf(buf, "%s%s.so3", _scumm->getGameDataPath(), _scumm->_exe_name);
-	if (!file->open(buf)) {
-		sprintf(buf, "%smonster.so3", _scumm->getGameDataPath());
-		file->open(buf);
+	sprintf(buf, "%s.so3", _scumm->_exe_name);
+	if (!file->open(buf, _scumm->getGameDataPath())) {
+		file->open("monster.so3", _scumm->getGameDataPath());
 	}
 	if (file->isOpen() == true) {
 		/* Now load the 'offset' index in memory to be able to find the MP3 data
@@ -791,10 +790,9 @@
 		return file;
 	}
 #endif
-	sprintf(buf, "%s%s.sou", _scumm->getGameDataPath(), _scumm->_exe_name);
-	if (!file->open(buf)) {
-		sprintf(buf, "%smonster.sou", _scumm->getGameDataPath());
-		file->open(buf);
+	sprintf(buf, "%s.sou", _scumm->_exe_name);
+	if (!file->open(buf, _scumm->getGameDataPath())) {
+		file->open("monster.sou", _scumm->getGameDataPath());
 	}
 	return file;
 }
@@ -837,11 +835,8 @@
 #define OUTPUT_SIZE 66150 // ((22050 * 2 * 2) / 4) * 3
 
 void Sound::playBundleMusic(int32 song) {
-	char buf[256];
-
 	if (_numberBundleMusic == -1) {
-		sprintf(buf, "%s%smusic.bun", _scumm->getGameDataPath(), _scumm->_exe_name);
-		if (_scumm->_bundle->openMusicFile((char*)&buf) == false) {
+		if (_scumm->_bundle->openMusicFile("digmusic.bun", _scumm->getGameDataPath()) == false) {
 			return;
 		}
 
@@ -958,11 +953,9 @@
 }
 
 void Sound::playBundleSound(char *sound) {
-	char buf[256];
 	byte * ptr;
 
-	sprintf(buf, "%s%svoice.bun", _scumm->getGameDataPath(), _scumm->_exe_name);
-	if (_scumm->_bundle->openVoiceFile((char*)&buf) == false) {
+	if (_scumm->_bundle->openVoiceFile("digvoice.bun", _scumm->getGameDataPath()) == false) {
 		return;
 	}
 
@@ -1093,8 +1086,8 @@
 	_current_cache %= CACHE_TRACKS;
 
 	// Not found, see if it exists
-	sprintf(track_name, "%strack%d.mp3", _scumm->getGameDataPath(), track);
-	file->open(track_name);
+	sprintf(track_name, "track%d.mp3", track);
+	file->open(track_name, _scumm->getGameDataPath());
 	_cached_tracks[current_index] = track;
 
 	/* First, close the previous file */





More information about the Scummvm-git-logs mailing list