[Scummvm-cvs-logs] CVS: scummvm/scumm sound.h,1.58,1.59 resource.cpp,1.177,1.178 script_v5.cpp,1.212,1.213 sound.cpp,1.295,1.296 scummvm.cpp,2.517,2.518

Max Horn fingolfin at users.sourceforge.net
Thu Dec 25 07:10:02 CET 2003


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

Modified Files:
	sound.h resource.cpp script_v5.cpp sound.cpp scummvm.cpp 
Log Message:
cleanup; fix File::open usage (do not hardocde constant values, rather use the symbolic namescvs diff | bbeditcvs diff | bbedit

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- sound.h	23 Dec 2003 19:18:20 -0000	1.58
+++ sound.h	25 Dec 2003 15:09:23 -0000	1.59
@@ -66,13 +66,11 @@
 	void addSoundToQueue2(int sound);
 	void processSoundQues();
 	void playSound(int sound);
-	void processSfxQueues();
 	void startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle *handle = NULL);
 	void stopTalkSound();
 	bool isMouthSyncOff(uint pos);
 	int isSoundRunning(int sound) const;
 	bool isSoundInUse(int sound) const;
-	bool isSoundInQueue(int sound) const;
 	void stopSound(int a);
 	void stopAllSounds();
 	void soundKludge(int *list, int num);
@@ -93,6 +91,9 @@
 	File *openSfxFile();
 	void startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id = -1);
 	bool isSfxFinished() const;
+	void processSfxQueues();
+
+	bool isSoundInQueue(int sound) const;
 };
 
 } // End of namespace Scumm

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -d -r1.177 -r1.178
--- resource.cpp	22 Dec 2003 08:22:03 -0000	1.177
+++ resource.cpp	25 Dec 2003 15:09:23 -0000	1.178
@@ -217,7 +217,7 @@
 		_fileHandle.close();
 	}
 
-	_fileHandle.open(filename, getGameDataPath(), 1, encByte);
+	_fileHandle.open(filename, getGameDataPath(), File::kFileReadMode, encByte);
 
 	return _fileHandle.isOpen();
 }
@@ -2213,13 +2213,10 @@
 	sprintf(buf, "dumps/%s%d.dmp", tag, idx);
 #endif
 
-	out.open(buf, "", 1);
-	if (out.isOpen() == false) {
-		out.open(buf, "", 2);
-		if (out.isOpen() == false)
-			return;
-		out.write(ptr, size);
-	}
+	out.open(buf, "", File::kFileWriteMode);
+	if (out.isOpen() == false)
+		return;
+	out.write(ptr, size);
 	out.close();
 }
 

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -d -r1.212 -r1.213
--- script_v5.cpp	17 Dec 2003 17:12:09 -0000	1.212
+++ script_v5.cpp	25 Dec 2003 15:09:23 -0000	1.213
@@ -2258,7 +2258,6 @@
 
 void ScummEngine_v5::o5_soundKludge() {
 	int items[16];
-	int i;
 
 	if (_features & GF_SMALL_HEADER) {	// Is WaitForSentence in SCUMM V3
 		if (_sentenceNum) {
@@ -2272,11 +2271,7 @@
 		return;
 	}
 
-	for (i = 0; i < 16; i++)
-		items[i] = 0;
-
 	int num = getWordVararg(items);
-
 	_sound->soundKludge(items, num);
 }
 

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.295
retrieving revision 1.296
diff -u -d -r1.295 -r1.296
--- sound.cpp	25 Dec 2003 14:01:38 -0000	1.295
+++ sound.cpp	25 Dec 2003 15:09:23 -0000	1.296
@@ -632,12 +632,12 @@
  */
 bool Sound::isSoundInUse(int sound) const {
 
-	if (sound == _currentCDSound)
-		return pollCD() != 0;
-
 	if (_scumm->_imuseDigital)
 		return (_scumm->_imuseDigital->getSoundStatus(sound) != 0);
 
+	if (sound == _currentCDSound)
+		return pollCD() != 0;
+
 	if (isSoundInQueue(sound))
 		return true;
 
@@ -651,30 +651,25 @@
 }
 
 bool Sound::isSoundInQueue(int sound) const {
-	int i, j, num;
-	int16 table[16];
+	int i, num;
 
 	i = _soundQue2Pos;
 	while (i--) {
 		if (_soundQue2[i] == sound)
-			return 1;
+			return true;
 	}
 
 	i = 0;
 	while (i < _soundQuePos) {
 		num = _soundQue[i++];
 
-		memset(table, 0, sizeof(table));
-
 		if (num > 0) {
-			for (j = 0; j < num; j++)
-				table[j] = _soundQue[i + j];
+			if (_soundQue[i + 0] == 0x10F && _soundQue[i + 1] == 8 && _soundQue[i + 2] == sound)
+				return true;
 			i += num;
-			if (table[0] == 0x10F && table[1] == 8 && table[2] == sound)
-				return 1;
 		}
 	}
-	return 0;
+	return false;
 }
 
 void Sound::stopSound(int a) {
@@ -692,7 +687,7 @@
 	if (_scumm->_musicEngine)
 		_scumm->_musicEngine->stopSound(a);
 
-	for (i = 0; i < 10; i++)
+	for (i = 0; i < ARRAYSIZE(_soundQue2); i++)
 		if (_soundQue2[i] == a)
 			_soundQue2[i] = 0;
 }
@@ -734,13 +729,12 @@
 
 	if (list[0] == -1) {
 		processSoundQues();
-		return;
-	}
-
-	_soundQue[_soundQuePos++] = num;
-	
-	for (i = 0; i < num; i++) {
-		_soundQue[_soundQuePos++] = list[i];
+	} else {
+		_soundQue[_soundQuePos++] = num;
+		
+		for (i = 0; i < num; i++) {
+			_soundQue[_soundQuePos++] = list[i];
+		}
 	}
 }
 
@@ -771,8 +765,6 @@
 		_scumm->_imuse->setMasterVolume(ConfMan.getInt("master_volume"));
 		_scumm->_imuse->set_music_volume(ConfMan.getInt("music_volume"));
 	}
-	_scumm->_mixer->setVolume(ConfMan.getInt("sfx_volume") * ConfMan.getInt("master_volume") / 255);
-	_scumm->_mixer->setMusicVolume(ConfMan.getInt("music_volume"));
 	delete _sfxFile;
 	_sfxFile = openSfxFile();
 }
@@ -937,7 +929,7 @@
 
 	if (!file->isOpen()) {
 		sprintf(buf, "%s.tlk", _scumm->getGameName());
-		file->open(buf, _scumm->getGameDataPath(), 1, 0x69);
+		file->open(buf, _scumm->getGameDataPath(), File::kFileReadMode, 0x69);
 	}
 	return file;
 }

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.517
retrieving revision 2.518
diff -u -d -r2.517 -r2.518
--- scummvm.cpp	25 Dec 2003 02:55:00 -0000	2.517
+++ scummvm.cpp	25 Dec 2003 15:09:23 -0000	2.518
@@ -778,7 +778,7 @@
 			}
 			break;
 		}
-		if (fontFile && fp.open(fontFile, getGameDataPath(), 1)) {
+		if (fontFile && fp.open(fontFile, getGameDataPath())) {
 			debug(2, "Loading CJK Font");
 			_CJKMode = true;
 			fp.seek(2, SEEK_CUR);
@@ -807,7 +807,7 @@
 		_2byteWidth = 16;
 		_2byteHeight = 16;
 		//use FM Towns font rom, since game files don't have kanji font resources
-		if (fp.open("fmt_fnt.rom", getGameDataPath(), 1) || fp.open("fmt_fnt.rom", "./", 1)) { 
+		if (fp.open("fmt_fnt.rom", getGameDataPath()) || fp.open("fmt_fnt.rom", "./")) { 
 			_CJKMode = true;
 			debug(2, "Loading FM Towns Kanji rom");
 			_2byteFontPtr = new byte[((_2byteWidth + 7) / 8) * _2byteHeight * numChar];





More information about the Scummvm-git-logs mailing list