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

neuromancer noreply at scummvm.org
Sat Mar 30 11:38:37 UTC 2024


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

Summary:
5655096bd7 FREESCAPE: better implementation of outside areas
b9e39e80e1 FREESCAPE: adjust view area in eclipse for zx
a9026919d4 FREESCAPE: perspective correction in drawEclipse


Commit: 5655096bd753152738b3797bc9e2dc694193a629
    https://github.com/scummvm/scummvm/commit/5655096bd753152738b3797bc9e2dc694193a629
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-03-30T11:34:49+01:00

Commit Message:
FREESCAPE: better implementation of outside areas

Changed paths:
    engines/freescape/area.cpp
    engines/freescape/area.h
    engines/freescape/freescape.cpp
    engines/freescape/movement.cpp


diff --git a/engines/freescape/area.cpp b/engines/freescape/area.cpp
index 6f6dc0940c8..4050481c6c6 100644
--- a/engines/freescape/area.cpp
+++ b/engines/freescape/area.cpp
@@ -394,12 +394,13 @@ void Area::addFloor() {
 	for (int i = 0; i < 6; i++)
 		gColors->push_back(_groundColor);
 
+	int maxSize = 10000000 / 4;
 	Object *obj = (Object *)new GeometricObject(
 		ObjectType::kCubeType,
 		id,
-		0,                             // flags
-		Math::Vector3d(-4128, -1, -4128),      // Position
-		Math::Vector3d(4128 * 4, 1, 4128 * 4), // size
+		0,                                           // flags
+		Math::Vector3d(-maxSize, -3, -maxSize),      // Position
+		Math::Vector3d(maxSize * 4, 1, maxSize * 4), // size
 		gColors,
 		nullptr,
 		FCLInstructionVector());
@@ -435,4 +436,9 @@ void Area::changeObjectID(uint16 objectID, uint16 newObjectID) {
 	(*_objectsByID)[newObjectID] = obj;
 }
 
+
+bool Area::isOutside() {
+	return _skyColor < 255 && _groundColor < 255;
+}
+
 } // End of namespace Freescape
diff --git a/engines/freescape/area.h b/engines/freescape/area.h
index 3cb1bcce151..68515c21ccf 100644
--- a/engines/freescape/area.h
+++ b/engines/freescape/area.h
@@ -66,6 +66,7 @@ public:
 	void addStructure(Area *global);
 	void removeObject(int16 id);
 	void resetArea();
+	bool isOutside();
 
 	Common::Array<Common::String> _conditionSources;
 	Common::Array<FCLInstructionVector> _conditions;
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 813b2c7edb4..28b93fb3068 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -322,7 +322,11 @@ void FreescapeEngine::drawBackground() {
 }
 
 void FreescapeEngine::drawFrame() {
-	_gfx->updateProjectionMatrix(90.0, _nearClipPlane, _farClipPlane);
+	int farClipPlane = _farClipPlane;
+	if (_currentArea->isOutside())
+		farClipPlane *= 100;
+
+	_gfx->updateProjectionMatrix(90.0, _nearClipPlane, farClipPlane);
 	_gfx->positionCamera(_position, _position + _cameraFront);
 
 	if (_underFireFrames > 0) {
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index cc0e6a00b50..641accc7812 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -297,11 +297,19 @@ void FreescapeEngine::lower() {
 }
 
 void FreescapeEngine::checkIfStillInArea() {
+	int maxPositiveDistance = 8192;
+	int maxNegativeDistance	= 0;
+
+	if (_currentArea->isOutside()) {
+		maxPositiveDistance = 16384;
+		maxNegativeDistance = -16384;
+	}
+
 	for (int i = 0; i < 3; i++) {
-		if (_position.getValue(i) < 0)
-			_position.setValue(i, 0);
-		else if (_position.getValue(i) > 8128)
-			_position.setValue(i, 8128);
+		if (_position.getValue(i) < maxNegativeDistance)
+			_position.setValue(i, maxNegativeDistance);
+		else if (_position.getValue(i) > maxPositiveDistance)
+			_position.setValue(i, maxPositiveDistance);
 	}
 	if (_position.y() >= 2016)
 		_position.y() = _lastPosition.z();


Commit: b9e39e80e16737ebea6291075e16f4db5e4eb60f
    https://github.com/scummvm/scummvm/commit/b9e39e80e16737ebea6291075e16f4db5e4eb60f
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-03-30T11:55:02+01:00

Commit Message:
FREESCAPE: adjust view area in eclipse for zx

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


diff --git a/engines/freescape/games/eclipse/zx.cpp b/engines/freescape/games/eclipse/zx.cpp
index 483d9950094..5849cb3be4b 100644
--- a/engines/freescape/games/eclipse/zx.cpp
+++ b/engines/freescape/games/eclipse/zx.cpp
@@ -28,7 +28,7 @@
 namespace Freescape {
 
 void EclipseEngine::initZX() {
-	_viewArea = Common::Rect(56, 28, 265, 132+6);
+	_viewArea = Common::Rect(56, 36, 265, 139);
 	_maxEnergy = 63;
 	_maxShield = 63;
 }
diff --git a/engines/freescape/ui.cpp b/engines/freescape/ui.cpp
index 1412e2e18ed..150a8db7d73 100644
--- a/engines/freescape/ui.cpp
+++ b/engines/freescape/ui.cpp
@@ -168,7 +168,7 @@ void FreescapeEngine::drawFullscreenMessage(Common::String message, uint32 front
 		numberOfLines = 10;
 	} else if (isSpectrum() || isCPC()) {
 		x = 60;
-		y = 35;
+		y = 40;
 		letterPerLine = 24;
 		numberOfLines = 12;
 	}


Commit: a9026919d4fba1ce7a9a08fc465d7334f0b957f5
    https://github.com/scummvm/scummvm/commit/a9026919d4fba1ce7a9a08fc465d7334f0b957f5
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-03-30T12:37:33+01:00

Commit Message:
FREESCAPE: perspective correction in drawEclipse

Changed paths:
    engines/freescape/gfx.cpp
    engines/freescape/gfx_opengl.cpp
    engines/freescape/gfx_opengl_shaders.cpp


diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index 379ce4eecfa..311a37bda05 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -1002,9 +1002,9 @@ void Renderer::drawBackground(uint8 color) {
 
 void Renderer::drawEclipse(byte color1, byte color2, float progress) {
 	Math::Vector3d sunPosition(-5000, 1200, 0);
-	float radius = 500.0;
+	float radius = 400.0;
 	drawCelestialBody(sunPosition, radius, color1);
-	Math::Vector3d moonPosition(-5000, 1200, 0 + 500 * progress);
+	Math::Vector3d moonPosition(-5000, 1200, 800 * progress);
 	drawCelestialBody(moonPosition, radius, color2);
 }
 
diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index 6fbce92c63d..fb0b71d0db8 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -314,11 +314,12 @@ void OpenGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, by
 
 	glEnableClientState(GL_VERTEX_ARRAY);
 	copyToVertexArray(0, position);
+	float adj = 1.25; // Perspective correction
 
 	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)))
+						position.z() + (adj * radius * sin(i * twicePi / triangleAmount)))
 		);
 	}
 
@@ -336,7 +337,7 @@ void OpenGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, by
 		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)))
+							position.z() + (adj * radius * sin(i * twicePi / triangleAmount)))
 			);
 		}
 
diff --git a/engines/freescape/gfx_opengl_shaders.cpp b/engines/freescape/gfx_opengl_shaders.cpp
index b4341b08a84..efcb92a79fd 100644
--- a/engines/freescape/gfx_opengl_shaders.cpp
+++ b/engines/freescape/gfx_opengl_shaders.cpp
@@ -304,6 +304,7 @@ void OpenGLShaderRenderer::drawCelestialBody(Math::Vector3d position, float radi
 
 	int triangleAmount = 20;
 	float twicePi = (float)(2.0 * M_PI);
+	float adj = 1.25; // Perspective correction
 
 	// Quick billboard effect inspired from this code:
 	// http://www.lighthouse3d.com/opengl/billboarding/index.php?billCheat
@@ -332,7 +333,7 @@ void OpenGLShaderRenderer::drawCelestialBody(Math::Vector3d position, float radi
 	for(int i = 0; i <= triangleAmount; i++) {
 		float x = position.x();
 		float y = position.y() + (radius * cos(i *  twicePi / triangleAmount));
-		float z = position.z() + (radius * sin(i * twicePi / triangleAmount));
+		float z = position.z() + (adj * radius * sin(i * twicePi / triangleAmount));
 		copyToVertexArray(i + 1, Math::Vector3d(x, y, z));
 	}
 




More information about the Scummvm-git-logs mailing list