[Scummvm-cvs-logs] CVS: scummvm/scumm music.h,2.6,2.7 resource_v2.cpp,1.34,1.35 scumm.h,1.307,1.308 scummvm.cpp,2.412,2.413

Max Horn fingolfin at users.sourceforge.net
Thu Oct 2 18:09:04 CEST 2003


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

Modified Files:
	music.h resource_v2.cpp scumm.h scummvm.cpp 
Log Message:
added getMusicTimer() to class MusicEngine; this allows some nice code cleanup; also added an error() invocation to find out if certain code is still needed

Index: music.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/music.h,v
retrieving revision 2.6
retrieving revision 2.7
diff -u -d -r2.6 -r2.7
--- music.h	28 Sep 2003 00:03:24 -0000	2.6
+++ music.h	3 Oct 2003 01:07:35 -0000	2.7
@@ -36,7 +36,9 @@
 	virtual void stopSound(int sound) = 0;
 	virtual void stopAllSounds() = 0;
 	virtual int  getSoundStatus(int sound) const = 0;
-//	virtual int  getMusicTimer() const = 0;
+
+	virtual int  getMusicTimer() const { return 0; }
+
 	virtual void terminate() {}
 };
 

Index: resource_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource_v2.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- resource_v2.cpp	2 Oct 2003 22:42:02 -0000	1.34
+++ resource_v2.cpp	3 Oct 2003 01:07:35 -0000	1.35
@@ -32,7 +32,7 @@
 
 	if (_gameId == GID_MANIAC) {
 		if (!(_features & GF_AMIGA) && !(_features & GF_NES))
-			_musicEngine = _playerV2 = new Player_V1(this);
+			_musicEngine = new Player_V1(this);
 
 		_numGlobalObjects = 800;
 		_numRooms = 55;
@@ -41,7 +41,7 @@
 		_numSounds = 100;
 	} else if (_gameId == GID_ZAK) {
 		if (!(_features & GF_AMIGA))
-			_musicEngine = _playerV2 = new Player_V2(this);
+			_musicEngine = new Player_V2(this);
 
 		_numGlobalObjects = 775;
 		_numRooms = 61;
@@ -107,7 +107,7 @@
 void ScummEngine_v2::readEnhancedIndexFile() {
 
 	if (!(_features & GF_AMIGA))
-		_musicEngine = _playerV2 = new Player_V2(this);
+		_musicEngine = new Player_V2(this);
 
 	_numGlobalObjects = _fileHandle.readUint16LE();
 	_fileHandle.seek(_numGlobalObjects, SEEK_CUR); // Skip object flags

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.307
retrieving revision 1.308
diff -u -d -r1.307 -r1.308
--- scumm.h	2 Oct 2003 22:42:03 -0000	1.307
+++ scumm.h	3 Oct 2003 01:07:35 -0000	1.308
@@ -42,9 +42,6 @@
 class IMuseDigital;
 class MusicEngine;
 class NewGui;
-class Player_V2;
-class Player_V2A;
-class Player_V3A;
 class ScummEngine;
 class ScummDebugger;
 class Serializer;
@@ -260,9 +257,6 @@
 	 * on some architectures. */
 	IMuse *_imuse;
 	IMuseDigital *_imuseDigital;
-	Player_V2 *_playerV2;
-	Player_V2A *_playerV2A;
-	Player_V3A *_playerV3A;
 	MusicEngine *_musicEngine;
 	Sound *_sound;
 

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.412
retrieving revision 2.413
diff -u -d -r2.412 -r2.413
--- scummvm.cpp	2 Oct 2003 22:42:03 -0000	2.412
+++ scummvm.cpp	3 Oct 2003 01:07:35 -0000	2.413
@@ -732,22 +732,19 @@
 	// Init iMuse
 	_imuse = NULL;
 	_imuseDigital = NULL;
-	_playerV2 = NULL;
-	_playerV2A = NULL;
-	_playerV3A = NULL;
 	_musicEngine = NULL;
 	if (_features & GF_DIGI_IMUSE) {
 		_musicEngine = _imuseDigital = new IMuseDigital(this);
 #ifndef __PALM_OS__
 	} else if ((_features & GF_AMIGA) && (_version == 2)) {
-		_musicEngine = _playerV2A = new Player_V2A(this);
+		_musicEngine = new Player_V2A(this);
 #endif
 	} else if ((_features & GF_AMIGA) && (_version == 3)) {
-		_musicEngine = _playerV3A = new Player_V3A(this);
+		_musicEngine = new Player_V3A(this);
 	} else if ((_features & GF_AMIGA) && (_version < 5)) {
 		_musicEngine = NULL;
 	} else if (((_midiDriver == MD_PCJR) || (_midiDriver == MD_PCSPK)) && ((_version > 2) && (_version < 5))) {
-		_musicEngine = _playerV2 = new Player_V2(this);
+		_musicEngine = new Player_V2(this);
 	} else if (_version > 2) {
 		MidiDriver *driver = detector->createMidi();
 		if (driver && detector->_native_mt32)
@@ -1352,22 +1349,23 @@
 
 	if (_features & GF_AUDIOTRACKS) {
 		// Covered automatically by the Sound class
-	} else if (_playerV2) {
-		VAR(VAR_MUSIC_TIMER) = _playerV2->getMusicTimer();
-	} else if (_playerV2A) {
-		VAR(VAR_MUSIC_TIMER) = _playerV2A->getMusicTimer();
-	} else if (_playerV3A) {
-		VAR(VAR_MUSIC_TIMER) = _playerV3A->getMusicTimer();
-	} else if (_imuse) {
-		VAR(VAR_MUSIC_TIMER) = _imuse->getMusicTimer();
+	} else if (_musicEngine && VAR_MUSIC_TIMER != 0xFF) {
+		// The music engine generates the timer data for us.
+		VAR(VAR_MUSIC_TIMER) = _musicEngine->getMusicTimer();
 	} else if (_features & GF_SMALL_HEADER) {
+		// FIXME: Is this code here really still necessary? It used to be there to sync
+		// MonkeyVGA, back before we used iMuse for it, too. Right now, I can't find
+		// anything which would need this... so I put an aggressive error in here,
+		// if there is something needing this, I am guranteed a report :-)
+		error("Fingolfin asks: when is this ever triggered anyway? %s:%d", __FILE__, __LINE__);
+
 		// TODO: The music delay (given in milliseconds) might have to be tuned a little
 		// to get it correct for all games. Without the ability to watch/listen to the
 		// original games, I can't do that myself.
 		const int MUSIC_DELAY = 480;
 		tempMusic += delta * 15;	// Convert delta to milliseconds
 		if (tempMusic >= MUSIC_DELAY) {
-			tempMusic %= MUSIC_DELAY;
+			tempMusic -= MUSIC_DELAY;
 			VAR(VAR_MUSIC_TIMER) += 1;
 		}
 	}





More information about the Scummvm-git-logs mailing list