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

neuromancer noreply at scummvm.org
Sat Nov 2 14:49:03 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:
95b8a6da3e FREESCAPE: correctly render the spirit meter when near the end of the game
6dd7eda864 FREESCAPE: allow to skip game over screens using more keys
a720d835cd FREESCAPE: make shield closer to original in castle
4f37dfe3d5 FREESCAPE: fixed uninitialized scalar fields in castle
5ac702ac54 FREESCAPE: fixed potential memory leak in castle
3f5d6fa942 FREESCAPE: fixed uninitialized variable in castle
cd82c1cf73 FREESCAPE: refactored castle code that load assets
d24cf46d4e FREESCAPE: fixes for parsing amiga data


Commit: 95b8a6da3e35f980c55c52e2340076cd41b0dc73
    https://github.com/scummvm/scummvm/commit/95b8a6da3e35f980c55c52e2340076cd41b0dc73
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-02T15:50:39+01:00

Commit Message:
FREESCAPE: correctly render the spirit meter when near the end of the game

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


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index e199a877a84..9b2e16cccfd 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -70,6 +70,7 @@ CastleEngine::CastleEngine(OSystem *syst, const ADGameDescription *gd) : Freesca
 	_optionTexture = nullptr;
 	_spiritsMeterIndicatorFrame = nullptr;
 	_spiritsMeterIndicatorBackgroundFrame = nullptr;
+	_spiritsMeterIndicatorSideFrame = nullptr;
 	_strenghtBackgroundFrame = nullptr;
 	_strenghtBarFrame = nullptr;
 	_thunderFrame = nullptr;
@@ -124,6 +125,11 @@ CastleEngine::~CastleEngine() {
 		delete _spiritsMeterIndicatorFrame;
 	}
 
+	if (_spiritsMeterIndicatorSideFrame) {
+		_spiritsMeterIndicatorSideFrame->free();
+		delete _spiritsMeterIndicatorSideFrame;
+	}
+
 	if (_strenghtBackgroundFrame) {
 		_strenghtBackgroundFrame->free();
 		delete _strenghtBackgroundFrame;
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index e6b394387d1..aab03220fb9 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -106,6 +106,7 @@ public:
 	Common::Array<Graphics::ManagedSurface *>_keysMenuFrames;
 	Graphics::ManagedSurface *_spiritsMeterIndicatorBackgroundFrame;
 	Graphics::ManagedSurface *_spiritsMeterIndicatorFrame;
+	Graphics::ManagedSurface *_spiritsMeterIndicatorSideFrame;
 	Graphics::ManagedSurface *_strenghtBackgroundFrame;
 	Graphics::ManagedSurface *_strenghtBarFrame;
 	Common::Array<Graphics::ManagedSurface *> _strenghtWeightsFrames;
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index 6be0174777f..324c52bb785 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -196,7 +196,7 @@ void CastleEngine::loadAssetsDOSFullGame() {
 			_strenghtWeightsFrames = loadFramesWithHeaderDOS(stream, 4);
 			_spiritsMeterIndicatorBackgroundFrame = loadFrameWithHeaderDOS(stream);
 			_spiritsMeterIndicatorFrame = loadFrameWithHeaderDOS(stream);
-			loadFrameWithHeaderDOS(stream); // side
+			_spiritsMeterIndicatorSideFrame = loadFrameWithHeaderDOS(stream); // side
 			loadFrameWithHeaderDOS(stream); // ???
 
 			/*for (int i = 0; i < 6; i++)
@@ -465,7 +465,8 @@ void CastleEngine::drawDOSUI(Graphics::Surface *surface) {
 	surface->copyRectToSurface(*_flagFrames[flagFrameIndex], 285, 5, Common::Rect(0, 0, _flagFrames[flagFrameIndex]->w, _flagFrames[flagFrameIndex]->h));
 
 	surface->copyRectToSurface((const Graphics::Surface)*_spiritsMeterIndicatorBackgroundFrame, 136, 162, Common::Rect(0, 0, _spiritsMeterIndicatorBackgroundFrame->w, _spiritsMeterIndicatorBackgroundFrame->h));
-	surface->copyRectToSurfaceWithKey((const Graphics::Surface)*_spiritsMeterIndicatorFrame, 125 + _spiritsMeterPosition, 161, Common::Rect(0, 0, _spiritsMeterIndicatorFrame->w, _spiritsMeterIndicatorFrame->h), black);
+	surface->copyRectToSurfaceWithKey((const Graphics::Surface)*_spiritsMeterIndicatorFrame, 125 + 6 + _spiritsMeterPosition, 161, Common::Rect(0, 0, _spiritsMeterIndicatorFrame->w, _spiritsMeterIndicatorFrame->h), black);
+	surface->copyRectToSurface((const Graphics::Surface)*_spiritsMeterIndicatorSideFrame, 122 + 5 + 1, 157 + 5 - 1, Common::Rect(0, 0, _spiritsMeterIndicatorSideFrame->w / 2, _spiritsMeterIndicatorSideFrame->h));
 	//surface->copyRectToSurface(*_spiritsMeterIndicatorFrame, 100, 50, Common::Rect(0, 0, _spiritsMeterIndicatorFrame->w, _spiritsMeterIndicatorFrame->h));
 }
 


Commit: 6dd7eda864b1ed80dfae5873802c6a1239125f21
    https://github.com/scummvm/scummvm/commit/6dd7eda864b1ed80dfae5873802c6a1239125f21
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-02T15:50:39+01:00

Commit Message:
FREESCAPE: allow to skip game over screens using more keys

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


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 9b2e16cccfd..d3ef85456b6 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -706,6 +706,14 @@ void CastleEngine::drawFullscreenEndGameAndWait() {
 
 			// Events
 			switch (event.type) {
+			case Common::EVENT_LBUTTONDOWN:
+				if (magisterAlive) {
+					surface->copyRectToSurface(*_endGameThroneFrame, 121, 52, Common::Rect(0, 0, _endGameThroneFrame->w - 1, _endGameThroneFrame->h));
+					magisterAlive = false;
+				} else
+					cont = false;
+				break;
+
 			case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
 				if (event.customType == kActionShoot) {
 					if (magisterAlive) {
@@ -809,8 +817,11 @@ void CastleEngine::drawFullscreenGameOverAndWait() {
 
 			// Events
 			switch (event.type) {
+			case Common::EVENT_LBUTTONDOWN:
+				cont = false;
+				break;
 			case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
-				if (event.customType == kActionShoot) {
+				if (event.customType == kActionShoot || event.customType == kActionChangeMode || event.customType == kActionSkip) {
 					cont = false;
 				}
 				break;


Commit: a720d835cddf9a65e223deb7f23cea318edc0e40
    https://github.com/scummvm/scummvm/commit/a720d835cddf9a65e223deb7f23cea318edc0e40
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-02T15:50:39+01:00

Commit Message:
FREESCAPE: make shield closer to original in castle

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


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index d3ef85456b6..142d2c80f2b 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -373,7 +373,7 @@ void CastleEngine::initGameState() {
 	FreescapeEngine::initGameState();
 	_playerHeightNumber = 1;
 
-	_gameStateVars[k8bitVariableShield] = 20;
+	_gameStateVars[k8bitVariableShield] = 16;
 	_gameStateVars[k8bitVariableEnergy] = 1;
 	_gameStateVars[8] = 128; // -1
 	_countdown = INT_MAX - 8;
@@ -512,7 +512,7 @@ void CastleEngine::drawInfoMenu() {
 		_gfx->readFromPalette(10, r, g, b);
 		front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
 		drawStringInSurface(Common::String::format("%07d", score), 166, 71, front, black, surface);
-		drawStringInSurface(centerAndPadString(Common::String::format("%s", _messagesList[134 + shield / 6].c_str()), 10), 151, 102,  front, black, surface);
+		drawStringInSurface(centerAndPadString(Common::String::format("%s", _messagesList[135 + shield / 6].c_str()), 10), 151, 102,  front, black, surface);
 
 		Common::String keysCollected = _messagesList[141];
 		Common::replace(keysCollected, "X", Common::String::format("%d", _keysCollected.size()));
@@ -1145,30 +1145,32 @@ void CastleEngine::drawEnergyMeter(Graphics::Surface *surface, Common::Point ori
 	int frameIdx = -1;
 
 	weightPoint = Common::Point(origin.x + 10, origin.y);
-	frameIdx = 4 - _gameStateVars[k8bitVariableShield] % 5;
+	frameIdx = _gameStateVars[k8bitVariableShield] % 4;
 
 	if (_strenghtWeightsFrames.empty())
 		return;
 
-	if (frameIdx != 4) {
+	if (frameIdx != 0) {
+		frameIdx = 4 - frameIdx;
 		surface->copyRectToSurfaceWithKey((const Graphics::Surface)*_strenghtWeightsFrames[frameIdx], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[frameIdx]->h), back);
 		weightPoint += Common::Point(3, 0);
 	}
 
-	for (int i = 0; i < _gameStateVars[k8bitVariableShield] / 5; i++) {
+	for (int i = 0; i < _gameStateVars[k8bitVariableShield] / 4; i++) {
 		surface->copyRectToSurfaceWithKey((const Graphics::Surface)*_strenghtWeightsFrames[0], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[0]->h), back);
 		weightPoint += Common::Point(3, 0);
 	}
 
 	weightPoint = Common::Point(origin.x + 62, origin.y);
-	frameIdx = 4 - _gameStateVars[k8bitVariableShield] % 5;
+	frameIdx = _gameStateVars[k8bitVariableShield] % 4;
 
-	if (frameIdx != 4) {
+	if (frameIdx != 0) {
+		frameIdx = 4 - frameIdx;
 		surface->copyRectToSurfaceWithKey((const Graphics::Surface)*_strenghtWeightsFrames[frameIdx], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[frameIdx]->h), back);
 		weightPoint += Common::Point(-3, 0);
 	}
 
-	for (int i = 0; i < _gameStateVars[k8bitVariableShield] / 5; i++) {
+	for (int i = 0; i < _gameStateVars[k8bitVariableShield] / 4; i++) {
 		surface->copyRectToSurfaceWithKey((const Graphics::Surface)*_strenghtWeightsFrames[0], weightPoint.x, weightPoint.y, Common::Rect(0, 0, 3, _strenghtWeightsFrames[0]->h), back);
 		weightPoint += Common::Point(-3, 0);
 	}


Commit: 4f37dfe3d5d18d8c4af550bf9b5c6c57be3cfce7
    https://github.com/scummvm/scummvm/commit/4f37dfe3d5d18d8c4af550bf9b5c6c57be3cfce7
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-02T15:50:39+01:00

Commit Message:
FREESCAPE: fixed uninitialized scalar fields in castle

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


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 142d2c80f2b..3078ec59bbf 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -93,6 +93,8 @@ CastleEngine::CastleEngine(OSystem *syst, const ADGameDescription *gd) : Freesca
 
 	_spiritsMeter = 32;
 	_spiritsToKill = 26;
+	_spiritsMeterPosition = 0;
+	_spiritsMeterMax = 64;
 }
 
 CastleEngine::~CastleEngine() {
@@ -379,7 +381,6 @@ void CastleEngine::initGameState() {
 	_countdown = INT_MAX - 8;
 	_keysCollected.clear();
 	_spiritsMeter = 32;
-	_spiritsMeterMax = 64;
 
 	_exploredAreas[_startArea] = true;
 	if (_useRockTravel) // Enable cheat


Commit: 5ac702ac547490539293d4a85a87cf1728f8ebbe
    https://github.com/scummvm/scummvm/commit/5ac702ac547490539293d4a85a87cf1728f8ebbe
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-02T15:50:39+01:00

Commit Message:
FREESCAPE: fixed potential memory leak in castle

Changed paths:
    engines/freescape/language/8bitDetokeniser.cpp


diff --git a/engines/freescape/language/8bitDetokeniser.cpp b/engines/freescape/language/8bitDetokeniser.cpp
index 86143bf9f8d..4ad725f38b9 100644
--- a/engines/freescape/language/8bitDetokeniser.cpp
+++ b/engines/freescape/language/8bitDetokeniser.cpp
@@ -36,6 +36,9 @@ Common::String detokenise8bitCondition(Common::Array<uint16> &tokenisedCondition
 	Common::Array<uint8>::size_type bytePointer = 0;
 	Common::Array<uint8>::size_type sizeOfTokenisedContent = tokenisedCondition.size();
 
+	if (sizeOfTokenisedContent == 0)
+		error("No tokenised content");
+
 	// on the 8bit platforms, all instructions have a conditional flag;
 	// we'll want to convert them into runs of "if shot? then", "if collided? then" or "if timer? then",
 	// and we'll want to start that from the top


Commit: 3f5d6fa942b2bc46fe047aa0b605c388c4dd61b4
    https://github.com/scummvm/scummvm/commit/3f5d6fa942b2bc46fe047aa0b605c388c4dd61b4
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-02T15:50:39+01:00

Commit Message:
FREESCAPE: fixed uninitialized variable in castle

Changed paths:
    engines/freescape/events.cpp


diff --git a/engines/freescape/events.cpp b/engines/freescape/events.cpp
index 3bc38bf53ed..50316308c3a 100644
--- a/engines/freescape/events.cpp
+++ b/engines/freescape/events.cpp
@@ -26,7 +26,8 @@ namespace Freescape {
 
 EventManagerWrapper::EventManagerWrapper(Common::EventManager *delegate) :
 		_delegate(delegate),
-		_keyRepeatTime(0) {
+		_keyRepeatTime(0),
+		_currentActionDown(kActionNone) {
 	assert(delegate);
 }
 


Commit: cd82c1cf732d1e997193d05be72e181e5923bb59
    https://github.com/scummvm/scummvm/commit/cd82c1cf732d1e997193d05be72e181e5923bb59
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-02T15:50:39+01:00

Commit Message:
FREESCAPE: refactored castle code that load assets

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


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 3078ec59bbf..416241c4cbd 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -899,14 +899,6 @@ void CastleEngine::loadAssets() {
 	FreescapeEngine::loadAssets();
 
 	addGhosts();
-	// Discard the first three global conditions
-	// It is unclear why they hide/unhide objects that formed the spirits
-	for (int i = 0; i < 3; i++) {
-		debugC(kFreescapeDebugParser, "Discarding condition %s", _conditionSources[1].c_str());
-		_conditions.remove_at(1);
-		_conditionSources.remove_at(1);
-	}
-
 	_endArea = 1;
 	_endEntrance = 42;
 
@@ -918,15 +910,25 @@ void CastleEngine::loadAssets() {
 	_outOfReachMessage = _messagesList[7];
 	_noEffectMessage = _messagesList[8];
 
-	Graphics::Surface *tmp;
-	tmp = loadBundledImage("castle_gate", !isDOS());
-	_gameOverBackgroundFrame = new Graphics::ManagedSurface;
-	_gameOverBackgroundFrame->copyFrom(*tmp);
-	_gameOverBackgroundFrame->convertToInPlace(_gfx->_texturePixelFormat);
-	tmp->free();
-	delete tmp;
+	if (!isAmiga()) {
+		Graphics::Surface *tmp;
+		tmp = loadBundledImage("castle_gate", !isDOS());
+		_gameOverBackgroundFrame = new Graphics::ManagedSurface;
+		_gameOverBackgroundFrame->copyFrom(*tmp);
+		_gameOverBackgroundFrame->convertToInPlace(_gfx->_texturePixelFormat);
+		tmp->free();
+		delete tmp;
+	}
 
 	if (isDOS()) {
+		// Discard some global conditions
+		// It is unclear why they hide/unhide objects that formed the spirits
+		for (int i = 0; i < 3; i++) {
+			debugC(kFreescapeDebugParser, "Discarding condition %s", _conditionSources[1].c_str());
+			_conditions.remove_at(1);
+			_conditionSources.remove_at(1);
+		}
+
 		for (auto &it : _areaMap) {
 			it._value->addStructure(_areaMap[255]);
 			it._value->addObjectFromArea(227, _areaMap[255]);
@@ -935,10 +937,10 @@ void CastleEngine::loadAssets() {
 			it._value->addObjectFromArea(242, _areaMap[255]);
 			it._value->addObjectFromArea(139, _areaMap[255]);
 		}
-
-		_areaMap[1]->addFloor();
-		_areaMap[2]->addFloor();
 	}
+	_areaMap[1]->addFloor();
+	_areaMap[2]->addFloor();
+
 }
 
 void CastleEngine::loadRiddles(Common::SeekableReadStream *file, int offset, int number) {
diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index 6571546e2b2..c51e47b0599 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -233,8 +233,13 @@ void CastleEngine::loadAssetsZXFullGame() {
 			it._value->addObjectFromArea(id, _areaMap[255]);
 		}
 	}
-	_areaMap[1]->addFloor();
-	_areaMap[2]->addFloor();
+	// Discard some global conditions
+	// It is unclear why they hide/unhide objects that formed the spirits
+	for (int i = 0; i < 3; i++) {
+		debugC(kFreescapeDebugParser, "Discarding condition %s", _conditionSources[0].c_str());
+		_conditions.remove_at(0);
+		_conditionSources.remove_at(0);
+	}
 }
 
 void CastleEngine::drawZXUI(Graphics::Surface *surface) {


Commit: d24cf46d4e772ebc6a8a5c44885f13d20d6832cb
    https://github.com/scummvm/scummvm/commit/d24cf46d4e772ebc6a8a5c44885f13d20d6832cb
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-11-02T15:50:39+01:00

Commit Message:
FREESCAPE: fixes for parsing amiga data

Changed paths:
    engines/freescape/games/castle/amiga.cpp
    engines/freescape/loaders/8bitBinaryLoader.cpp


diff --git a/engines/freescape/games/castle/amiga.cpp b/engines/freescape/games/castle/amiga.cpp
index 59b29ab5f75..2f7de6a37bc 100644
--- a/engines/freescape/games/castle/amiga.cpp
+++ b/engines/freescape/games/castle/amiga.cpp
@@ -95,7 +95,6 @@ void CastleEngine::loadAssetsAmigaDemo() {
 	file.seek(0x2be96); // Area 255
 	_areaMap[255] = load8bitArea(&file, 16);
 
-
 	file.seek(0x2cf28 + 0x28 - 0x2 + 0x28);
 	_border = loadFrameFromPlanesVertical(&file, 160, 200);
 	_border->convertToInPlace(_gfx->_texturePixelFormat, borderPalete, 16);
@@ -105,9 +104,6 @@ void CastleEngine::loadAssetsAmigaDemo() {
 	_areaMap[2]->_groundColor = 1;
 	for (auto &it : _areaMap)
 		it._value->addStructure(_areaMap[255]);
-
-	_areaMap[1]->addFloor();
-	_areaMap[2]->addFloor();
 }
 
 void CastleEngine::drawAmigaAtariSTUI(Graphics::Surface *surface) {
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index b0ce40f7f03..6238d4c12aa 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -42,6 +42,8 @@ uint16 FreescapeEngine::readPtr(Common::SeekableReadStream *file) {
 		uint16 hi = file->readUint16BE();
 		assert(hi < 256);
 		value = 256 * hi + lo;
+		if (value >= 0xFFFF / 2)
+			error("Failed to read pointer with value 0x%x", value);
 		value = 2 * value;
 	} else
 		value = file->readUint16LE();
@@ -802,8 +804,10 @@ void FreescapeEngine::load8bitBinary(Common::SeekableReadStream *file, int offse
 		numberOfAreas = 87;
 	debugC(1, kFreescapeDebugParser, "Number of areas: %d", numberOfAreas);
 
-	uint32 dbSize = readPtr(file);
+	uint32 dbSize = readField(file, 16);
 	debugC(1, kFreescapeDebugParser, "Database ends at %x", dbSize);
+	if (isAmiga() || isAtariST())
+		debugC(1, kFreescapeDebugParser, "Extra field: %x", readField(file, 16));
 
 	uint8 startArea = readField(file, 8);
 	debugC(1, kFreescapeDebugParser, "Start area: %d", startArea);




More information about the Scummvm-git-logs mailing list