[Scummvm-cvs-logs] CVS: scummvm/scumm/imuse_digi dimuse.cpp,1.14,1.15 dimuse.h,1.9,1.10 dimuse_sndmgr.cpp,1.11,1.12 dimuse_sndmgr.h,1.8,1.9

Pawel Kolodziejski aquadran at users.sourceforge.net
Thu Jan 8 10:27:01 CET 2004


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

Modified Files:
	dimuse.cpp dimuse.h dimuse_sndmgr.cpp dimuse_sndmgr.h 
Log Message:
jumps are now better handled

Index: dimuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- dimuse.cpp	8 Jan 2004 17:07:21 -0000	1.14
+++ dimuse.cpp	8 Jan 2004 18:25:30 -0000	1.15
@@ -127,8 +127,12 @@
 				byte *data = NULL;
 				int32 result = 0;
 
-				if (_track[l].stream->endOfData())
+				if (_track[l].stream->endOfData()) {
 					mixer_size *= 2;
+				}
+
+				if (_track[l].curRegion == -1)
+					switchToNextRegion(l);
 
 				int bits = _sound->getBits(_track[l].soundHandle);
 				do {
@@ -182,14 +186,6 @@
 	}
 }
 
-int IMuseDigital::checkJumpByRegion(int track, int region) {
-	int num_jumps = _sound->getNumJumps(_track[track].soundHandle);
-	for (int l = 0; l < num_jumps; l++) {
-		return _sound->getJumpDestRegionId(_track[track].soundHandle, l);
-	}
-	return -1;
-}
-
 void IMuseDigital::switchToNextRegion(int track) {
 	int num_regions = _sound->getNumRegions(_track[track].soundHandle);
 	int num_jumps = _sound->getNumJumps(_track[track].soundHandle);
@@ -203,14 +199,17 @@
 		return;
 	}
 
-	int hookid = _sound->getJumpIdByRegion(_track[track].soundHandle, _track[track].curRegion);
+	int hookid = _sound->getJumpIdByRegionId(_track[track].soundHandle, _track[track].curRegion);
 	if (hookid == _track[track].curHookId) {
-		int region = checkJumpByRegion(track, _track[track].curRegion);
-		if (region != -1)
+		int region = _sound->getRegionIdByHookId(_track[track].soundHandle, hookid);
+		if (region != -1) {
 			_track[track].curRegion = region;
-		_track[track].curHookId = 0;
+			_track[track].curHookId = 0;
+			debug(5, "switchToNextRegion-sound(%d) jump to %d region", _track[track].idSound, _track[track].curRegion);
+		}
 	}
 
+	debug(5, "switchToNextRegion-sound(%d) select %d region", _track[track].idSound, _track[track].curRegion);
 	_track[track].regionOffset = 0;
 }
 
@@ -230,7 +229,7 @@
 			_track[l].started = false;
 			_track[l].soundGroup = soundGroup;
 			_track[l].curHookId = 0;
-			_track[l].curRegion = 0;
+			_track[l].curRegion = -1;
 			_track[l].regionOffset = 0;
 			_track[l].trackOffset = 0;
 			_track[l].mod = 0;

Index: dimuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- dimuse.h	8 Jan 2004 17:07:21 -0000	1.9
+++ dimuse.h	8 Jan 2004 18:25:30 -0000	1.10
@@ -76,7 +76,6 @@
 	static void timer_handler(void *refConf);
 	void callback();
 	void switchToNextRegion(int track);
-	int checkJumpByRegion(int track, int region);
 	void startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input);
 
 public:
@@ -88,13 +87,13 @@
 	void startVoice(int soundId)
 		{ debug(5, "startVoiceBundle(%d)", soundId); startSound(soundId, NULL, IMUSE_BUNDLE, IMUSE_VOICE, NULL); }
 	void startVoice(int soundId, const char *soundName)
-		{ debug(5, "startVoiceBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOICE, NULL); }
+		{ return;}//debug(5, "startVoiceBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_VOICE, NULL); }
 	void startMusic(int soundId)
 		{ debug(5, "startMusicResource(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_MUSIC, NULL); }
 	void startMusic(const char *soundName, int soundId)
-		{ debug(5, "startMusicBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_MUSIC, NULL); }
+		{ debug(0, "startMusicBundle(%s)", soundName); startSound(soundId, soundName, IMUSE_BUNDLE, IMUSE_MUSIC, NULL); }
 	void startSfx(int soundId)
-		{ debug(5, "startSfx(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_SFX, NULL); }
+		{ return;}//debug(5, "startSfx(%d)", soundId); startSound(soundId, NULL, IMUSE_RESOURCE, IMUSE_SFX, NULL); }
 	void startSound(int soundId)
 		{ error("MusicEngine::startSound() Should be never called"); }
 

Index: dimuse_sndmgr.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_sndmgr.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- dimuse_sndmgr.cpp	8 Jan 2004 15:48:41 -0000	1.11
+++ dimuse_sndmgr.cpp	8 Jan 2004 18:25:30 -0000	1.12
@@ -324,12 +324,12 @@
 	return soundHandle->numMarkers;
 }
 
-int ImuseDigiSndMgr::getJumpIdByRegion(soundStruct *soundHandle, int number) {
+int ImuseDigiSndMgr::getJumpIdByRegionId(soundStruct *soundHandle, int number) {
 	Common::StackLock tmpLock(_mutex);
 	assert(soundHandle && checkForProperHandle(soundHandle));
 	assert(number >= 0 && number < soundHandle->numRegions);
 	for (int l = 0; l < soundHandle->numJumps; l++) {
-		if (soundHandle->jump[number].offset == soundHandle->region[l].offset) {
+		if (soundHandle->jump[l].offset == soundHandle->region[number].offset) {
 			return l;
 		}
 	}
@@ -337,13 +337,16 @@
 	return -1;
 }
 
-int ImuseDigiSndMgr::getJumpDestRegionId(soundStruct *soundHandle, int number) {
+int ImuseDigiSndMgr::getRegionIdByHookId(soundStruct *soundHandle, int number) {
 	Common::StackLock tmpLock(_mutex);
 	assert(soundHandle && checkForProperHandle(soundHandle));
-	assert(number >= 0 && number < soundHandle->numJumps);
-	for (int l = 0; l < soundHandle->numRegions; l++) {
-		if (soundHandle->jump[number].dest == soundHandle->region[l].offset) {
-			return l;
+	for (int l = 0; l < soundHandle->numJumps; l++) {
+		if (soundHandle->jump[l].hookId == number) {
+			for (int r = 0; r < soundHandle->numRegions; r++) {
+				if (soundHandle->jump[l].dest == soundHandle->region[r].offset) {
+					return r;
+				}
+			}
 		}
 	}
 

Index: dimuse_sndmgr.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi/dimuse_sndmgr.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- dimuse_sndmgr.h	8 Jan 2004 16:30:37 -0000	1.8
+++ dimuse_sndmgr.h	8 Jan 2004 18:25:30 -0000	1.9
@@ -117,8 +117,8 @@
 	int getNumRegions(soundStruct *soundHandle);
 	int getNumJumps(soundStruct *soundHandle);
 	int getNumMarkers(soundStruct *soundHandle);
-	int getJumpIdByRegion(soundStruct *soundHandle, int number);
-	int getJumpDestRegionId(soundStruct *soundHandle, int number);
+	int getJumpIdByRegionId(soundStruct *soundHandle, int number);
+	int getRegionIdByHookId(soundStruct *soundHandle, int number);
 	int getJumpHookId(soundStruct *soundHandle, int number);
 	int getJumpFade(soundStruct *soundHandle, int number);
 	char *getMarker(soundStruct *soundHandle, int number);





More information about the Scummvm-git-logs mailing list