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

Strangerke noreply at scummvm.org
Fri May 17 21:08:42 UTC 2024


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:
e6c993271f BAGEL: Revert sound assert change, modify the sound flags used for blue and green ships in VildroidFilter(). Reduce some


Commit: e6c993271f36c7477822a405f58198df762dcae9
    https://github.com/scummvm/scummvm/commit/e6c993271f36c7477822a405f58198df762dcae9
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-17T22:07:19+01:00

Commit Message:
BAGEL: Revert sound assert change, modify the sound flags used for blue and green ships in VildroidFilter(). Reduce some if depths.

Changed paths:
    engines/bagel/baglib/sound_object.cpp
    engines/bagel/boflib/sound.cpp
    engines/bagel/spacebar/filter.cpp


diff --git a/engines/bagel/baglib/sound_object.cpp b/engines/bagel/baglib/sound_object.cpp
index 004a3b04032..124e6bb5b51 100644
--- a/engines/bagel/baglib/sound_object.cpp
+++ b/engines/bagel/baglib/sound_object.cpp
@@ -40,7 +40,7 @@ CBagSoundObject::CBagSoundObject() {
 	_pSound = nullptr;
 
 	// Assume MIX if not specified
-	_wFlags = SOUND_MIX; //(SOUND_WAVE | SOUND_ASYNCH);
+	_wFlags = SOUND_MIX;
 
 	_nVol = VOLUME_INDEX_DEFAULT;
 	CBagObject::setState(0);
@@ -94,7 +94,6 @@ bool CBagSoundObject::runObject() {
 	if (((_wFlags & SOUND_MIDI) && CBagMasterWin::getMidi()) || (((_wFlags & SOUND_WAVE) || (_wFlags & SOUND_MIX)) && CBagMasterWin::getDigitalAudio())) {
 
 		if (_pSound && _pMidiSound != _pSound) {
-
 			_pSound->setQSlot(getState());
 			_pSound->play();
 
@@ -116,30 +115,28 @@ bool CBagSoundObject::runObject() {
 
 			if (_wFlags & SOUND_MIDI)
 				_pMidiSound = _pSound;
-		} else { /* if no sound */
-			if (!(_wFlags & SOUND_MIDI)) {
-
-				int nExt = getFileName().getLength() - 4; // ".EXT"
+		} else if (!(_wFlags & SOUND_MIDI)) {
+			/* if no sound */
+			int nExt = getFileName().getLength() - 4; // ".EXT"
 
-				if (nExt <= 0) {
-					logError("Sound does not have a file name or proper extension.  Please write better scripts.");
-					return false;
-				}
+			if (nExt <= 0) {
+				logError("Sound does not have a file name or proper extension.  Please write better scripts.");
+				return false;
+			}
 
-				CBofString sBaseStr = getFileName().left(nExt) + ".TXT";
+			CBofString sBaseStr = getFileName().left(nExt) + ".TXT";
 
-				Common::File f;
-				if (fileExists(sBaseStr) && f.open(sBaseStr.getBuffer())) {
-					Common::String line = f.readLine();
+			Common::File f;
+			if (fileExists(sBaseStr) && f.open(sBaseStr.getBuffer())) {
+				Common::String line = f.readLine();
 
-					bofMessageBox(line.c_str(), "Using .TXT for missing .WAV!");
-					f.close();
-					return true;
-				} else {
-					logError(buildString("Sound TEXT file could not be read: %s.  Why? because we like you ...", getFileName().getBuffer()));
-					return false;
-				}
+				bofMessageBox(line.c_str(), "Using .TXT for missing .WAV!");
+				f.close();
+				return true;
 			}
+
+			logError(buildString("Sound TEXT file could not be read: %s.  Why? because we like you ...", getFileName().getBuffer()));
+			return false;
 		}
 	}
 
@@ -190,12 +187,10 @@ ParseCodes CBagSoundObject::setInfo(CBagIfstream &istr) {
 				getAlphaNumFromStream(istr, sStr);
 
 				if (!sStr.find("WAVE")) {
-					// _xSndType  = WAVE;
 					setWave();
 					nObjectUpdated = true;
 
 				} else if (!sStr.find("MIDI")) {
-					// _xSndType  = MIDI;
 					setMidi();
 					nObjectUpdated = true;
 
@@ -349,7 +344,6 @@ void CBagSoundObject::setPlaying(bool bVal) {
 	if (((_wFlags & SOUND_MIDI) && CBagMasterWin::getMidi()) || (((_wFlags & SOUND_WAVE) || (_wFlags & SOUND_MIX)) && CBagMasterWin::getDigitalAudio())) {
 
 		if (bVal) {
-
 			if (_pSound && _pMidiSound != _pSound) {
 
 				_pSound->setQSlot(getState());
@@ -374,13 +368,10 @@ void CBagSoundObject::setPlaying(bool bVal) {
 				if (_wFlags & SOUND_MIDI)
 					_pMidiSound = _pSound;
 			}
-		} else {
-
-			if (_pSound) {
-				_pSound->stop();
-				if (_wFlags & SOUND_MIDI)
-					_pMidiSound = nullptr;
-			}
+		} else if (_pSound) {
+			_pSound->stop();
+			if (_wFlags & SOUND_MIDI)
+				_pMidiSound = nullptr;
 		}
 	}
 }
diff --git a/engines/bagel/boflib/sound.cpp b/engines/bagel/boflib/sound.cpp
index 0dd0be7a8c0..a7a5126fe37 100644
--- a/engines/bagel/boflib/sound.cpp
+++ b/engines/bagel/boflib/sound.cpp
@@ -228,7 +228,7 @@ bool CBofSound::play(uint32 dwBeginHere, uint32 TimeFormatFlag) {
 		}
 
 		// WAVE and MIX are mutually exclusive
-		assert(!((_wFlags & SOUND_WAVE) && (_wFlags & SOUND_MIDI)));
+		assert(!((_wFlags & SOUND_WAVE) && (_wFlags & SOUND_MIX)));
 
 		if (_wFlags & SOUND_WAVE) {
 			if (_wFlags & SOUND_QUEUE)
@@ -823,24 +823,19 @@ void CBofSound::audioTask() {
 						pSound->stop();
 					}
 
-				} else {
-
+				} else if (pSound->_bInQueue && !pSound->_bStarted) {
 					// If this is a Queued sound, and has not already started
-					if (pSound->_bInQueue && !pSound->_bStarted) {
-						// And it is time to play
-						if ((CBofSound *)_cQueue[pSound->_iQSlot]->getQItem() == pSound) {
-							pSound->playWAV();
-						}
+					// And it is time to play
+					if ((CBofSound *)_cQueue[pSound->_iQSlot]->getQItem() == pSound) {
+						pSound->playWAV();
 					}
 				}
 
-			} else if (pSound->_wFlags & SOUND_MIDI) {
-				if (pSound->_bPlaying) {
-					// And, Is it done?
-					if (!g_engine->_midi->isPlaying()) {
-						// Kill it
-						pSound->stop();
-					}
+			} else if ((pSound->_wFlags & SOUND_MIDI) && pSound->_bPlaying) {
+				// And, Is it done?
+				if (!g_engine->_midi->isPlaying()) {
+					// Kill it
+					pSound->stop();
 				}
 			}
 		}
diff --git a/engines/bagel/spacebar/filter.cpp b/engines/bagel/spacebar/filter.cpp
index b710b492b6d..c4e28d90fe0 100644
--- a/engines/bagel/spacebar/filter.cpp
+++ b/engines/bagel/spacebar/filter.cpp
@@ -168,33 +168,24 @@ void lightningInitFilters() {
 }
 
 void destroyFilters() {
-	if (pTipBmp) {
-		delete pTipBmp;
-		pTipBmp = nullptr;
-	}
-	if (pGrafittiBmp) {
-		delete pGrafittiBmp;
-		pGrafittiBmp = nullptr;
-	}
+	delete pTipBmp;
+	pTipBmp = nullptr;
+
+	delete pGrafittiBmp;
+	pGrafittiBmp = nullptr;
 
 	// clean up trisecks bmp
-	if (pTriBmp) {
-		delete pTriBmp;
-		pTriBmp = nullptr;
-	}
+	delete pTriBmp;
+	pTriBmp = nullptr;
 
 	// Chip bitmap is destroyed here is the cleanup function because
 	// presumably we're being called when the game is ending.
-	if (pChipBmp) {
-		delete pChipBmp;
-		pChipBmp = nullptr;
-	}
+	delete pChipBmp;
+	pChipBmp = nullptr;
 
 	// Clean up the lightning filter.
-	if (pThunder) {
-		delete pThunder;
-		pThunder = nullptr;
-	}
+	delete pThunder;
+	pThunder = nullptr;
 
 	// Record the fact that the filter bitmaps need to be instantiated
 	// before they can be used again.
@@ -555,7 +546,7 @@ static bool VildroidFilter(CBofBitmap *pBmp, CBofRect *pRect) {
 			if (pChipBmp != nullptr) {
 				int rdef = g_engine->viewRect.width() - VILDROIDCHIPTEXTWIDTH;
 				int tdef = g_engine->viewRect.height() - 300;
-				CBofRect tmprct(0, 0, VILDROIDCHIPTEXTWIDTH, 300);                 // (tdef/2)
+				CBofRect tmprct(0, 0, VILDROIDCHIPTEXTWIDTH, 300);
 
 				pChipBmp->paint(pBmp, ((rdef / 2) + g_engine->viewRect.left), (tdef + g_engine->viewRect.top), &tmprct, 0);
 			}
@@ -572,7 +563,7 @@ static bool VildroidFilter(CBofBitmap *pBmp, CBofRect *pRect) {
 				CBofString cString(szCString, 256);
 				cString = DISCEJECTSOUND;
 				fixPathName(cString);
-				BofPlaySound(cString, SOUND_WAVE | SOUND_MIX);
+				BofPlaySound(cString, SOUND_WAVE | SOUND_ASYNCH);
 				CBagStorageDev *pWieldSDev = nullptr;
 				pWieldSDev = g_SDevManager->getStorageDevice("BWIELD_WLD");
 				if (chipID == 1)




More information about the Scummvm-git-logs mailing list