[Scummvm-git-logs] scummvm master -> 5b791014bba56259386fe0d4858ea96675307ecf

neuromancer noreply at scummvm.org
Mon Feb 5 13:28:11 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:
5b791014bb FREESCAPE: more code for dos releases of eclipse


Commit: 5b791014bba56259386fe0d4858ea96675307ecf
    https://github.com/scummvm/scummvm/commit/5b791014bba56259386fe0d4858ea96675307ecf
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-02-05T14:28:36+01:00

Commit Message:
FREESCAPE: more code for dos releases of eclipse

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


diff --git a/engines/freescape/games/eclipse/dos.cpp b/engines/freescape/games/eclipse/dos.cpp
index 24aeccefb0b..6704e810f6d 100644
--- a/engines/freescape/games/eclipse/dos.cpp
+++ b/engines/freescape/games/eclipse/dos.cpp
@@ -19,8 +19,6 @@
  *
  */
 
-#include "common/file.h"
-
 #include "freescape/freescape.h"
 #include "freescape/games/eclipse/eclipse.h"
 #include "freescape/language/8bitDetokeniser.h"
@@ -75,6 +73,7 @@ void EclipseEngine::loadAssetsDOSFullGame() {
 		if (!file.isOpen())
 			error("Failed to open TOTEC.EXE");
 
+		load1bPCM(&file, 0xd038 - 4);
 		loadFonts(&file, 0xd403);
 		load8bitBinary(&file, 0x2530, 4);
 		for (auto &it : _areaMap) {
@@ -84,17 +83,20 @@ void EclipseEngine::loadAssetsDOSFullGame() {
 		}
 		_border = load8bitBinImage(&file, 0x210);
 		_border->setPalette((byte *)&kEclipseCGAPaletteRedGreen, 0, 4);
+
 	} else
 		error("Invalid or unsupported render mode %s for Total Eclipse", Common::getRenderModeDescription(_renderMode));
 }
 
 void EclipseEngine::drawDOSUI(Graphics::Surface *surface) {
 	int score = _gameStateVars[k8bitVariableScore];
+	int shield = _gameStateVars[k8bitVariableShield];
 	uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0x55);
 	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
 	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 redish = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0x55, 0x55);
 
 	Common::String message;
 	int deadline;
@@ -109,6 +111,9 @@ void EclipseEngine::drawDOSUI(Graphics::Surface *surface) {
 	Common::String scoreStr = Common::String::format("%07d", score);
 	drawStringInSurface(scoreStr, 136, 6, black, white, surface, 'Z' - '0' + 1);
 
+	Common::String shieldStr = Common::String::format("%02d", shield * 100 / _maxShield);
+	drawStringInSurface(shieldStr, 171, 162, black, redish, surface);
+
 	drawStringInSurface(Common::String('0' + _angleRotationIndex - 3), 79, 135, black, yellow, surface, 'Z' - '$' + 1);
 	drawStringInSurface(Common::String('3' - _playerStepIndex), 63, 135, black, yellow, surface, 'Z' - '$' + 1);
 	drawStringInSurface(Common::String('7' - _playerHeightNumber), 240, 135, black, yellow, surface, 'Z' - '$' + 1);
@@ -127,4 +132,24 @@ void EclipseEngine::drawDOSUI(Graphics::Surface *surface) {
 
 }
 
+Common::MemoryReadStream *EclipseEngine::load1bPCM(Common::File *file, int offset) {
+	file->seek(offset);
+	int size = file->readUint16LE();
+	debug("size: %d", size);
+	int freq = file->readUint16LE();
+	debug("freq: %x", freq);
+
+	uint8 *buf = (uint8 *)malloc(size * sizeof(uint8) * 8);
+	for (int i = 0; i < size; i++) {
+		uint8 byte = file->readByte();
+		for (int j = 0; j < 8; j++) {
+			buf[8 * i + j] = byte & 1 ? 255 : 0;
+			byte = byte >> 1;
+		}
+	}
+
+	return (new Common::MemoryReadStream(buf, size * 8));
+}
+
+
 } // End of namespace Freescape
\ No newline at end of file
diff --git a/engines/freescape/games/eclipse/eclipse.cpp b/engines/freescape/games/eclipse/eclipse.cpp
index 9fe07038660..4a0bd3d9ca8 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -124,6 +124,35 @@ void EclipseEngine::initGameState() {
 	_gameStateVars[k8bitVariableShield] = _initialShield;
 }
 
+bool EclipseEngine::checkIfGameEnded() {
+	if (_hasFallen) {
+		_hasFallen = false;
+		playSound(14, false);
+		insertTemporaryMessage(_messagesList[3], _countdown - 4);
+		drawBackground();
+		drawBorder();
+		drawUI();
+		_gfx->flipBuffer();
+		g_system->updateScreen();
+		g_system->delayMillis(1000);
+		gotoArea(1, 33);
+	}
+
+	if (_currentArea->getAreaID() == 1 && _flyMode) {
+		// Draw a few frames
+		for (int i = 0; i < 10; i++) {
+			drawFrame();
+			_gfx->flipBuffer();
+			g_system->updateScreen();
+			g_system->delayMillis(10);
+		}
+
+		g_system->delayMillis(5000);
+		return true;
+	}
+	return false;
+}
+
 void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
 	debugC(1, kFreescapeDebugMove, "Jumping to area: %d, entrance: %d", areaID, entranceID);
 
@@ -144,6 +173,8 @@ void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
 
 	if (areaID == _startArea && entranceID == _startEntrance)
 		playSound(9, true);
+	if (areaID == _startArea && entranceID == 33)
+		_flyMode = true;
 	else
 		playSound(5, false);
 
diff --git a/engines/freescape/games/eclipse/eclipse.h b/engines/freescape/games/eclipse/eclipse.h
index c1d0bef1f4b..95b7134ae00 100644
--- a/engines/freescape/games/eclipse/eclipse.h
+++ b/engines/freescape/games/eclipse/eclipse.h
@@ -19,6 +19,9 @@
  *
  */
 
+#include "common/file.h"
+#include "common/memstream.h"
+
 namespace Freescape {
 
 enum EclipseReleaseFlags {
@@ -48,7 +51,6 @@ public:
 	void initGameState() override;
 	void executePrint(FCLInstruction &instruction) override;
 
-
 	void drawBackground() override;
 	void drawDOSUI(Graphics::Surface *surface) override;
 	void drawCPCUI(Graphics::Surface *surface) override;
@@ -56,7 +58,9 @@ public:
 	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);
 
+	Common::MemoryReadStream *load1bPCM(Common::File *file, int offset);
 
+	bool checkIfGameEnded() override;
 	Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
 	Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream) override;
 };




More information about the Scummvm-git-logs mailing list