[Scummvm-git-logs] scummvm master -> 69638ccb4df1d207077065c21b8859a88e539847

neuromancer noreply at scummvm.org
Thu Aug 24 20:54:34 UTC 2023


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

Summary:
45dace5e80 FREESCAPE: fix area transitions for some dark areas
69638ccb4d FREESCAPE: simplified entrance code for eclipse


Commit: 45dace5e80a988005d2b091f44213cb5fd256b9d
    https://github.com/scummvm/scummvm/commit/45dace5e80a988005d2b091f44213cb5fd256b9d
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-08-24T22:53:26+02:00

Commit Message:
FREESCAPE: fix area transitions for some dark areas

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


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 9637adf926e..90ac6e17c21 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -84,6 +84,7 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd)
 	_startArea = 0;
 	_startEntrance = 0;
 	_currentArea = nullptr;
+	_gotoExecuted = false;
 	_rotation = Math::Vector3d(0, 0, 0);
 	_position = Math::Vector3d(0, 0, 0);
 	_lastPosition = Math::Vector3d(0, 0, 0);
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 2c81d2f6730..b338d9507b7 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -215,6 +215,7 @@ public:
 	uint16 _startArea;
 	AreaMap _areaMap;
 	Area *_currentArea;
+	bool _gotoExecuted;
 	Math::Vector3d _scale;
 
 	virtual void gotoArea(uint16 areaID, int entranceID);
diff --git a/engines/freescape/games/dark/dark.cpp b/engines/freescape/games/dark/dark.cpp
index a21ad7f5803..12a6fc92cf3 100644
--- a/engines/freescape/games/dark/dark.cpp
+++ b/engines/freescape/games/dark/dark.cpp
@@ -442,6 +442,7 @@ void DarkEngine::gotoArea(uint16 areaID, int entranceID) {
 	}
 
 	assert(_areaMap.contains(areaID));
+	bool sameArea = _currentArea ? areaID == _currentArea->getAreaID() : false;
 	_currentArea = _areaMap[areaID];
 	_currentArea->show();
 
@@ -451,9 +452,7 @@ void DarkEngine::gotoArea(uint16 areaID, int entranceID) {
 	int scale = _currentArea->getScale();
 	assert(scale > 0);
 
-	if (entranceID > 0 || areaID == 127) {
-		traverseEntrance(entranceID);
-	} else if (entranceID == 0) {
+	if (sameArea || entranceID == 0) {
 		int newPos = -1;
 		if (_position.z() < 200 || _position.z() >= 3800) {
 			if (_position.z() < 200)
@@ -470,7 +469,12 @@ void DarkEngine::gotoArea(uint16 areaID, int entranceID) {
 		}
 		assert(newPos != -1);
 		_sensors = _currentArea->getSensors();
-	}
+	} else if (entranceID > 0 || areaID == 127)
+		traverseEntrance(entranceID);
+	else if (entranceID == -1)
+		debugC(1, kFreescapeDebugMove, "Loading game, no change in position");
+	else
+		error("Invalid area change!");
 
 	_lastPosition = _position;
 	_gameStateVars[0x1f] = 0;
diff --git a/engines/freescape/games/dark/zx.cpp b/engines/freescape/games/dark/zx.cpp
index 94c36c72f32..3a98897809f 100644
--- a/engines/freescape/games/dark/zx.cpp
+++ b/engines/freescape/games/dark/zx.cpp
@@ -103,7 +103,6 @@ void DarkEngine::drawZXUI(Graphics::Surface *surface) {
 
 	int seconds, minutes, hours;
 	getTimeFromCountdown(seconds, minutes, hours);
-	// TODO: implement binary clock
 
 	Common::String message;
 	int deadline;
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index 7a005dcaaeb..aa5e4dde6fd 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -579,6 +579,7 @@ void FreescapeEngine::executeGoto(FCLInstruction &instruction) {
 	uint16 areaID = instruction._source;
 	uint16 entranceID = instruction._destination;
 	gotoArea(areaID, entranceID);
+	_gotoExecuted = true;
 }
 
 void FreescapeEngine::executeSetBit(FCLInstruction &instruction) {
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index cd58d40ba43..d088e706e21 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -326,6 +326,7 @@ void FreescapeEngine::move(CameraMovement direction, uint8 scale, float deltaTim
 	//debugC(1, kFreescapeDebugMove, "player height: %f", _position.y() - areaScale * _playerHeight);
 	if (_currentArea->getAreaID() == previousAreaID)
 		executeMovementConditions();
+	_gotoExecuted = false;
 	clearGameBit(31);
 }
 
@@ -338,9 +339,10 @@ void FreescapeEngine::resolveCollisions(Math::Vector3d const position) {
 	Math::Vector3d newPosition = position;
 	Math::Vector3d lastPosition = _lastPosition;
 
-	int previousAreaID = _currentArea->getAreaID();
+	_gotoExecuted = false;
 	bool executed = runCollisionConditions(lastPosition, newPosition);
-	if (_currentArea->getAreaID() != previousAreaID) {
+	if (_gotoExecuted) {
+		_gotoExecuted = false;
 		return;
 	}
 


Commit: 69638ccb4df1d207077065c21b8859a88e539847
    https://github.com/scummvm/scummvm/commit/69638ccb4df1d207077065c21b8859a88e539847
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-08-24T22:53:26+02:00

Commit Message:
FREESCAPE: simplified entrance code for eclipse

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


diff --git a/engines/freescape/games/eclipse.cpp b/engines/freescape/games/eclipse.cpp
index 314ea8ff9bf..3e11f6609a9 100644
--- a/engines/freescape/games/eclipse.cpp
+++ b/engines/freescape/games/eclipse.cpp
@@ -26,32 +26,6 @@
 
 namespace Freescape {
 
-static const entrancesTableEntry rawEntranceTable[] = {
-	{183, {36, 137, 13}}, // Correct?
-	{184, {36, 137, 13}}, // TODO
-	{185, {204, 68, 66}},
-	{186, {204, 88, 66}},
-	{187, {36, 137, 13}}, // TODO
-	{188, {352, 105, 204}},
-	{190, {36, 137, 13}}, // TODO
-	{191, {49, 7, 23}},   // TODO
-	{192, {36, 137, 13}}, // TODO
-	{193, {36, 137, 13}}, // TODO
-	{194, {36, 137, 13}}, // TODO
-	{195, {36, 137, 13}}, // TODO
-	{196, {36, 137, 13}}, // <-
-	{197, {203, 0, 31}},  // TODO
-	{198, {36, 137, 13}}, // TODO
-	{199, {36, 137, 13}}, // TODO
-	{200, {36, 137, 13}}, // TODO
-	{201, {36, 137, 13}}, // TODO
-	{202, {360, 25, 373}},
-	{203, {207, 25, 384}},
-	{204, {33, 48, 366}},
-	{206, {25, 8, 200}},
-	{0, {0, 0, 0}}, // NULL
-};
-
 static const char *rawMessagesTable[] = {
 	"HEART  FAILURE",
 	"SUN ECLIPSED",
@@ -83,12 +57,6 @@ EclipseEngine::EclipseEngine(OSystem *syst, const ADGameDescription *gd) : Frees
 	_playerWidth = 8;
 	_playerDepth = 8;
 
-	const entrancesTableEntry *entry = rawEntranceTable;
-	while (entry->id) {
-		_entranceTable[entry->id] = entry;
-		entry++;
-	}
-
 	const char **messagePtr = rawMessagesTable;
 	debugC(1, kFreescapeDebugParser, "String table:");
 	while (*messagePtr) {
@@ -117,8 +85,11 @@ void EclipseEngine::loadAssetsDOSFullGame() {
 
 		loadFonts(&file, 0xd403);
 		load8bitBinary(&file, 0x3ce0, 16);
-		for (auto &it : _areaMap)
+		for (auto &it : _areaMap) {
 			it._value->addStructure(_areaMap[255]);
+			for (int16 id = 183; id < 207; id++)
+				it._value->addObjectFromArea(id, _areaMap[255]);
+		}
 		_border = load8bitBinImage(&file, 0x210);
 		_border->setPalette((byte *)&kEGADefaultPaletteData, 0, 16);
 	} else if (_renderMode == Common::kRenderCGA) {
@@ -143,26 +114,11 @@ void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
 	_currentAreaMessages.clear();
 	_currentAreaMessages.push_back(_currentArea->_name);
 
-	int scale = _currentArea->getScale();
-	assert(scale > 0);
-
-	Entrance *entrance = nullptr;
 	if (entranceID == -1)
 		return;
 
 	assert(entranceID > 0);
-
-	entrance = (Entrance *)_currentArea->entranceWithID(entranceID);
-
-	if (!entrance) {
-		assert(_entranceTable.contains(entranceID));
-		const entrancesTableEntry *entry = _entranceTable[entranceID];
-		_position = scale * Math::Vector3d(entry->position[0], entry->position[1], entry->position[2]);
-		_position.setValue(1, _position.y() + scale * _playerHeight);
-		debugC(1, kFreescapeDebugMove, "entrace position: %f %f %f", _position.x(), _position.y(), _position.z());
-		debugC(1, kFreescapeDebugMove, "player height: %d", scale * _playerHeight);
-	} else
-		traverseEntrance(entranceID);
+	traverseEntrance(entranceID);
 
 	_lastPosition = _position;
 




More information about the Scummvm-git-logs mailing list