[Scummvm-git-logs] scummvm master -> 53ecfc952bcc7ac3b361151107c208f0b08be3e7

neuromancer noreply at scummvm.org
Wed Oct 30 19:43:48 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:
c10b53de1e FREESCAPE: improve handling of condition execution when a goto is executed
d384a92749 FREESCAPE: avoid crashing when _ecolours is null
98d4ec9fd3 FREESCAPE: fixes for castle dos demo
53ecfc952b FREESCAPE: correctly load key image in castle for zx


Commit: c10b53de1edcbd74ff9539a5785d044c02352f3d
    https://github.com/scummvm/scummvm/commit/c10b53de1edcbd74ff9539a5785d044c02352f3d
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-30T20:45:26+01:00

Commit Message:
FREESCAPE: improve handling of condition execution when a goto is executed

Changed paths:
    engines/freescape/games/castle/castle.cpp
    engines/freescape/language/instruction.cpp
    engines/freescape/movement.cpp


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 4f860ab5a78..57ce1c50a76 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -349,12 +349,12 @@ void CastleEngine::gotoArea(uint16 areaID, int entranceID) {
 		_gfx->_paperColor = 0;
 	resetInput();
 
-	if (entranceID > 0) {
+	/*if (entranceID > 0) {
 		Entrance *entrance = (Entrance *)_currentArea->entranceWithID(entranceID);
 		assert(entrance);
 		executeEntranceConditions(entrance);
 		executeMovementConditions();
-	}
+	}*/
 }
 
 void CastleEngine::initGameState() {
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index 88b859515c0..cfbf13f7fd3 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -480,7 +480,7 @@ bool FreescapeEngine::checkIfGreaterOrEqual(FCLInstruction &instruction) {
 
 	uint16 variable = instruction._source;
 	int8 value = instruction._destination;
-	debugC(1, kFreescapeDebugCode, "Check if variable %d is greater than equal to %d!", variable, value);
+	debugC(1, kFreescapeDebugCode, "Check if variable %d with value %d is greater or equal to %d!", variable, (int8)_gameStateVars[variable], value);
 	return ((int8)_gameStateVars[variable] >= value);
 }
 
@@ -489,7 +489,7 @@ bool FreescapeEngine::checkIfLessOrEqual(FCLInstruction &instruction) {
 
 	uint16 variable = instruction._source;
 	int8 value = instruction._destination;
-	debugC(1, kFreescapeDebugCode, "Check if variable %d is less than equal to %d!", variable, value);
+	debugC(1, kFreescapeDebugCode, "Check if variable %d with value %d is less or equal to %d!", variable, (int8)_gameStateVars[variable], value);
 	return ((int8)_gameStateVars[variable] <= value);
 }
 
@@ -497,7 +497,7 @@ bool FreescapeEngine::checkIfLessOrEqual(FCLInstruction &instruction) {
 bool FreescapeEngine::executeEndIfNotEqual(FCLInstruction &instruction) {
 	uint16 variable = instruction._source;
 	uint16 value = instruction._destination;
-	debugC(1, kFreescapeDebugCode, "End condition if variable %d is not equal to %d!", variable, value);
+	debugC(1, kFreescapeDebugCode, "End condition if variable %d with value %d is not equal to %d!", variable, (int8)_gameStateVars[variable], value);
 	return (_gameStateVars[variable] != value);
 }
 
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index 29cdf92d975..f070553b1c5 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -451,9 +451,9 @@ void FreescapeEngine::resolveCollisions(Math::Vector3d const position) {
 
 bool FreescapeEngine::runCollisionConditions(Math::Vector3d const lastPosition, Math::Vector3d const newPosition) {
 	bool executed = false;
-	uint16 areaID = _currentArea->getAreaID();
 	GeometricObject *gobj = nullptr;
 	Object *collided = nullptr;
+	_gotoExecuted = false;
 
 	Math::Ray ray(newPosition, -_upVector);
 	collided = _currentArea->checkCollisionRay(ray, _playerHeight + 3);
@@ -463,8 +463,10 @@ bool FreescapeEngine::runCollisionConditions(Math::Vector3d const lastPosition,
 		executed |= executeObjectConditions(gobj, false, true, false);
 	}
 
-	if (areaID != _currentArea->getAreaID())
+	if (_gotoExecuted) {
+		executeMovementConditions();
 		return collided;
+	}
 
 	Math::Vector3d direction = newPosition - lastPosition;
 	direction.normalize();
@@ -474,6 +476,7 @@ bool FreescapeEngine::runCollisionConditions(Math::Vector3d const lastPosition,
 	else if (_currentArea->getScale() >= 5)
 		rayLenght = MAX(5, 45 / (2 * _currentArea->getScale()));
 
+	_gotoExecuted = false;
 	for (int i = 0; i <= 4; i++) {
 		Math::Vector3d rayPosition = lastPosition;
 		rayPosition.y() = rayPosition.y() - _playerHeight * (i / 4.0);
@@ -485,7 +488,8 @@ bool FreescapeEngine::runCollisionConditions(Math::Vector3d const lastPosition,
 			executed |= executeObjectConditions(gobj, false, true, false);
 			//break;
 		}
-		if (areaID != _currentArea->getAreaID()) {
+		if (_gotoExecuted) {
+			executeMovementConditions();
 			return true;
 		}
 	}


Commit: d384a92749e112e01dae5b48637d85f522a92620
    https://github.com/scummvm/scummvm/commit/d384a92749e112e01dae5b48637d85f522a92620
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-30T20:45:26+01:00

Commit Message:
FREESCAPE: avoid crashing when _ecolours is null

Changed paths:
    engines/freescape/objects/geometricobject.cpp


diff --git a/engines/freescape/objects/geometricobject.cpp b/engines/freescape/objects/geometricobject.cpp
index b66a483a128..c3647016676 100644
--- a/engines/freescape/objects/geometricobject.cpp
+++ b/engines/freescape/objects/geometricobject.cpp
@@ -455,10 +455,12 @@ bool GeometricObject::collides(const Math::AABB &boundingBox_) {
 
 void GeometricObject::draw(Renderer *gfx, float offset) {
 	if (_cyclingColors) {
+		assert(_colours);
 		if (g_system->getMillis() % 10 == 0)
 			for (uint i = 0; i < _colours->size(); i++) {
 				(*_colours)[i] = ((*_colours)[i] + 1) % 0xf;
-				(*_ecolours)[i] = ((*_ecolours)[i] + 1) % 0xf;
+				if (_ecolours)
+					(*_ecolours)[i] = ((*_ecolours)[i] + 1) % 0xf;
 			}
 	}
 


Commit: 98d4ec9fd39e3f05dc1027618569dcdc66ef3d4d
    https://github.com/scummvm/scummvm/commit/98d4ec9fd39e3f05dc1027618569dcdc66ef3d4d
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-30T20:45:26+01:00

Commit Message:
FREESCAPE: fixes for castle dos demo

Changed paths:
    engines/freescape/games/castle/castle.cpp
    engines/freescape/games/castle/dos.cpp
    engines/freescape/language/instruction.cpp


diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index 57ce1c50a76..15017aa4165 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -294,6 +294,9 @@ void CastleEngine::initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *inf
 void CastleEngine::gotoArea(uint16 areaID, int entranceID) {
 	debugC(1, kFreescapeDebugMove, "Jumping to area: %d, entrance: %d", areaID, entranceID);
 
+	if (!_areaMap.contains(areaID) && isDemo())
+		return; // Abort area change if the destination does not exist (demo only)
+
 	if (!_exploredAreas.contains(areaID)) {
 		_gameStateVars[k8bitVariableScore] += 17500;
 		_exploredAreas[areaID] = true;
@@ -821,7 +824,10 @@ void CastleEngine::executeDestroy(FCLInstruction &instruction) {
 void CastleEngine::executePrint(FCLInstruction &instruction) {
 	uint16 index = instruction._source;
 	_currentAreaMessages.clear();
-	if (index >= 129) {
+	if (index == 128 && isDemo()) {
+		drawFullscreenRiddleAndWait(18);
+		return;
+	} else if (index >= 129) {
 		index = index - 129;
 		drawFullscreenRiddleAndWait(index);
 		return;
@@ -918,6 +924,8 @@ void CastleEngine::loadRiddles(Common::SeekableReadStream *file, int offset, int
 }
 
 void CastleEngine::drawFullscreenRiddleAndWait(uint16 riddle) {
+	debugC(1, kFreescapeDebugCode, "Printing fullscreen riddle %d", riddle);
+
 	if (_savedScreen) {
 		_savedScreen->free();
 		delete _savedScreen;
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index 4bc15788012..1dc21812d18 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -440,6 +440,27 @@ void CastleEngine::loadAssetsDOSDemo() {
 		delete stream;
 	} else
 		error("Not implemented yet");
+
+
+	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;
+
+	Graphics::Surface *tmp;
+	tmp = loadBundledImage("castle_gate", false);
+	_gameOverBackgroundFrame = new Graphics::ManagedSurface;
+	_gameOverBackgroundFrame->copyFrom(*tmp);
+	_gameOverBackgroundFrame->convertToInPlace(_gfx->_texturePixelFormat);
+	tmp->free();
+	delete tmp;
 }
 
 void CastleEngine::drawDOSUI(Graphics::Surface *surface) {
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index cfbf13f7fd3..0ccf4395f2b 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -583,6 +583,19 @@ void FreescapeEngine::executeMakeInvisible(FCLInstruction &instruction) {
 	debugC(1, kFreescapeDebugCode, "Making obj %d invisible in area %d!", objectID, areaID);
 	if (_areaMap.contains(areaID)) {
 		Object *obj = _areaMap[areaID]->objectWithID(objectID);
+
+		if (!obj) {
+			// Object is not in the area, but it should be invisible so we can return immediately
+			return;
+			/*obj = _areaMap[255]->objectWithID(objectID);
+			if (!obj) {
+				error("obj %d does not exists in area %d nor in the global one!", objectID, areaID);
+				return;
+			}
+			_currentArea->addObjectFromArea(objectID, _areaMap[255]);
+			obj = _areaMap[areaID]->objectWithID(objectID);*/
+		}
+
 		assert(obj); // We assume the object was there
 		obj->makeInvisible();
 	} else {
@@ -611,7 +624,8 @@ void FreescapeEngine::executeMakeVisible(FCLInstruction &instruction) {
 		if (!obj) {
 			obj = _areaMap[255]->objectWithID(objectID);
 			if (!obj) {
-				error("obj %d does not exists in area %d nor in the global one!", objectID, areaID);
+				if (!isCastle() || !isDemo())
+					error("obj %d does not exists in area %d nor in the global one!", objectID, areaID);
 				return;
 			}
 			_currentArea->addObjectFromArea(objectID, _areaMap[255]);


Commit: 53ecfc952bcc7ac3b361151107c208f0b08be3e7
    https://github.com/scummvm/scummvm/commit/53ecfc952bcc7ac3b361151107c208f0b08be3e7
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-30T20:45:26+01:00

Commit Message:
FREESCAPE: correctly load key image in castle for zx

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


diff --git a/engines/freescape/games/castle/zx.cpp b/engines/freescape/games/castle/zx.cpp
index a8aa2d8e88f..e8c73b7cec8 100644
--- a/engines/freescape/games/castle/zx.cpp
+++ b/engines/freescape/games/castle/zx.cpp
@@ -155,7 +155,7 @@ void CastleEngine::loadAssetsZXFullGame() {
 	_gfx->readFromPalette(7, r, g, b);
 	uint32 white = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
 
-	_keysBorderFrames.push_back(loadFrameWithHeader(&file, 0xdf7, red, white));
+	_keysBorderFrames.push_back(loadFrameWithHeader(&file, _language == Common::ES_ESP ? 0xe06 : 0xdf7, red, white));
 
 	uint32 green = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0, 0xff, 0);
 	_spiritsMeterIndicatorFrame = loadFrameWithHeader(&file, _language == Common::ES_ESP ? 0xe5e : 0xe4f, green, white);




More information about the Scummvm-git-logs mailing list