[Scummvm-git-logs] scummvm master -> 4f50129e4a76b3b14b600e7237b290d4db4457fb

neuromancer noreply at scummvm.org
Sun Aug 11 18:53:44 UTC 2024


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

Summary:
a576435c92 FREESCAPE: better rendering of text on menus before start a game
00e34d3ad4 FREESCAPE: more custom actions for castle
a792e17853 FREESCAPE: refactored part of zx sound generation code and added some missing sounds in dark and eclipse
4f50129e4a FREESCAPE: improved sounds for dark in zx


Commit: a576435c9250ae7185e7cdf66ab49fe74a7c8428
    https://github.com/scummvm/scummvm/commit/a576435c9250ae7185e7cdf66ab49fe74a7c8428
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-08-11T20:25:28+02:00

Commit Message:
FREESCAPE: better rendering of text on menus before start a game

Changed paths:
    engines/freescape/games/castle/castle.cpp
    engines/freescape/ui.cpp


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 6d1528549cc..ef55bc25f9d 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -773,22 +773,46 @@ extern Common::String centerAndPadString(const Common::String &x, int y);
 
 void CastleEngine::selectCharacterScreen() {
 	Common::Array<Common::String> lines;
-	if (isDOS()) {
-		lines.push_back("Select your character");
-		lines.push_back("");
-		lines.push_back("");
-		lines.push_back("            1. Prince");
-		lines.push_back("            2. Princess");
-	} else if (isSpectrum()) {
-		lines.push_back(centerAndPadString("*******************", 21));
-		lines.push_back(centerAndPadString("Select your character", 21));
-		lines.push_back(centerAndPadString("you wish to play", 21));
-		lines.push_back(centerAndPadString("and press enter", 21));
-		lines.push_back("");
-		lines.push_back(centerAndPadString("1. Prince  ", 21));
-		lines.push_back(centerAndPadString("2. Princess", 21));
-		lines.push_back("");
-		lines.push_back(centerAndPadString("*******************", 21));
+	switch (_language) {
+		case Common::ES_ESP:
+			// No accent in "príncipe" since it is not supported by the font
+			if (isDOS()) {
+				lines.push_back("Elija su personaje");
+				lines.push_back("");
+				lines.push_back("");
+				lines.push_back("            1. Principe");
+				lines.push_back("            2. Princesa");
+			} else if (isSpectrum()) {
+				lines.push_back(centerAndPadString("*******************", 21));
+				lines.push_back(centerAndPadString("Seleccion el ", 21));
+				lines.push_back(centerAndPadString("personaje que quiera", 21));
+				lines.push_back(centerAndPadString("ser y precione enter", 21));
+				lines.push_back("");
+				lines.push_back(centerAndPadString("1. Principe", 21));
+				lines.push_back(centerAndPadString("2. Princesa", 21));
+				lines.push_back("");
+				lines.push_back(centerAndPadString("*******************", 21));
+			}
+			break;
+		default: //case Common::EN_ANY:
+			if (isDOS()) {
+				lines.push_back("Select your character");
+				lines.push_back("");
+				lines.push_back("");
+				lines.push_back("            1. Prince");
+				lines.push_back("            2. Princess");
+			} else if (isSpectrum()) {
+				lines.push_back(centerAndPadString("*******************", 21));
+				lines.push_back(centerAndPadString("Select your character", 21));
+				lines.push_back(centerAndPadString("you wish to play", 21));
+				lines.push_back(centerAndPadString("and press enter", 21));
+				lines.push_back("");
+				lines.push_back(centerAndPadString("1. Prince  ", 21));
+				lines.push_back(centerAndPadString("2. Princess", 21));
+				lines.push_back("");
+				lines.push_back(centerAndPadString("*******************", 21));
+			}
+			break;
 	}
 
 	Graphics::Surface *surface = drawStringsInSurface(lines);
diff --git a/engines/freescape/ui.cpp b/engines/freescape/ui.cpp
index 33777cbc4c4..68aea2f7143 100644
--- a/engines/freescape/ui.cpp
+++ b/engines/freescape/ui.cpp
@@ -103,8 +103,8 @@ Graphics::Surface *FreescapeEngine::drawStringsInSurface(const Common::Array<Com
 
 	uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
 
-	int x = _viewArea.left;
-	int y = _viewArea.top;
+	int x = _viewArea.left + 3;
+	int y = _viewArea.top + 3;
 
 	for (int i = 0; i < int(lines.size()); i++) {
 		drawStringInSurface(lines[i], x, y, front, back, surface);
@@ -113,6 +113,8 @@ Graphics::Surface *FreescapeEngine::drawStringsInSurface(const Common::Array<Com
 	return surface;
 }
 
+extern Common::String centerAndPadString(const Common::String &x, int y);
+
 void FreescapeEngine::borderScreen() {
 	if (!_border)
 		return;
@@ -135,23 +137,23 @@ void FreescapeEngine::borderScreen() {
 	if (isDOS() || isSpectrum()) {
 		Common::Array<Common::String> lines;
 		if (isDOS())
-			lines.push_back("    CONFIGURATION MENU  ");
+			lines.push_back(centerAndPadString("Configuration Menu", 25));
 		else
-			lines.push_back("    CONTROL  OPTIONS  ");
+			lines.push_back(centerAndPadString("Control Options", 21));
 		lines.push_back("");
-		lines.push_back("   1: KEYBOARD ONLY   ");
-		lines.push_back("   2: IBM JOYSTICK    ");
-		lines.push_back("   3: AMSTRAD JOYSTICK");
+		lines.push_back("1: KEYBOARD ONLY");
+		lines.push_back("2: IBM JOYSTICK");
+		lines.push_back("3: AMSTRAD JOYSTICK");
 		lines.push_back("");
 		if (isDOS())
 			lines.push_back(" SPACEBAR:  BEGIN MISSION");
 		else
-			lines.push_back("   ENTER: BEGIN MISSION");
+			lines.push_back(centerAndPadString("Enter: Begin Mission", 21));
 		lines.push_back("");
 		if (isDOS())
 			lines.push_back(" COPYRIGHT 1988 INCENTIVE");
 		else
-			lines.push_back("   (C) 1988 INCENTIVE");
+			lines.push_back(centerAndPadString("(c) 1988 Incentive", 22));
 
 		lines.push_back("");
 		Graphics::Surface *surface = drawStringsInSurface(lines);


Commit: 00e34d3ad4122f2f16a502727fa70396055a8c5b
    https://github.com/scummvm/scummvm/commit/00e34d3ad4122f2f16a502727fa70396055a8c5b
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-08-11T20:25:28+02:00

Commit Message:
FREESCAPE: more custom actions for castle

Changed paths:
    engines/freescape/freescape.h
    engines/freescape/games/castle/castle.cpp


diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 96b0a81a73e..2db5f694c06 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -69,7 +69,6 @@ enum FREESCAPEAction {
 	kActionMoveRight,
 	kActionShoot,
 	kActionRunMode,
-	kActionRest,
 	kActionChangeAngle,
 	kActionChangeStepSize,
 	kActionToggleRiseLower,
@@ -87,8 +86,14 @@ enum FREESCAPEAction {
 	kActionDecreaseStepSize,
 	kActionToggleFlyMode,
 	kActionToggleClipMode,
+	// Driller
 	kActionDeployDrillingRig,
-	kActionCollectDrillingRig
+	kActionCollectDrillingRig,
+	// Total Eclipse
+	kActionRest,
+	// Castle
+	kActionSelectPrince,
+	kActionSelectPrincess,
 };
 
 typedef Common::HashMap<uint16, Area *> AreaMap;
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index ef55bc25f9d..94da87898f2 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -84,6 +84,16 @@ void CastleEngine::initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *inf
 	FreescapeEngine::initKeymaps(engineKeyMap, infoScreenKeyMap, target);
 	Common::Action *act;
 
+	act = new Common::Action("SELECTPRINCE", _("Select Prince"));
+	act->setCustomEngineActionEvent(kActionSelectPrince);
+	act->addDefaultInputMapping("1");
+	infoScreenKeyMap->addAction(act);
+
+	act = new Common::Action("SELECTPRINCESS", _("Select Princess"));
+	act->setCustomEngineActionEvent(kActionSelectPrincess);
+	act->addDefaultInputMapping("2");
+	infoScreenKeyMap->addAction(act);
+
 	act = new Common::Action("SAVE", _("Save Game"));
 	act->setCustomEngineActionEvent(kActionSave);
 	act->addDefaultInputMapping("s");
@@ -851,22 +861,20 @@ void CastleEngine::selectCharacterScreen() {
 				_gfx->computeScreenViewport();
 				_gfx->clear(0, 0, 0, true);
 				break;
-			case Common::EVENT_KEYDOWN:
-				switch (event.kbd.keycode) {
-				case Common::KEYCODE_1:
+			default:
+				break;
+			}
+			switch (event.customType) {
+				case kActionSelectPrince:
 					selected = true;
 					// Nothing, since game bit should be already zero
 					break;
-				case Common::KEYCODE_2:
+				case kActionSelectPrincess:
 					selected = true;
 					setGameBit(32);
 					break;
 				default:
 					break;
-				}
-			break;
-			default:
-				break;
 			}
 		}
 		_gfx->clear(0, 0, 0, true);


Commit: a792e17853f3dc8bc57d1f5ef3c97422899aed4a
    https://github.com/scummvm/scummvm/commit/a792e17853f3dc8bc57d1f5ef3c97422899aed4a
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-08-11T20:25:28+02:00

Commit Message:
FREESCAPE: refactored part of zx sound generation code and added some missing sounds in dark and eclipse

Changed paths:
    engines/freescape/games/dark/dark.cpp
    engines/freescape/games/dark/zx.cpp
    engines/freescape/games/eclipse/eclipse.cpp
    engines/freescape/games/eclipse/zx.cpp
    engines/freescape/movement.cpp
    engines/freescape/sound.cpp
    engines/freescape/sound.h
    engines/freescape/ui.cpp


diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 9eab0eff7d8..3041cc9bea6 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -33,6 +33,15 @@
 namespace Freescape {
 
 DarkEngine::DarkEngine(OSystem *syst, const ADGameDescription *gd) : FreescapeEngine(syst, gd) {
+	// These sounds can be overriden by the class of each platform
+	_soundIndexShoot = 8;
+	_soundIndexCollide = -1;
+	_soundIndexFall = 3;
+	_soundIndexClimb = 4;
+	_soundIndexMenu = -1;
+	_soundIndexStart = 9;
+	_soundIndexAreaChange = 5;
+
 	if (isDOS())
 		initDOS();
 	else if (isSpectrum())
@@ -264,15 +273,6 @@ void DarkEngine::loadAssets() {
 	_noEnergyMessage = _messagesList[16];
 	_fallenMessage = _messagesList[17];
 	_crushedMessage = _messagesList[10];
-
-	// These sounds can be overriden by the class of each platform
-	_soundIndexShoot = 8;
-	_soundIndexCollide = -1;
-	_soundIndexFall = -1;
-	_soundIndexClimb = -1;
-	_soundIndexMenu = -1;
-	_soundIndexStart = -1;
-	_soundIndexAreaChange = -1;
 }
 
 bool DarkEngine::tryDestroyECDFullGame(int index) {
@@ -611,17 +611,11 @@ void DarkEngine::gotoArea(uint16 areaID, int entranceID) {
 	if (areaID == _startArea && entranceID == _startEntrance) {
 		_yaw = 90;
 		_pitch = 0;
-		if (isSpectrum())
-			playSound(11, true);
-		else
-			playSound(9, true);
+		playSound(_soundIndexStart, true);
 	} else if (areaID == _endArea && entranceID == _endEntrance) {
 		_pitch = 10;
 	} else {
-		if (isSpectrum())
-			playSound(0x1c, false);
-		else
-			playSound(5, false);
+		playSound(_soundIndexAreaChange, false);
 	}
 
 	debugC(1, kFreescapeDebugMove, "starting player position: %f, %f, %f", _position.x(), _position.y(), _position.z());
diff --git a/engines/freescape/games/dark/zx.cpp b/engines/freescape/games/dark/zx.cpp
index 49a7f6cb1cf..0d5ffc2c779 100644
--- a/engines/freescape/games/dark/zx.cpp
+++ b/engines/freescape/games/dark/zx.cpp
@@ -33,12 +33,12 @@ void DarkEngine::initZX() {
 	_maxShield = 63;
 
 	_soundIndexShoot = 5;
-	_soundIndexCollide = 2;
+	_soundIndexCollide = -1; // Scripted
 	_soundIndexFall = 3;
-	_soundIndexClimb = -1;
-	_soundIndexMenu = -1;
-	_soundIndexStart = -1;
-	_soundIndexAreaChange = -1;
+	_soundIndexClimb = 4;
+	_soundIndexMenu = 25;
+	_soundIndexStart = 11;
+	_soundIndexAreaChange = 0x1c;
 }
 
 void DarkEngine::loadAssetsZXFullGame() {
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index da85ab52ba5..2b210727029 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -33,6 +33,15 @@
 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 = 3;
+	_soundIndexFall = 3;
+	_soundIndexClimb = 4;
+	_soundIndexMenu = -1;
+	_soundIndexStart = -1;
+	_soundIndexAreaChange = -1;
+
 	if (isDOS())
 		initDOS();
 	else if (isCPC())
@@ -72,15 +81,6 @@ EclipseEngine::EclipseEngine(OSystem *syst, const ADGameDescription *gd) : Frees
 	_lastThirtySeconds = 0;
 	_lastSecond = -1;
 	_resting = false;
-
-	// These sounds can be overriden by the class of each platform
-	_soundIndexShoot = 8;
-	_soundIndexCollide = 3;
-	_soundIndexFall = -1;
-	_soundIndexClimb = -1;
-	_soundIndexMenu = -1;
-	_soundIndexStart = -1;
-	_soundIndexAreaChange = -1;
 }
 
 void EclipseEngine::initGameState() {
diff --git a/engines/freescape/games/eclipse/zx.cpp b/engines/freescape/games/eclipse/zx.cpp
index 86e1097b5eb..ddb24bd8645 100644
--- a/engines/freescape/games/eclipse/zx.cpp
+++ b/engines/freescape/games/eclipse/zx.cpp
@@ -35,7 +35,7 @@ void EclipseEngine::initZX() {
 	_soundIndexShoot = 5;
 	_soundIndexCollide = -1;
 	_soundIndexFall = 3;
-	_soundIndexClimb = -1;
+	_soundIndexClimb = 4;
 	_soundIndexMenu = -1;
 	_soundIndexStart = -1;
 	_soundIndexAreaChange = -1;
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index 719dffb9bfa..abd70cf5eb7 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -366,7 +366,7 @@ void FreescapeEngine::resolveCollisions(Math::Vector3d const position) {
 		if ((lastPosition - newPosition).length() < 1) { // Something is blocking the player
 			if (!executed)
 				setGameBit(31);
-			playSound(4, false);
+			playSound(_soundIndexClimb, false);
 		}
 		_position = newPosition;
 		return;
@@ -381,15 +381,15 @@ void FreescapeEngine::resolveCollisions(Math::Vector3d const position) {
 		lastPosition.y() = lastPosition.y() + _stepUpDistance;
 
 		newPosition = _currentArea->resolveCollisions(lastPosition, newPosition, _playerHeight);
+		if (_lastPosition.y() < newPosition.y())
+			playSound(_soundIndexClimb, false);
 	}
 
 	if ((lastPosition - newPosition).length() < 1) { // Something is blocking the player
 		if (!executed)
 			setGameBit(31);
-		if (isSpectrum())
-			playSound(_soundIndexCollide, false);
-		else
-			playSound(_soundIndexCollide, false);
+
+		playSound(_soundIndexCollide, false);
 	}
 
 	lastPosition = newPosition;
diff --git a/engines/freescape/sound.cpp b/engines/freescape/sound.cpp
index c0c2dabbe48..5bbf4909ec9 100644
--- a/engines/freescape/sound.cpp
+++ b/engines/freescape/sound.cpp
@@ -81,9 +81,10 @@ void FreescapeEngine::loadSpeakerFxZX(Common::SeekableReadStream *file, int sfxT
 							var5 = 1;
 
 						soundUnitZX soundUnit;
+						soundUnit.isRaw = false;
 						soundUnit.freqTimesSeconds = (var10 & 0xffff) + 1;
 						soundUnit.tStates = var5;
-						soundUnit.multiplier = 200;
+						soundUnit.multiplier = 10;
 						//debug("playSFX(%x, %x)", soundUnit.freqTimesSeconds, soundUnit.tStates);
 						_soundsSpeakerFxZX[i]->push_back(soundUnit);
 						int16 var4 = 0;
@@ -126,6 +127,7 @@ void FreescapeEngine::loadSpeakerFxZX(Common::SeekableReadStream *file, int sfxT
 				do  {
 					do {
 						soundUnitZX soundUnit;
+						soundUnit.isRaw = false;
 						soundUnit.tStates = var5;
 						soundUnit.freqTimesSeconds = SFXtempStruct[3] | (SFXtempStruct[4] << 8);
 						soundUnit.multiplier = 1.8f;
@@ -145,7 +147,7 @@ void FreescapeEngine::loadSpeakerFxZX(Common::SeekableReadStream *file, int sfxT
 				uint16 sVar7 = SFXtempStruct[3];
 				soundType = 0;
 				soundSize = SFXtempStruct[2];
-				uint16 silenceSize = 0xff; //SFXtempStruct[4];
+				uint16 silenceSize = SFXtempStruct[4];
 				bool cond1 = (SFXtempStruct[4] != 0 && SFXtempStruct[4] != 2);
 				bool cond2 = SFXtempStruct[4] == 2;
 				bool cond3 = SFXtempStruct[4] == 0;
@@ -153,16 +155,14 @@ void FreescapeEngine::loadSpeakerFxZX(Common::SeekableReadStream *file, int sfxT
 				assert(cond1 || cond2 || cond3);
 				do {
 					soundUnitZX soundUnit;
-					soundUnit.freqTimesSeconds = 2000;
-					soundUnit.tStates = float(437500) / 2000 - 30.125;
+					soundUnit.isRaw = true;
 					int totalSize = soundSize + sVar7;
-					//debugN("totalSize: %x ", totalSize);
-					soundUnit.multiplier = float(totalSize) / 2000; // 4000
+					soundUnit.rawFreq = 1.0;
+					soundUnit.rawLengthus = totalSize;
 					_soundsSpeakerFxZX[i]->push_back(soundUnit);
 					//debugN("%x ", silenceSize);
-					soundUnit.freqTimesSeconds = 0;
-					soundUnit.tStates = 0;
-					soundUnit.multiplier = float(silenceSize) / 100;// + 1) / 100;
+					soundUnit.rawFreq = 0;
+					soundUnit.rawLengthus = silenceSize;
 					_soundsSpeakerFxZX[i]->push_back(soundUnit);
 					repetitions = repetitions + -1;
 					soundSize = SFXtempStruct[5] + soundSize;
@@ -205,6 +205,7 @@ void FreescapeEngine::loadSpeakerFxZX(Common::SeekableReadStream *file, int sfxT
 						//debug("wait %d", bVar1);
 						assert(bVar1 > 0);
 						soundUnitZX soundUnit;
+						soundUnit.isRaw = false;
 						soundUnit.freqTimesSeconds = beep ? 1000 : 0;
 						soundUnit.tStates = beep ? 437500 / 1000 - 30.125 : 0;
 						soundUnit.multiplier = float(bVar1) / 500;
@@ -493,16 +494,26 @@ uint16 FreescapeEngine::playSoundDOSSpeaker(uint16 frequencyStart, soundSpeakerF
 void FreescapeEngine::playSoundZX(Common::Array<soundUnitZX> *data) {
 	for (auto &it : *data) {
 		soundUnitZX value = it;
-		if (value.freqTimesSeconds == 0 && value.tStates == 0) {
-			_speaker->playQueue(Audio::PCSpeaker::kWaveFormSilence, 0, 1000 * value.multiplier);
-			continue;
-		}
 
-		float hzFreq = 1 / ((value.tStates + 30.125) / 437500.0);
-		float waveDuration = value.freqTimesSeconds / hzFreq;
-		waveDuration = value.multiplier * 1000 * (waveDuration + 1);
-		debugC(1, kFreescapeDebugMedia, "hz: %f, duration: %f", hzFreq, waveDuration);
-		_speaker->playQueue(Audio::PCSpeaker::kWaveFormSquare, hzFreq, waveDuration);
+		if (value.isRaw) {
+			debugC(1, kFreescapeDebugMedia, "hz: %f, duration: %d", value.rawFreq, value.rawLengthus);
+			if (value.rawFreq == 0) {
+				_speaker->playQueue(Audio::PCSpeaker::kWaveFormSilence, 0, value.rawLengthus);
+				continue;
+			}
+			_speaker->playQueue(Audio::PCSpeaker::kWaveFormSquare, value.rawFreq, value.rawLengthus);
+		} else {
+			if (value.freqTimesSeconds == 0 && value.tStates == 0) {
+				_speaker->playQueue(Audio::PCSpeaker::kWaveFormSilence, 0, 1000 * value.multiplier);
+				continue;
+			}
+
+			float hzFreq = 1 / ((value.tStates + 30.125) / 437500.0);
+			float waveDuration = value.freqTimesSeconds / hzFreq;
+			waveDuration = value.multiplier * 1000 * (waveDuration + 1);
+			debugC(1, kFreescapeDebugMedia, "hz: %f, duration: %f", hzFreq, waveDuration);
+			_speaker->playQueue(Audio::PCSpeaker::kWaveFormSquare, hzFreq, waveDuration);
+		}
 	}
 
 	_mixer->stopHandle(_soundFxHandle);
diff --git a/engines/freescape/sound.h b/engines/freescape/sound.h
index c10e866b9d1..e55d44caf66 100644
--- a/engines/freescape/sound.h
+++ b/engines/freescape/sound.h
@@ -34,8 +34,11 @@ struct soundFx {
 };
 
 struct soundUnitZX {
+	bool isRaw;
 	uint16 freqTimesSeconds;
 	uint16 tStates;
+	float rawFreq;
+	uint32 rawLengthus;
 	float multiplier;
 };
 
diff --git a/engines/freescape/ui.cpp b/engines/freescape/ui.cpp
index 68aea2f7143..6c839210b34 100644
--- a/engines/freescape/ui.cpp
+++ b/engines/freescape/ui.cpp
@@ -240,7 +240,7 @@ void FreescapeEngine::drawBorderScreenAndWait(Graphics::Surface *surface, int ma
 		g_system->updateScreen();
 		g_system->delayMillis(15); // try to target ~60 FPS
 	}
-
+	playSound(_soundIndexMenu, false);
 	_gfx->clear(0, 0, 0, true);
 }
 


Commit: 4f50129e4a76b3b14b600e7237b290d4db4457fb
    https://github.com/scummvm/scummvm/commit/4f50129e4a76b3b14b600e7237b290d4db4457fb
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-08-11T20:25:28+02:00

Commit Message:
FREESCAPE: improved sounds for dark in zx

Changed paths:
    engines/freescape/games/dark/dark.cpp
    engines/freescape/games/dark/dark.h
    engines/freescape/games/dark/zx.cpp


diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 3041cc9bea6..3aac485231f 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -41,6 +41,7 @@ DarkEngine::DarkEngine(OSystem *syst, const ADGameDescription *gd) : FreescapeEn
 	_soundIndexMenu = -1;
 	_soundIndexStart = 9;
 	_soundIndexAreaChange = 5;
+	_soundIndexRestoreECD = 19;
 
 	if (isDOS())
 		initDOS();
@@ -463,8 +464,6 @@ bool DarkEngine::checkIfGameEnded() {
 	if (_gameStateVars[kVariableDarkECD] > 0) {
 		int index = _gameStateVars[kVariableDarkECD] - 1;
 		bool destroyed = tryDestroyECD(index);
-		if (isSpectrum())
-			playSound(7, false);
 
 		if (destroyed) {
 			_gameStateVars[kVariableActiveECDs] -= 4;
@@ -473,10 +472,8 @@ bool DarkEngine::checkIfGameEnded() {
 		} else {
 			restoreECD(*_currentArea, index);
 			insertTemporaryMessage(_messagesList[1], _countdown - 2);
-			if (isSpectrum())
-				playSound(30, false);
-			else
-				playSound(19, true);
+			stopAllSounds();
+			playSound(_soundIndexRestoreECD, false);
 		}
 		_gameStateVars[kVariableDarkECD] = 0;
 
diff --git a/engines/freescape/games/dark/dark.h b/engines/freescape/games/dark/dark.h
index af260e46a13..281a60862af 100644
--- a/engines/freescape/games/dark/dark.h
+++ b/engines/freescape/games/dark/dark.h
@@ -96,6 +96,8 @@ public:
 	Common::BitArray _fontMedium;
 	Common::BitArray _fontSmall;
 
+	int _soundIndexRestoreECD;
+
 	void drawString(const DarkFontSize size, const Common::String &str, int x, int y, uint32 primaryColor, uint32 secondaryColor, uint32 backColor, Graphics::Surface *surface);
 	void drawInfoMenu() override;
 
diff --git a/engines/freescape/games/dark/zx.cpp b/engines/freescape/games/dark/zx.cpp
index 0d5ffc2c779..d6c2ac591a9 100644
--- a/engines/freescape/games/dark/zx.cpp
+++ b/engines/freescape/games/dark/zx.cpp
@@ -39,6 +39,7 @@ void DarkEngine::initZX() {
 	_soundIndexMenu = 25;
 	_soundIndexStart = 11;
 	_soundIndexAreaChange = 0x1c;
+	_soundIndexRestoreECD = 30;
 }
 
 void DarkEngine::loadAssetsZXFullGame() {




More information about the Scummvm-git-logs mailing list