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

neuromancer noreply at scummvm.org
Fri Jan 27 07:27:31 UTC 2023


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:
bbc17db71e FREESCAPE: make sure first sound to play is not interrupted


Commit: bbc17db71ecef4c93e54a6c86f847ea0c8cb6eaf
    https://github.com/scummvm/scummvm/commit/bbc17db71ecef4c93e54a6c86f847ea0c8cb6eaf
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-01-27T08:28:37+01:00

Commit Message:
FREESCAPE: make sure first sound to play is not interrupted

Changed paths:
    engines/freescape/freescape.cpp
    engines/freescape/freescape.h
    engines/freescape/language/instruction.cpp
    engines/freescape/movement.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 3b61e3e21e4..bd6bfa77441 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -98,6 +98,7 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd)
 	_noClipMode = false;
 	_forceEndGame = false;
 	_syncSound = false;
+	_firstSound = false;
 	_playerHeightNumber = 1;
 	_angleRotationIndex = 0;
 
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 00fbbc59573..30c5cd555dc 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -80,7 +80,7 @@ struct soundFx {
 
 class SizedPCSpeaker : public Audio::PCSpeaker {
 public:
-	bool endOfStream() const override { return (_commandQueue->size() == 0); }
+	bool endOfStream() const override { return !isPlaying(); }
 };
 
 class FreescapeEngine : public Engine {
@@ -269,6 +269,7 @@ public:
 	Freescape::SizedPCSpeaker *_speaker;
 
 	bool _syncSound;
+	bool _firstSound;
 	bool _usePrerecordedSounds;
 	void waitForSounds();
 	void stopAllSounds();
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index 368a6671037..204f1bce1a6 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -69,7 +69,7 @@ Token::Type FCLInstruction::getType() {
 void FreescapeEngine::executeObjectConditions(GeometricObject *obj, bool shot, bool collided) {
 	assert(obj != nullptr);
 	if (!obj->_conditionSource.empty()) {
-		stopAllSounds();
+		_firstSound = true;
 		_objExecutingCodeSize = obj->getSize();
 		debugC(1, kFreescapeDebugCode, "Executing with collision flag: %s", obj->_conditionSource.c_str());
 		executeCode(obj->_condition, shot, collided);
@@ -190,6 +190,9 @@ void FreescapeEngine::executeRedraw(FCLInstruction &instruction) {
 }
 
 void FreescapeEngine::executeSound(FCLInstruction &instruction) {
+	if (_firstSound)
+		stopAllSounds();
+	_firstSound = false;
 	uint16 index = instruction._source;
 	bool sync = instruction._additional;
 	debugC(1, kFreescapeDebugCode, "Playing sound %d", index);
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index fece50df485..d3db2059aaf 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -70,8 +70,8 @@ void FreescapeEngine::traverseEntrance(uint16 entranceID) {
 }
 
 void FreescapeEngine::shoot() {
-	//_mixer->stopHandle(_soundFxHandle);
 	playSound(1, false);
+	g_system->delayMillis(2);
 	_shootingFrames = 4;
 
 	Common::Point center(_viewArea.left + _viewArea.width() / 2, _viewArea.top + _viewArea.height() / 2);
@@ -235,7 +235,7 @@ void FreescapeEngine::move(CameraMovement direction, uint8 scale, float deltaTim
 				return;
 			}
 			_position.set(_position.x(), positionY - fallen, _position.z());
-			if (isPlayingSound())
+			if (!isPlayingSound())
 				playSound(3, false);
 		}
 		debugC(1, kFreescapeDebugCode, "Runing effects:");




More information about the Scummvm-git-logs mailing list