[Scummvm-git-logs] scummvm master -> 2f9ddb0a6e4441dd6968863a7c99aef090330e26

neuromancer noreply at scummvm.org
Sun Aug 31 15:09:33 UTC 2025


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

Summary:
2af101694b FREESCAPE: support converted music for eclipse
2f9ddb0a6e FREESCAPE: refactored how movement and sounds interact


Commit: 2af101694bd661a5c932fce74fba0ab44d0e57c7
    https://github.com/scummvm/scummvm/commit/2af101694bd661a5c932fce74fba0ab44d0e57c7
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-08-31T17:12:04+02:00

Commit Message:
FREESCAPE: support converted music for eclipse

Changed paths:
    engines/freescape/games/eclipse/eclipse.cpp


diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index 9d1d9538806..a62f9f54860 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -110,6 +110,9 @@ void EclipseEngine::initGameState() {
 	_lastThirtySeconds = seconds / 30;
 	_lastFiveSeconds = seconds / 5;
 	_resting = false;
+
+	// Start playing music, if any, in any supported format
+	playMusic("Total Eclipse Theme");
 }
 
 void EclipseEngine::loadAssets() {


Commit: 2f9ddb0a6e4441dd6968863a7c99aef090330e26
    https://github.com/scummvm/scummvm/commit/2f9ddb0a6e4441dd6968863a7c99aef090330e26
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-08-31T17:12:04+02:00

Commit Message:
FREESCAPE: refactored how movement and sounds interact

Changed paths:
    engines/freescape/events.cpp
    engines/freescape/freescape.cpp
    engines/freescape/freescape.h
    engines/freescape/games/castle/castle.cpp
    engines/freescape/games/dark/dark.cpp
    engines/freescape/games/driller/driller.cpp
    engines/freescape/games/eclipse/eclipse.cpp
    engines/freescape/language/instruction.cpp
    engines/freescape/movement.cpp
    engines/freescape/sound.cpp
    engines/freescape/ui.cpp


diff --git a/engines/freescape/events.cpp b/engines/freescape/events.cpp
index 622931cd4fb..1257b8448aa 100644
--- a/engines/freescape/events.cpp
+++ b/engines/freescape/events.cpp
@@ -100,7 +100,7 @@ bool EventManagerWrapper::pollEvent(Common::Event &event) {
 
 void EventManagerWrapper::purgeKeyboardEvents() {
 	_delegate->purgeKeyboardEvents();
-	_currentKeyDown.keycode = Common::KEYCODE_INVALID;
+	_currentKeyDown.reset();
 	_currentActionDown = kActionNone;
 	_keyRepeatTime = 0;
 }
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index d4ae7f447ae..4304147c0eb 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -107,7 +107,7 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd)
 	_lastPosition = Math::Vector3d(0, 0, 0);
 	_hasFallen = false;
 	_isCollidingWithWall = false;
-	_isStepping = false;
+	_isSteppingUp = false;
 	_isFalling = false;
 	_maxFallingDistance = 64;
 	_velocity = Math::Vector3d(0, 0, 0);
@@ -945,32 +945,32 @@ bool FreescapeEngine::checkIfGameEnded() {
 		return false;
 
 	if (_gameStateVars[k8bitVariableShield] == 0) {
-		playSound(_soundIndexNoShield, true);
+		playSound(_soundIndexNoShield, true, _soundFxHandle);
 
 		if (!_noShieldMessage.empty())
 			insertTemporaryMessage(_noShieldMessage, _countdown - 2);
 		_gameStateControl = kFreescapeGameStateEnd;
 	} else if (_gameStateVars[k8bitVariableEnergy] == 0 && isDriller()) {
-		playSound(_soundIndexNoEnergy, true);
+		playSound(_soundIndexNoEnergy, true, _soundFxHandle);
 
 		if (!_noEnergyMessage.empty())
 			insertTemporaryMessage(_noEnergyMessage, _countdown - 2);
 		_gameStateControl = kFreescapeGameStateEnd;
 	} else if (_hasFallen) {
 		_hasFallen = false;
-		playSound(_soundIndexFallen, false);
+		playSound(_soundIndexFallen, false, _soundFxHandle);
 
 		if (!_fallenMessage.empty())
 			insertTemporaryMessage(_fallenMessage, _countdown - 4);
 		_gameStateControl = kFreescapeGameStateEnd;
 	} else if (_countdown <= 0) {
-		playSound(_soundIndexTimeout, false);
+		playSound(_soundIndexTimeout, false, _soundFxHandle);
 
 		if (!_timeoutMessage.empty())
 			insertTemporaryMessage(_timeoutMessage, _countdown - 4);
 		_gameStateControl = kFreescapeGameStateEnd;
 	} else if (_playerWasCrushed) {
-		playSound(_soundIndexCrushed, true);
+		playSound(_soundIndexCrushed, true, _soundFxHandle);
 
 		_playerWasCrushed = false;
 		if (!_crushedMessage.empty())
@@ -980,7 +980,7 @@ bool FreescapeEngine::checkIfGameEnded() {
 		// so no need to wait for the end of the game
 		_endGameDelayTicks = 0;
 	} else if (_forceEndGame) {
-		playSound(_soundIndexForceEndGame, true);
+		playSound(_soundIndexForceEndGame, true, _soundFxHandle);
 
 		_forceEndGame = false;
 		if (!_forceEndGameMessage.empty())
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 5d31ad0af6c..a85d836a6d4 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -349,6 +349,7 @@ public:
 	EventManagerWrapper *_eventManager;
 	void processInput();
 	void resetInput();
+	void stopMovement();
 	void generateDemoInput();
 	virtual void pressedKey(const int keycode);
 	virtual void releasedKey(const int keycode);
@@ -372,7 +373,8 @@ public:
 	bool tryStepDown(Math::Vector3d currentPosition);
 	bool _hasFallen;
 	bool _isCollidingWithWall;
-	bool _isStepping;
+	bool _isSteppingUp;
+	bool _isSteppingDown;
 	bool _isFalling;
 	int _maxFallingDistance;
 	int _maxShield;
@@ -463,15 +465,16 @@ public:
 	// Sound
 	Audio::SoundHandle _soundFxHandle;
 	Audio::SoundHandle _musicHandle;
+	Audio::SoundHandle _movementSoundHandle;
 	Freescape::SizedPCSpeaker *_speaker;
 
 	bool _syncSound;
 	bool _firstSound;
 	bool _usePrerecordedSounds;
 	void waitForSounds();
-	void stopAllSounds();
+	void stopAllSounds(Audio::SoundHandle &handle);
 	bool isPlayingSound();
-	void playSound(int index, bool sync);
+	void playSound(int index, bool sync, Audio::SoundHandle &handle);
 	void playWav(const Common::Path &filename);
 	void playMusic(const Common::Path &filename);
 	void queueSoundConst(double hzFreq, int duration);
@@ -479,7 +482,7 @@ public:
 	void playSoundConst(double hzFreq, int duration, bool sync);
 	void playSoundSweepIncWL(double hzFreq1, double hzFreq2, double wlStepPerMS, int resolution, bool sync);
 	uint16 playSoundDOSSpeaker(uint16 startFrequency, soundSpeakerFx *speakerFxInfo);
-	void playSoundDOS(soundSpeakerFx *speakerFxInfo, bool sync);
+	void playSoundDOS(soundSpeakerFx *speakerFxInfo, bool sync, Audio::SoundHandle &handle);
 
 	virtual void playSoundFx(int index, bool sync);
 	virtual void loadSoundsFx(Common::SeekableReadStream *file, int offset, int number);
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 64f077e926c..b07c3c38d2a 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -330,17 +330,17 @@ void CastleEngine::gotoArea(uint16 areaID, int entranceID) {
 
 	if (areaID == _startArea && entranceID == _startEntrance) {
 		if (getGameBit(31))
-			playSound(13, true);
+			playSound(13, true, _soundFxHandle);
 		else
-			playSound(_soundIndexStart, false);
+			playSound(_soundIndexStart, false, _soundFxHandle);
 	} else if (areaID == _endArea && entranceID == _endEntrance) {
 		_pitch = -85;
 	} else {
 		// If escaped, play a different sound
 		if (getGameBit(31))
-			playSound(13, true);
+			playSound(13, true, _soundFxHandle);
 		else
-			playSound(_soundIndexAreaChange, true);
+			playSound(_soundIndexAreaChange, true, _soundFxHandle);
 	}
 
 	debugC(1, kFreescapeDebugMove, "starting player position: %f, %f, %f", _position.x(), _position.y(), _position.z());
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 020906d7d69..1a553822265 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -510,8 +510,8 @@ bool DarkEngine::checkIfGameEnded() {
 		} else {
 			restoreECD(*_currentArea, index);
 			insertTemporaryMessage(_messagesList[1], _countdown - 2);
-			stopAllSounds();
-			playSound(_soundIndexRestoreECD, false);
+			stopAllSounds(_movementSoundHandle);
+			playSound(_soundIndexRestoreECD, false, _soundFxHandle);
 		}
 		_gameStateVars[kVariableDarkECD] = 0;
 
@@ -644,11 +644,11 @@ void DarkEngine::gotoArea(uint16 areaID, int entranceID) {
 	_gameStateVars[0x1f] = 0;
 
 	if (areaID == _startArea && entranceID == _startEntrance) {
-		playSound(_soundIndexStart, true);
+		playSound(_soundIndexStart, true, _soundFxHandle);
 	} else if (areaID == _endArea && entranceID == _endEntrance) {
 		_pitch = 10;
 	} else {
-		playSound(_soundIndexAreaChange, false);
+		playSound(_soundIndexAreaChange, false, _soundFxHandle);
 	}
 
 	debugC(1, kFreescapeDebugMove, "starting player position: %f, %f, %f", _position.x(), _position.y(), _position.z());
@@ -861,7 +861,7 @@ void DarkEngine::drawIndicator(Graphics::Surface *surface, int xPosition, int yP
 void DarkEngine::drawSensorShoot(Sensor *sensor) {
 	if (_gameStateControl == kFreescapeGameStatePlaying) {
 		// Avoid playing new sounds, so the endgame can progress
-		playSound(_soundIndexHit, true);
+		playSound(_soundIndexHit, true, _soundFxHandle);
 	}
 
 	Math::Vector3d target;
@@ -951,7 +951,7 @@ void DarkEngine::drawInfoMenu() {
 					saveGameDialog();
 					_gfx->setViewport(_viewArea);
 				} else if (isDOS() && event.customType == kActionToggleSound) {
-					playSound(6, true);
+					playSound(6, true, _soundFxHandle);
 				} else if (event.customType == kActionEscape) {
 					_forceEndGame = true;
 					cont = false;
diff --git a/engines/freescape/games/driller/driller.cpp b/engines/freescape/games/driller/driller.cpp
index 962539b04ba..8da3eceb92f 100644
--- a/engines/freescape/games/driller/driller.cpp
+++ b/engines/freescape/games/driller/driller.cpp
@@ -280,7 +280,7 @@ void DrillerEngine::gotoArea(uint16 areaID, int entranceID) {
 		if (isC64())
 			_playerSid->startMusic();
 		else {
-			playSound(_soundIndexStart, true);
+			playSound(_soundIndexStart, true, _soundFxHandle);
 			// Start playing music, if any, in any supported format
 			playMusic("Matt Gray - The Best Of Reformation - 07 Driller Theme");
 		}
@@ -292,7 +292,7 @@ void DrillerEngine::gotoArea(uint16 areaID, int entranceID) {
 		// Show the number of completed areas
 		_areaMap[127]->_name.replace(0, 3, Common::String::format("%4d", _gameStateVars[32]));
 	} else
-		playSound(_soundIndexAreaChange, false);
+		playSound(_soundIndexAreaChange, false, _soundFxHandle);
 
 	debugC(1, kFreescapeDebugMove, "starting player position: %f, %f, %f", _position.x(), _position.y(), _position.z());
 	clearTemporalMessages();
@@ -967,7 +967,7 @@ bool DrillerEngine::onScreenControls(Common::Point mouse) {
 void DrillerEngine::drawSensorShoot(Sensor *sensor) {
 	if (_gameStateControl == kFreescapeGameStatePlaying) {
 		// Avoid playing new sounds, so the endgame can progress
-		playSound(_soundIndexHit, true);
+		playSound(_soundIndexHit, true, _soundFxHandle);
 	}
 
 	Math::Vector3d target;
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index a62f9f54860..2c060fb3b94 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -35,7 +35,7 @@ namespace Freescape {
 EclipseEngine::EclipseEngine(OSystem *syst, const ADGameDescription *gd) : FreescapeEngine(syst, gd) {
 	// These sounds can be overriden by the class of each platform
 	_soundIndexShoot = 8;
-	_soundIndexCollide = 4;
+	_soundIndexCollide = 1;
 	_soundIndexFall = 3;
 	_soundIndexClimb = 3;
 	_soundIndexMenu = -1;
@@ -178,8 +178,9 @@ bool EclipseEngine::checkIfGameEnded() {
 			if (isDOS())
 				playSoundFx(4, false);
 			else
-				playSound(_soundIndexStartFalling, false);
+				playSound(_soundIndexStartFalling, false, _soundFxHandle);
 
+			stopMovement();
 			// If shield is less than 11 after a fall, the game ends
 			if (_gameStateVars[k8bitVariableShield] > 15 + 11) {
 				_gameStateVars[k8bitVariableShield] -= 15;
@@ -221,7 +222,7 @@ void EclipseEngine::endGame() {
 
 	if (_endGameKeyPressed && (_countdown == 0 || _countdown == -3600)) {
 		if (isSpectrum())
-			playSound(5, true);
+			playSound(5, true, _soundFxHandle);
 		_gameStateControl = kFreescapeGameStateRestart;
 	}
 	_endGameKeyPressed = false;
@@ -312,7 +313,7 @@ void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
 	_lastPosition = _position;
 
 	if (areaID == _startArea && entranceID == _startEntrance) {
-		playSound(_soundIndexStart, true);
+		playSound(_soundIndexStart, true, _soundFxHandle);
 		if (isEclipse2()) {
 			_gameStateControl = kFreescapeGameStateStart;
 			_pitch = -10;
@@ -325,7 +326,7 @@ void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
 		else
 			_pitch = 10;
 	} else {
-		playSound(_soundIndexAreaChange, false);
+		playSound(_soundIndexAreaChange, false, _soundFxHandle);
 	}
 
 	_gfx->_keyColor = 0;
@@ -453,7 +454,7 @@ void EclipseEngine::drawInfoMenu() {
 					saveGameDialog();
 					_gfx->setViewport(_viewArea);
 				} else if (isDOS() && event.customType == kActionToggleSound) {
-					playSound(_soundIndexMenu, true);
+					playSound(_soundIndexMenu, true, _soundFxHandle);
 				} else if ((isDOS() || isCPC() || isSpectrum()) && event.customType == kActionEscape) {
 					_forceEndGame = true;
 					cont = false;
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index e46598bdffa..3695fcadbfd 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -355,13 +355,12 @@ void FreescapeEngine::executeExecute(FCLInstruction &instruction, bool shot, boo
 }
 
 void FreescapeEngine::executeSound(FCLInstruction &instruction) {
-	if (_firstSound)
-		stopAllSounds();
+	stopAllSounds(_movementSoundHandle);
 	_firstSound = false;
 	uint16 index = instruction._source;
 	bool sync = instruction._additional;
 	debugC(1, kFreescapeDebugCode, "Playing sound %d", index);
-	playSound(index, sync);
+	playSound(index, sync, _soundFxHandle);
 }
 
 void FreescapeEngine::executeDelay(FCLInstruction &instruction) {
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index 2cb5fa525eb..a145a7be1b5 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -218,7 +218,7 @@ void FreescapeEngine::shoot() {
 	if (_shootingFrames > 0) // No more than one shot at a time
 		return;
 
-	playSound(_soundIndexShoot, false);
+	playSound(_soundIndexShoot, false, _movementSoundHandle);
 	g_system->delayMillis(2);
 	_shootingFrames = 10;
 
@@ -471,15 +471,8 @@ void FreescapeEngine::resolveCollisions(Math::Vector3d const position) {
 
 	_gotoExecuted = false;
 	bool executed = runCollisionConditions(lastPosition, newPosition);
-	if (executed) {
-		_moveForward = false;
-		_moveBackward = false;
-		_strafeLeft = false;
-		_strafeRight = false;
-		_moveUp = false;
-		_moveDown = false;
-		_eventManager->purgeKeyboardEvents();
-	}
+	if (executed)
+		stopMovement();
 
 	if (_gotoExecuted) {
 		_gotoExecuted = false;
@@ -492,12 +485,16 @@ void FreescapeEngine::resolveCollisions(Math::Vector3d const position) {
 		if ((lastPosition - newPosition).length() < 1) { // Something is blocking the player
 			if (!executed)
 				setGameBit(31);
-			playSound(_soundIndexClimb, false);
+			playSound(_soundIndexCollide, false, _movementSoundHandle);
 		}
 		_position = newPosition;
 		return;
 	}
 
+	bool isSteppingUp = false;
+	bool isSteppingDown = false;
+	bool isCollidingWithWall = false;
+
 	// If the player has not moved, try to step up
 	if ((lastPosition - newPosition).length() < 1) { // If the player has not moved
 		// Try to step up
@@ -509,19 +506,13 @@ void FreescapeEngine::resolveCollisions(Math::Vector3d const position) {
 
 		newPosition = _currentArea->resolveCollisions(lastPosition, newPosition, _playerHeight);
 		if (_lastPosition.y() < newPosition.y())
-			playSound(_soundIndexClimb, false);
-	}
+			isSteppingUp = true;
 
-	if ((lastPosition - newPosition).length() < 1) { // Something is blocking the player
 		if (!executed)
 			setGameBit(31);
 
-		debug("Player blocked at position %f %f %f playing collision sound!", newPosition.x(), newPosition.y(), newPosition.z());
-		if (!_isCollidingWithWall)
-			playSound(_soundIndexCollide, false);
-		_isCollidingWithWall = true;
-	} else
-		_isCollidingWithWall = false;
+		isCollidingWithWall = true;
+	}
 
 	// Check for falling
 	lastPosition = newPosition;
@@ -541,17 +532,46 @@ void FreescapeEngine::resolveCollisions(Math::Vector3d const position) {
 		_endGameDelayTicks = 60 * 5;
 		if (isEclipse()) // No need for an variable index, since these are special types of sound
 			playSoundFx(0, true);
+
+		if (_hasFallen)
+			stopMovement();
 	}
 
 	if (!_hasFallen && fallen > 0) {
-		playSound(_soundIndexFall, false);
-
+		isSteppingDown = true;
 		// Position in Y was changed, let's re-run effects
-		runCollisionConditions(lastPosition, newPosition);
+		if (runCollisionConditions(lastPosition, newPosition))
+			stopMovement();
+	}
+
+
+	if (isSteppingUp)  {
+		debug("Stepping up sound!");
+		if (!_mixer->isSoundHandleActive(_movementSoundHandle))
+			playSound(_soundIndexClimb, false, _movementSoundHandle);
+	} else if (isSteppingDown) {
+		debug("Stepping down sound!");
+		if (!_mixer->isSoundHandleActive(_movementSoundHandle))
+			playSound(_soundIndexFall, false, _movementSoundHandle);
+	} else if (isCollidingWithWall) {
+		debug("Colliding with wall sound!");
+		if (!_mixer->isSoundHandleActive(_movementSoundHandle))
+			playSound(_soundIndexCollide, false, _movementSoundHandle);
 	}
+
 	_position = newPosition;
 }
 
+void FreescapeEngine::stopMovement() {
+	_moveForward = false;
+	_moveBackward = false;
+	_strafeLeft = false;
+	_strafeRight = false;
+	_moveUp = false;
+	_moveDown = false;
+	_eventManager->purgeKeyboardEvents();
+}
+
 bool FreescapeEngine::runCollisionConditions(Math::Vector3d const lastPosition, Math::Vector3d const newPosition) {
 	bool executed = false;
 	GeometricObject *gobj = nullptr;
@@ -568,7 +588,7 @@ bool FreescapeEngine::runCollisionConditions(Math::Vector3d const lastPosition,
 
 	if (_gotoExecuted) {
 		executeMovementConditions();
-		return collided;
+		return true;
 	}
 
 	Math::Vector3d direction = newPosition - lastPosition;
diff --git a/engines/freescape/sound.cpp b/engines/freescape/sound.cpp
index e10381fb3d4..77bff5dadea 100644
--- a/engines/freescape/sound.cpp
+++ b/engines/freescape/sound.cpp
@@ -299,7 +299,7 @@ void FreescapeEngine::loadSpeakerFxDOS(Common::SeekableReadStream *file, int off
 	}
 }
 
-void FreescapeEngine::playSound(int index, bool sync) {
+void FreescapeEngine::playSound(int index, bool sync, Audio::SoundHandle &handle) {
 	if (index < 0) {
 		debugC(1, kFreescapeDebugMedia, "Sound not specified");
 		return;
@@ -319,7 +319,7 @@ void FreescapeEngine::playSound(int index, bool sync) {
 	if (isDOS()) {
 		soundSpeakerFx *speakerFxInfo = _soundsSpeakerFx[index];
 		if (speakerFxInfo)
-			playSoundDOS(speakerFxInfo, sync);
+			playSoundDOS(speakerFxInfo, sync, handle);
 		else
 			debugC(1, kFreescapeDebugMedia, "WARNING: Sound %d is not available", index);
 
@@ -416,7 +416,6 @@ void FreescapeEngine::playMusic(const Common::Path &filename) {
 		_mixer->stopHandle(_musicHandle);
 		Audio::LoopingAudioStream *loop = new Audio::LoopingAudioStream(stream, 0);
 		_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, loop);
-		_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, Audio::Mixer::kMaxChannelVolume / 10);
 	}
 }
 
@@ -448,9 +447,9 @@ void FreescapeEngine::playSoundFx(int index, bool sync) {
 	}
 }
 
-void FreescapeEngine::stopAllSounds() {
+void FreescapeEngine::stopAllSounds(Audio::SoundHandle &handle) {
 	_speaker->stop();
-	_mixer->stopHandle(_soundFxHandle);
+	_mixer->stopHandle(handle);
 }
 
 void FreescapeEngine::waitForSounds() {
@@ -533,7 +532,7 @@ void FreescapeEngine::playSoundZX(Common::Array<soundUnitZX> *data) {
 	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundFxHandle, _speaker, -1, kFreescapeDefaultVolume, 0, DisposeAfterUse::NO);
 }
 
-void FreescapeEngine::playSoundDOS(soundSpeakerFx *speakerFxInfo, bool sync) {
+void FreescapeEngine::playSoundDOS(soundSpeakerFx *speakerFxInfo, bool sync, Audio::SoundHandle &handle) {
 	uint freq = speakerFxInfo->frequencyStart;
 
 	for (int i = 0; i < speakerFxInfo->repetitions; i++) {
@@ -545,8 +544,8 @@ void FreescapeEngine::playSoundDOS(soundSpeakerFx *speakerFxInfo, bool sync) {
 		}
 	}
 
-	_mixer->stopHandle(_soundFxHandle);
-	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundFxHandle, _speaker, -1, kFreescapeDefaultVolume / 2, 0, DisposeAfterUse::NO);
+	_mixer->stopHandle(handle);
+	_mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, _speaker, -1, kFreescapeDefaultVolume / 2, 0, DisposeAfterUse::NO);
 }
 
 void FreescapeEngine::loadSoundsFx(Common::SeekableReadStream *file, int offset, int number) {
diff --git a/engines/freescape/ui.cpp b/engines/freescape/ui.cpp
index 88acfc41e5c..3353b20e894 100644
--- a/engines/freescape/ui.cpp
+++ b/engines/freescape/ui.cpp
@@ -345,7 +345,7 @@ void FreescapeEngine::drawBorderScreenAndWait(Graphics::Surface *surface, int ma
 		g_system->updateScreen();
 		g_system->delayMillis(15); // try to target ~60 FPS
 	}
-	playSound(_soundIndexMenu, false);
+	playSound(_soundIndexMenu, false, _soundFxHandle);
 	_gfx->clear(0, 0, 0, true);
 }
 




More information about the Scummvm-git-logs mailing list