[Scummvm-git-logs] scummvm master -> b1fb0bce6dae53366ffd07827d325eb6237d520b

AndywinXp noreply at scummvm.org
Sun Jan 16 21:34:23 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b1fb0bce6d SCUMM: DiMUSE: Clean-up duplicate code in Dispatch


Commit: b1fb0bce6dae53366ffd07827d325eb6237d520b
    https://github.com/scummvm/scummvm/commit/b1fb0bce6dae53366ffd07827d325eb6237d520b
Author: Andrea Boscarino (andywinxp at gmail.com)
Date: 2022-01-16T22:34:21+01:00

Commit Message:
SCUMM: DiMUSE: Clean-up duplicate code in Dispatch

Also, fixed some missing nullptr values

Changed paths:
    engines/scumm/imuse_digi/dimuse_dispatch.cpp


diff --git a/engines/scumm/imuse_digi/dimuse_dispatch.cpp b/engines/scumm/imuse_digi/dimuse_dispatch.cpp
index d07301c5337..5c72c8bc344 100644
--- a/engines/scumm/imuse_digi/dimuse_dispatch.cpp
+++ b/engines/scumm/imuse_digi/dimuse_dispatch.cpp
@@ -186,7 +186,7 @@ int IMuseDigital::dispatchAllocateSound(IMuseDigiTrack *trackPtr, int groupId) {
 	trackDispatch = trackPtr->dispatchPtr;
 	trackDispatch->currentOffset = 0;
 	trackDispatch->audioRemaining = 0;
-	trackDispatch->fadeBuf = 0;
+	trackDispatch->fadeBuf = nullptr;
 
 	if (_isEarlyDiMUSE) {
 		trackDispatch->vocLoopStartingPoint = 0;
@@ -209,7 +209,7 @@ int IMuseDigital::dispatchAllocateSound(IMuseDigiTrack *trackPtr, int groupId) {
 		trackDispatch->streamZoneList = 0;
 		trackDispatch->streamErrFlag = 0;
 	} else {
-		trackDispatch->streamPtr = 0;
+		trackDispatch->streamPtr = nullptr;
 		if (_isEarlyDiMUSE)
 			return dispatchSeekToNextChunk(trackDispatch);
 	}
@@ -218,27 +218,9 @@ int IMuseDigital::dispatchAllocateSound(IMuseDigiTrack *trackPtr, int groupId) {
 	if (!navigateMapResult || navigateMapResult == -3)
 		return 0;
 
-	// At this point, something went wrong, so deallocate what we have to...
+	// At this point, something went wrong, so let's release the dispatch
 	debug(5, "IMuseDigital::dispatchAllocateSound(): problem starting sound (%d) in dispatch", trackPtr->soundId);
-
-	// Remove streamZones from list
-	dispatchToDeallocate = trackDispatch->trackPtr->dispatchPtr;
-	if (dispatchToDeallocate->streamPtr) {
-		streamZoneList = dispatchToDeallocate->streamZoneList;
-		streamerClearSoundInStream(dispatchToDeallocate->streamPtr);
-		if (dispatchToDeallocate->streamZoneList) {
-			do {
-				streamZoneList->useFlag = 0;
-				removeStreamZoneFromList(&dispatchToDeallocate->streamZoneList, streamZoneList);
-			} while (streamZoneList);
-		}
-	}
-
-	if (!dispatchToDeallocate->fadeBuf)
-		return -1;
-
-	// Mark the fade corresponding to our fadeBuf as unused
-	dispatchDeallocateFade(dispatchToDeallocate, "dispatchAllocateSound");
+	dispatchRelease(trackPtr);
 	return -1;
 }
 
@@ -265,11 +247,10 @@ int IMuseDigital::dispatchRelease(IMuseDigiTrack *trackPtr) {
 		}
 	}
 
-	if (!dispatchToDeallocate->fadeBuf)
-		return 0;
-
 	// Mark the fade corresponding to our fadeBuf as unused
-	dispatchDeallocateFade(dispatchToDeallocate, "dispatchRelease");
+	if (dispatchToDeallocate->fadeBuf)
+		dispatchDeallocateFade(dispatchToDeallocate, "dispatchRelease");
+
 	return 0;
 }
 




More information about the Scummvm-git-logs mailing list