[Scummvm-git-logs] scummvm master -> 76e35e17486452c5212c49aa75ce7cc6562bc547

neuromancer noreply at scummvm.org
Thu Mar 14 18:04:32 UTC 2024


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

Summary:
a2d91944b7 FREESCAPE: improvements to reproduce zx sounds
9ff99e79d2 FREESCAPE: more improvements to reproduce zx sounds
924b4834e8 FREESCAPE: refactor end game code to make sure sounds are executed correctly
3319cccb0e FREESCAPE: use pre-recorded sounds for driller zx/cpc
cbaf049a5f FREESCAPE: shield should not be less than zero in eclipse
1ba74591ac FREESCAPE: improved position of control/configuration menu
8c57ce8b14 FREESCAPE: implemented 2d eclipse indicator in eclipse
76e35e1748 FREESCAPE: fixes in the eclipse rendering in opengl


Commit: a2d91944b7d00762f687d2c12d6f25d3eb11b3fd
    https://github.com/scummvm/scummvm/commit/a2d91944b7d00762f687d2c12d6f25d3eb11b3fd
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-03-14T19:01:45+01:00

Commit Message:
FREESCAPE: improvements to reproduce zx sounds

Changed paths:
    engines/freescape/movement.cpp
    engines/freescape/sound.cpp


diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index aa6ff3001a8..f771a49cc61 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -189,9 +189,9 @@ void FreescapeEngine::shoot() {
 			playSound(15, false);
 		else if (isEclipse())
 			playSound(5, false);
-		else 
+		else
 			playSound(8, false);
-	} else 
+	} else
 		playSound(8, false);
 
 	g_system->delayMillis(2);
@@ -388,7 +388,10 @@ void FreescapeEngine::resolveCollisions(Math::Vector3d const position) {
 	if ((lastPosition - newPosition).length() < 1) { // Something is blocking the player
 		if (!executed)
 			setGameBit(31);
-		playSound(2, false);
+		if (isSpectrum())
+			playSound(10, false);
+		else
+			playSound(2, false);
 	}
 
 	lastPosition = newPosition;
diff --git a/engines/freescape/sound.cpp b/engines/freescape/sound.cpp
index 0b44979ba70..f60cde34ece 100644
--- a/engines/freescape/sound.cpp
+++ b/engines/freescape/sound.cpp
@@ -54,6 +54,8 @@ void FreescapeEngine::loadSpeakerFxZX(Common::SeekableReadStream *file, int sfxT
 		uint8 soundSize = 0;
 		int16 repetitions = 0;
 		debugC(1, kFreescapeDebugParser, "dataIndex: %x, value: %x, SFXtempStruct[0]: %x, type: %x", dataIndex, soundValue, SFXtempStruct[0], soundType);
+		if (soundType == 0xff)
+			break;
 
 		if ((soundType & 0x80) == 0) {
 			SFXtempStruct[6] = 0;
@@ -68,8 +70,8 @@ void FreescapeEngine::loadSpeakerFxZX(Common::SeekableReadStream *file, int sfxT
 					SFXtempStruct[2] = file->readByte();
 					SFXtempStruct[3] = file->readByte();
 
-					//for (int j = 0; j <= 7; j++)
-					//	debug("SFXtempStruct[%d]: %x", j, SFXtempStruct[j]);
+					for (int j = 0; j <= 7; j++)
+						debugC(1, kFreescapeDebugParser, "SFXtempStruct[%d]: %x", j, SFXtempStruct[j]);
 
 					do {
 						uint32 var9 = 0xffffff & (SFXtempStruct[3] * 0xd0);
@@ -116,8 +118,7 @@ void FreescapeEngine::loadSpeakerFxZX(Common::SeekableReadStream *file, int sfxT
 			file->seek(sound_ptr);
 			for (int j = 1; j <= 7; j++) {
 				SFXtempStruct[j] = file->readByte();
-				//debug("SFXtempStruct[%d]: %x", j, SFXtempStruct[j]);
-				//sound_ptr = sound_ptr + 1;
+				debugC(1, kFreescapeDebugParser, "SFXtempStruct[%d]: %x", j, SFXtempStruct[j]);
 			}
 			soundSize = SFXtempStruct[0];
 			repetitions = SFXtempStruct[1] | (SFXtempStruct[2] << 8);
@@ -149,7 +150,44 @@ void FreescapeEngine::loadSpeakerFxZX(Common::SeekableReadStream *file, int sfxT
 				soundUnit.multiplier = 2 * size;
 				_soundsSpeakerFxZX[i]->push_back(soundUnit);
 			} else {
-				debugC(1, kFreescapeDebugParser, "Unknown sound type: %x", soundType);
+				debugC(1, kFreescapeDebugParser, "Sound type: %x", soundType);
+				bool beep = false;
+				do {
+					soundType = 0;
+					uint16 uVar2 = SFXtempStruct[1] | (SFXtempStruct[2] << 8);
+					uint8 cVar3 = 0;
+					do {
+						//debug("start cycle %d:", cVar3);
+						//ULA_PORT = bVar4;
+						//bVar4 = bVar4 ^ 0x10;
+						beep = !beep;
+						repetitions = (((ushort)soundType * 0x100 + (ushort)soundType * -2) -
+									(ushort)((ushort)soundType * 0x100 < (ushort)soundType)) + (uVar2 & 0xff);
+						uint8 bVar9 = (byte)repetitions;
+						uint8 bVar8 = (byte)((ushort)repetitions >> 8);
+						uint8 bVar1 = bVar9 - bVar8;
+						soundType = bVar1;
+						if (bVar8 <= bVar9) {
+							bVar1 = bVar1 - 1;
+							soundType = bVar1;
+						}
+						//debug("wait %d", bVar1);
+						assert(bVar1 > 0);
+						soundUnitZX soundUnit;
+						soundUnit.freqTimesSeconds = beep ? 50 : 0;
+						soundUnit.tStates = beep ? 437500 / 50 - 30.125 : 0;
+						soundUnit.multiplier = bVar1 / 100;
+						_soundsSpeakerFxZX[i]->push_back(soundUnit);
+
+						// No need to wait
+						//do {
+						//	bVar1 = bVar1 - 1;
+						//} while (bVar1 != 0);
+						cVar3 = (char)(uVar2 >> 8) + -1;
+						uVar2 = (((uint16)cVar3) << 8) | (uint8)uVar2;
+					} while (cVar3 != '\0');
+					soundSize = soundSize + -1;
+				} while (soundSize != '\0');
 			}
 		}
 		free(SFXtempStruct);
@@ -409,6 +447,11 @@ 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);


Commit: 9ff99e79d26aaaf3c68546d042803275ca3a6dd2
    https://github.com/scummvm/scummvm/commit/9ff99e79d26aaaf3c68546d042803275ca3a6dd2
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-03-14T19:01:45+01:00

Commit Message:
FREESCAPE: more improvements to reproduce zx sounds

Changed paths:
    engines/freescape/sound.cpp


diff --git a/engines/freescape/sound.cpp b/engines/freescape/sound.cpp
index f60cde34ece..2c951545cc2 100644
--- a/engines/freescape/sound.cpp
+++ b/engines/freescape/sound.cpp
@@ -142,13 +142,58 @@ void FreescapeEngine::loadSpeakerFxZX(Common::SeekableReadStream *file, int sfxT
 					var5 = soundValue;
 				} while (soundSize != 0);
 			} else if ((soundType & 0x7f) == 2) {
-				int size = 2 * (SFXtempStruct[1] + SFXtempStruct[2]);
-
-				soundUnitZX soundUnit;
-				soundUnit.freqTimesSeconds = 100;
-				soundUnit.tStates = 437500 / 100 - 30.125;
-				soundUnit.multiplier = 2 * size;
-				_soundsSpeakerFxZX[i]->push_back(soundUnit);
+				repetitions = SFXtempStruct[1] | (SFXtempStruct[0] << 8);
+				debugC(1, kFreescapeDebugParser, "Repetitions: %x", repetitions);
+				uint16 sVar7 = SFXtempStruct[3];
+				soundType = 0;
+				soundSize = SFXtempStruct[2];
+				uint16 silenceSize = 0xff; //SFXtempStruct[4];
+				bool cond1 = (SFXtempStruct[4] != 0 && SFXtempStruct[4] != 2);
+				bool cond2 = SFXtempStruct[4] == 2;
+				bool cond3 = SFXtempStruct[4] == 0;
+
+				assert(cond1 || cond2 || cond3);
+				do {
+					soundUnitZX soundUnit;
+					soundUnit.freqTimesSeconds = 200;
+					soundUnit.tStates = 437500 / 200 - 30.125;
+					int totalSize = soundSize + sVar7;
+					//debugN("totalSize: %x ", totalSize);
+					soundUnit.multiplier = totalSize / 50;
+					_soundsSpeakerFxZX[i]->push_back(soundUnit);
+					//debugN("%x ", silenceSize);
+					soundUnit.freqTimesSeconds = 0;
+					soundUnit.tStates = 0;
+					soundUnit.multiplier = (silenceSize + 1) / 50;
+					_soundsSpeakerFxZX[i]->push_back(soundUnit);
+
+					//do {
+					//	cVar3 = cVar3 + -1;
+					//} while (cVar3 != '\0');
+
+					//uint8 bVar9 = (byte)((ushort)sVar7);
+					//bVar4 = bVar9;
+					//do {
+					//	bVar4 = bVar4 - 1;
+					//} while (bVar4 != 0);
+					//soundType = (soundType | 0x18) & 0xf;
+					//ULA_PORT = soundType;
+					repetitions = repetitions + -1;
+					soundSize = SFXtempStruct[5] + soundSize;
+
+					if (cond1)
+						silenceSize = (repetitions & 0xff) | (repetitions >> 8);
+					else if (cond2)
+						silenceSize = (repetitions & 0xff);
+					else
+						silenceSize = soundSize;
+
+					//debug("soundSize: %x", soundSize);
+					//sVar7 = (ushort)bVar9 << 8;
+				} while (repetitions != 0);
+				//debug("\n");
+				//if (i == 15)
+				//	assert(0);
 			} else {
 				debugC(1, kFreescapeDebugParser, "Sound type: %x", soundType);
 				bool beep = false;


Commit: 924b4834e8d5e3e415e434d9facf3640452dce8e
    https://github.com/scummvm/scummvm/commit/924b4834e8d5e3e415e434d9facf3640452dce8e
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-03-14T19:01:45+01:00

Commit Message:
FREESCAPE: refactor end game code to make sure sounds are executed correctly

Changed paths:
    engines/freescape/freescape.cpp
    engines/freescape/freescape.h
    engines/freescape/games/dark/dark.cpp
    engines/freescape/games/driller/driller.cpp
    engines/freescape/games/eclipse/eclipse.cpp
    engines/freescape/sound.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 13f2d459ca0..22a8e439f88 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -686,8 +686,9 @@ Common::Error FreescapeEngine::run() {
 }
 
 void FreescapeEngine::endGame() {
-	if (_endGameKeyPressed) {
-		_gameStateControl = kFreescapeGameStateRestart;
+	if (_gameStateControl == kFreescapeGameStateEnd && !isPlayingSound() && !_endGamePlayerEndArea) {
+		_endGamePlayerEndArea = true;
+		gotoArea(_endArea, _endEntrance);
 	}
 }
 
@@ -734,40 +735,50 @@ bool FreescapeEngine::checkIfGameEnded() {
 		return false;
 
 	if (_gameStateVars[k8bitVariableShield] == 0) {
+		if (isSpectrum())
+			playSound(14, true);
+
 		if (!_noShieldMessage.empty())
 			insertTemporaryMessage(_noShieldMessage, _countdown - 2);
 		_gameStateControl = kFreescapeGameStateEnd;
 	} else if (_gameStateVars[k8bitVariableEnergy] == 0) {
+		if (isSpectrum())
+			playSound(14, true);
+
 		if (!_noEnergyMessage.empty())
 			insertTemporaryMessage(_noEnergyMessage, _countdown - 2);
 		_gameStateControl = kFreescapeGameStateEnd;
 	} else if (_hasFallen) {
 		_hasFallen = false;
-		playSound(14, false);
+		if (isSpectrum())
+			playSound(14, false);
+
 		if (!_fallenMessage.empty())
 			insertTemporaryMessage(_fallenMessage, _countdown - 4);
 		_gameStateControl = kFreescapeGameStateEnd;
 	} else if (_countdown <= 0) {
+		if (isSpectrum())
+			playSound(14, false);
+
 		if (!_timeoutMessage.empty())
 			insertTemporaryMessage(_timeoutMessage, _countdown - 4);
 		_gameStateControl = kFreescapeGameStateEnd;
 	} else if (_playerWasCrushed) {
+		if (isSpectrum())
+			playSound(25, true);
+
 		_playerWasCrushed = false;
 		if (!_crushedMessage.empty())
 			insertTemporaryMessage(_crushedMessage, _countdown - 4);
 		_gameStateControl = kFreescapeGameStateEnd;
 	} else if (_forceEndGame) {
 		if (isSpectrum())
-			playSound(8, true);
+			playSound(14, true);
 		_forceEndGame = false;
 		if (!_forceEndGameMessage.empty())
 			insertTemporaryMessage(_forceEndGameMessage, _countdown - 4);
 		_gameStateControl = kFreescapeGameStateEnd;
 	}
-
-	if (_gameStateControl == kFreescapeGameStateEnd)
-		gotoArea(_endArea, _endEntrance);
-
 	return false; // TODO
 }
 
@@ -807,6 +818,7 @@ void FreescapeEngine::initGameState() {
 	_yaw = 0;
 	_pitch = 0;
 	_endGameKeyPressed = false;
+	_endGamePlayerEndArea = false;
 
 	_demoIndex = 0;
 	_demoEvents.clear();
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 509723b36f5..80ad9dfa95d 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -448,6 +448,7 @@ public:
 	virtual bool checkIfGameEnded();
 	virtual void endGame();
 	bool _endGameKeyPressed;
+	bool _endGamePlayerEndArea;
 	bool _forceEndGame;
 	bool _playerWasCrushed;
 	ObjectArray _sensors;
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index 0e10f15e730..87ecc81da18 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -395,7 +395,7 @@ bool DarkEngine::checkIfGameEnded() {
 			insertTemporaryMessage(_messagesList[1], _countdown - 2);
 			if (isSpectrum())
 				playSound(30, false);
-			else 
+			else
 				playSound(19, true);
 		}
 		_gameStateVars[kVariableDarkECD] = 0;
@@ -404,6 +404,11 @@ bool DarkEngine::checkIfGameEnded() {
 }
 
 void DarkEngine::endGame() {
+	FreescapeEngine::endGame();
+
+	if (!_endGamePlayerEndArea)
+		return;
+
 	if (_gameStateControl == kFreescapeGameStateEnd) {
 		if (!_ticksFromEnd)
 			_ticksFromEnd = _ticks;
@@ -653,8 +658,12 @@ void DarkEngine::drawIndicator(Graphics::Surface *surface, int xPosition, int yP
 }
 
 void DarkEngine::drawSensorShoot(Sensor *sensor) {
-	if (isSpectrum())
-		playSound(2, false);
+	if (_gameStateControl == kFreescapeGameStatePlaying) {
+		// Avoid playing new sounds, so the endgame can progress
+		if (isSpectrum())
+			playSound(2, true);
+	}
+
 	Math::Vector3d target;
 	target = _position;
 	target.y() = target.y() - _playerHeight;
diff --git a/engines/freescape/games/driller/driller.cpp b/engines/freescape/games/driller/driller.cpp
index 10e7831fb28..5a1a78f6e04 100644
--- a/engines/freescape/games/driller/driller.cpp
+++ b/engines/freescape/games/driller/driller.cpp
@@ -774,10 +774,20 @@ bool DrillerEngine::checkIfGameEnded() {
 
 void DrillerEngine::endGame() {
 	FreescapeEngine::endGame();
+
+	if (!_endGamePlayerEndArea)
+		return;
+
 	if (_gameStateVars[32] == 18) { // All areas are complete
 		insertTemporaryMessage(_messagesList[19], _countdown - 2);
 		_gameStateVars[32] = 0;  // Avoid repeating the message
 	}
+
+	if (_endGameKeyPressed) {
+		_gameStateControl = kFreescapeGameStateRestart;
+	}
+
+	_endGameKeyPressed = false;
 }
 
 bool DrillerEngine::onScreenControls(Common::Point mouse) {
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index 47cc0b67ccd..38de6256b94 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -110,6 +110,11 @@ bool EclipseEngine::checkIfGameEnded() {
 }
 
 void EclipseEngine::endGame() {
+	FreescapeEngine::endGame();
+
+	if (!_endGamePlayerEndArea)
+		return;
+
 	if (_gameStateControl == kFreescapeGameStateEnd) {
 		removeTimers();
 		if (_countdown > 0)
diff --git a/engines/freescape/sound.cpp b/engines/freescape/sound.cpp
index 2c951545cc2..fc6742b0e8a 100644
--- a/engines/freescape/sound.cpp
+++ b/engines/freescape/sound.cpp
@@ -452,6 +452,9 @@ void FreescapeEngine::waitForSounds() {
 }
 
 bool FreescapeEngine::isPlayingSound() {
+	if (_usePrerecordedSounds || isAmiga() || isAtariST())
+		return _mixer->isSoundIDActive(-1);
+
 	return (!_speaker->endOfStream());
 }
 


Commit: 3319cccb0e551f798fd90395c57dd87b2ab1dfb7
    https://github.com/scummvm/scummvm/commit/3319cccb0e551f798fd90395c57dd87b2ab1dfb7
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-03-14T19:01:45+01:00

Commit Message:
FREESCAPE: use pre-recorded sounds for driller zx/cpc

Changed paths:
    engines/freescape/sound.cpp


diff --git a/engines/freescape/sound.cpp b/engines/freescape/sound.cpp
index fc6742b0e8a..278190960e0 100644
--- a/engines/freescape/sound.cpp
+++ b/engines/freescape/sound.cpp
@@ -325,7 +325,7 @@ void FreescapeEngine::playSound(int index, bool sync) {
 			debugC(1, kFreescapeDebugMedia, "WARNING: Sound %d is not available", index);
 
 		return;
-	} else if (isSpectrum()) {
+	} else if (isSpectrum() && !isDriller()) {
 		playSoundZX(_soundsSpeakerFxZX[index]);
 		return;
 	}


Commit: cbaf049a5f9fb335e3402a95529bef1686696d6b
    https://github.com/scummvm/scummvm/commit/cbaf049a5f9fb335e3402a95529bef1686696d6b
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-03-14T19:01:45+01:00

Commit Message:
FREESCAPE: shield should not be less than zero in eclipse

Changed paths:
    engines/freescape/games/eclipse/cpc.cpp
    engines/freescape/games/eclipse/dos.cpp
    engines/freescape/games/eclipse/zx.cpp


diff --git a/engines/freescape/games/eclipse/cpc.cpp b/engines/freescape/games/eclipse/cpc.cpp
index c081db86d7c..fba33fe7545 100644
--- a/engines/freescape/games/eclipse/cpc.cpp
+++ b/engines/freescape/games/eclipse/cpc.cpp
@@ -94,6 +94,7 @@ void EclipseEngine::drawCPCUI(Graphics::Surface *surface) {
 
 	int score = _gameStateVars[k8bitVariableScore];
 	int shield = _gameStateVars[k8bitVariableShield] * 100 / _maxShield;
+	shield = shield < 0 ? 0 : shield;
 
 	if (!_currentAreaMessages.empty())
 		drawStringInSurface(_currentAreaMessages[0], 102, 135, back, front, surface);
diff --git a/engines/freescape/games/eclipse/dos.cpp b/engines/freescape/games/eclipse/dos.cpp
index 300859d6daf..20458e30283 100644
--- a/engines/freescape/games/eclipse/dos.cpp
+++ b/engines/freescape/games/eclipse/dos.cpp
@@ -102,6 +102,7 @@ void EclipseEngine::loadAssetsDOSFullGame() {
 void EclipseEngine::drawDOSUI(Graphics::Surface *surface) {
 	int score = _gameStateVars[k8bitVariableScore];
 	int shield = _gameStateVars[k8bitVariableShield] * 100 / _maxShield;
+	shield = shield < 0 ? 0 : shield;
 
 	uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0x55);
 	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
diff --git a/engines/freescape/games/eclipse/zx.cpp b/engines/freescape/games/eclipse/zx.cpp
index 2f34f67e0c3..bf9e0938f41 100644
--- a/engines/freescape/games/eclipse/zx.cpp
+++ b/engines/freescape/games/eclipse/zx.cpp
@@ -105,8 +105,9 @@ void EclipseEngine::drawZXUI(Graphics::Surface *surface) {
 	_gfx->readFromPalette(2, r, g, b);
 	uint32 red = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
 
-	int shield = _gameStateVars[k8bitVariableShield] * 100 / _maxShield;
 	int score = _gameStateVars[k8bitVariableScore];
+	int shield = _gameStateVars[k8bitVariableShield] * 100 / _maxShield;
+	shield = shield < 0 ? 0 : shield;
 
 	if (!_currentAreaMessages.empty())
 		drawStringInSurface(_currentAreaMessages[0], 102, 141, back, front, surface);


Commit: 1ba74591ac1a6935e1bbb8fe3e2436dad7c88be2
    https://github.com/scummvm/scummvm/commit/1ba74591ac1a6935e1bbb8fe3e2436dad7c88be2
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-03-14T19:01:45+01:00

Commit Message:
FREESCAPE: improved position of control/configuration menu

Changed paths:
    engines/freescape/ui.cpp


diff --git a/engines/freescape/ui.cpp b/engines/freescape/ui.cpp
index bc6e1bed8a5..1412e2e18ed 100644
--- a/engines/freescape/ui.cpp
+++ b/engines/freescape/ui.cpp
@@ -104,8 +104,8 @@ Graphics::Surface *FreescapeEngine::drawStringsInSurface(const Common::Array<Com
 
 	uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
 
-	int x = 50;
-	int y = 32;
+	int x = isCastle() ? 45 : 55;
+	int y = isEclipse() || isCastle() ? 40 : 32;
 
 	for (int i = 0; i < int(lines.size()); i++) {
 		drawStringInSurface(lines[i], x, y, front, black, surface);
@@ -130,15 +130,18 @@ void FreescapeEngine::borderScreen() {
 
 	if (isDOS() || isSpectrum()) {
 		Common::Array<Common::String> lines;
-		lines.push_back("     CONFIGURATION MENU");
+		if (isDOS())
+			lines.push_back("    CONFIGURATION MENU  ");
+		else
+			lines.push_back("    CONTROL  OPTIONS  ");
 		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("");
-		lines.push_back("  SPACEBAR:  BEGIN MISSION");
+		lines.push_back(" SPACEBAR:  BEGIN MISSION");
 		lines.push_back("");
-		lines.push_back("  COPYRIGHT 1988 INCENTIVE");
+		lines.push_back(" COPYRIGHT 1988 INCENTIVE");
 		lines.push_back("");
 		Graphics::Surface *surface = drawStringsInSurface(lines);
 		drawBorderScreenAndWait(surface);


Commit: 8c57ce8b14e4dbb51300a7194495b3e24c6a0e47
    https://github.com/scummvm/scummvm/commit/8c57ce8b14e4dbb51300a7194495b3e24c6a0e47
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-03-14T19:01:45+01:00

Commit Message:
FREESCAPE: implemented 2d eclipse indicator in eclipse

Changed paths:
    engines/freescape/games/eclipse/cpc.cpp
    engines/freescape/games/eclipse/dos.cpp
    engines/freescape/games/eclipse/eclipse.cpp
    engines/freescape/games/eclipse/eclipse.h
    engines/freescape/games/eclipse/zx.cpp


diff --git a/engines/freescape/games/eclipse/cpc.cpp b/engines/freescape/games/eclipse/cpc.cpp
index fba33fe7545..2a00c9207d9 100644
--- a/engines/freescape/games/eclipse/cpc.cpp
+++ b/engines/freescape/games/eclipse/cpc.cpp
@@ -121,6 +121,7 @@ void EclipseEngine::drawCPCUI(Graphics::Surface *surface) {
 	}
 	drawAnalogClock(surface, 90, 172, back, other, front);
 	drawIndicator(surface, 45, 4, 12);
+	drawEclipseIndicator(surface, 228, 0, front, other);
 }
 
 } // End of namespace Freescape
diff --git a/engines/freescape/games/eclipse/dos.cpp b/engines/freescape/games/eclipse/dos.cpp
index 20458e30283..5ddf9028596 100644
--- a/engines/freescape/games/eclipse/dos.cpp
+++ b/engines/freescape/games/eclipse/dos.cpp
@@ -109,6 +109,7 @@ void EclipseEngine::drawDOSUI(Graphics::Surface *surface) {
 	uint32 white = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0xFF);
 	uint32 red = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0x00, 0x00);
 	uint32 blue = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0xFF);
+	uint32 green = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x55, 0xFF, 0x55);
 	uint32 redish = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0x55, 0x55);
 
 	Common::String message;
@@ -150,6 +151,7 @@ void EclipseEngine::drawDOSUI(Graphics::Surface *surface) {
 	surface->fillRect(jarWater, blue);
 
 	drawIndicator(surface, 41, 4, 16);
+	drawEclipseIndicator(surface, 228, 0, yellow, green);
 }
 
 soundFx *EclipseEngine::load1bPCM(Common::SeekableReadStream *file, int offset) {
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index 38de6256b94..e0457326d7a 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -352,6 +352,59 @@ void EclipseEngine::drawAnalogClockHand(Graphics::Surface *surface, int x, int y
 	surface->drawLine(x, y, x+(int)w, y+(int)h, color);
 }
 
+// Copied from BITMAP::circlefill in engines/ags/lib/allegro/surface.cpp
+void fillCircle(Graphics::Surface *surface, int x, int y, int radius, int color) {
+	int cx = 0;
+	int cy = radius;
+	int df = 1 - radius;
+	int d_e = 3;
+	int d_se = -2 * radius + 5;
+
+	do {
+		surface->hLine(x - cy, y - cx, x + cy, color);
+
+		if (cx)
+			surface->hLine(x - cy, y + cx, x + cy, color);
+
+		if (df < 0) {
+			df += d_e;
+			d_e += 2;
+			d_se += 2;
+		} else {
+			if (cx != cy) {
+				surface->hLine(x - cx, y - cy, x + cx, color);
+
+				if (cy)
+					surface->hLine(x - cx, y + cy, x + cx, color);
+			}
+
+			df += d_se;
+			d_e += 2;
+			d_se += 4;
+			cy--;
+		}
+
+		cx++;
+
+	} while (cx <= cy);
+}
+
+void EclipseEngine::drawEclipseIndicator(Graphics::Surface *surface, int x, int y, uint32 color1, uint32 color2) {
+	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
+
+	// These calls will cover the pixels of the hardcoded eclipse image
+	surface->fillRect(Common::Rect(x, y, x + 50, y + 20), black);
+
+	float progress = 0;
+	if (_countdown >= 0)
+		progress = float(_countdown) / _initialCountdown;
+
+	int difference = 14 * progress;
+
+	fillCircle(surface, x + 7, y + 10, 7, color1); // Sun
+	fillCircle(surface, x + 7 + difference, y + 10, 7, color2); // Moon
+}
+
 void EclipseEngine::drawIndicator(Graphics::Surface *surface, int xPosition, int yPosition, int separation) {
 	if (_indicators.size() == 0)
 		return;
diff --git a/engines/freescape/games/eclipse/eclipse.h b/engines/freescape/games/eclipse/eclipse.h
index 9d02f767530..b9506d0b1a6 100644
--- a/engines/freescape/games/eclipse/eclipse.h
+++ b/engines/freescape/games/eclipse/eclipse.h
@@ -74,6 +74,7 @@ public:
 	void drawZXUI(Graphics::Surface *surface) override;
 	void drawAnalogClock(Graphics::Surface *surface, int x, int y, uint32 colorHand1, uint32 colorHand2, uint32 colorBack);
 	void drawAnalogClockHand(Graphics::Surface *surface, int x, int y, double degrees, double magnitude, uint32 color);
+	void drawEclipseIndicator(Graphics::Surface *surface, int x, int y, uint32 color1, uint32 color2);
 
 	soundFx *load1bPCM(Common::SeekableReadStream *file, int offset);
 
diff --git a/engines/freescape/games/eclipse/zx.cpp b/engines/freescape/games/eclipse/zx.cpp
index bf9e0938f41..d3065aa5f1c 100644
--- a/engines/freescape/games/eclipse/zx.cpp
+++ b/engines/freescape/games/eclipse/zx.cpp
@@ -134,6 +134,8 @@ void EclipseEngine::drawZXUI(Graphics::Surface *surface) {
 		drawStringInSurface("<", 240, 141, back, front, surface, 'Z' - '$' + 1);
 	}
 	drawAnalogClock(surface, 89, 172, back, back, gray);
+	drawEclipseIndicator(surface, 215, 3, front, gray);
+
 }
 
 } // End of namespace Freescape


Commit: 76e35e17486452c5212c49aa75ce7cc6562bc547
    https://github.com/scummvm/scummvm/commit/76e35e17486452c5212c49aa75ce7cc6562bc547
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-03-14T19:01:45+01:00

Commit Message:
FREESCAPE: fixes in the eclipse rendering in opengl

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


diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index e0457326d7a..1e05f95c2f7 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -150,6 +150,9 @@ void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
 	_lastPosition = _position;
 
 	if (areaID == _startArea && entranceID == _startEntrance) {
+		_yaw = 180;
+		_pitch = 0;
+
 		if (isSpectrum())
 			playSound(7, true);
 		else
@@ -184,7 +187,15 @@ void EclipseEngine::drawBackground() {
 		if (_countdown >= 0)
 			progress = float(_countdown) / _initialCountdown;
 
-		_gfx->drawEclipse(15, 10, progress);
+		uint8 color1 = 15;
+		uint8 color2 = 10;
+
+		if (isSpectrum() || isCPC()) {
+			color1 = 2;
+			color2 = 10;
+		}
+
+		_gfx->drawEclipse(color1, color2, progress);
 	}
 }
 
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index 8af986a338b..c6f5f57f69a 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -284,7 +284,6 @@ void OpenGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, by
 	uint8 r1, g1, b1, r2, g2, b2;
 	byte *stipple = nullptr;
 	getRGBAt(color, r1, g1, b1, r2, g2, b2, stipple);
-	glColor3ub(r1, g1, b1);
 
 	int triangleAmount = 20;
 	float twicePi = (float)(2.0 * M_PI);
@@ -309,6 +308,9 @@ void OpenGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, by
 	glDisable(GL_DEPTH_TEST);
 	glDepthMask(GL_FALSE);
 
+	setStippleData(stipple);
+	useColor(r1, g1, b1);
+
 	glEnableClientState(GL_VERTEX_ARRAY);
 	copyToVertexArray(0, position);
 
@@ -323,6 +325,27 @@ void OpenGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, by
 	glDrawArrays(GL_TRIANGLE_FAN, 0, triangleAmount + 2);
 	glDisableClientState(GL_VERTEX_ARRAY);
 
+	if (r1 != r2 || g1 != g2 || b1 != b2) {
+		useStipple(true);
+		useColor(r2, g2, b2);
+
+		glEnableClientState(GL_VERTEX_ARRAY);
+		copyToVertexArray(0, position);
+
+		for(int i = 0; i <= triangleAmount; i++) {
+			copyToVertexArray(i + 1,
+				Math::Vector3d(position.x(), position.y() + (radius * cos(i *  twicePi / triangleAmount)),
+							position.z() + (radius * sin(i * twicePi / triangleAmount)))
+			);
+		}
+
+		glVertexPointer(3, GL_FLOAT, 0, _verts);
+		glDrawArrays(GL_TRIANGLE_FAN, 0, triangleAmount + 2);
+		glDisableClientState(GL_VERTEX_ARRAY);
+
+		useStipple(false);
+	}
+
 	glEnable(GL_DEPTH_TEST);
 	glDepthMask(GL_TRUE);
 	glPopMatrix();




More information about the Scummvm-git-logs mailing list