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

neuromancer noreply at scummvm.org
Sun Jan 14 18:48:25 UTC 2024


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:
2ef173acfb FREESCAPE: celestial bodies are fixed in the sky in eclipse
b1acc6449a FREESCAPE: initial implementation of water jar in eclipse


Commit: 2ef173acfb1f6146bb7fa69bbe3ac02653f6e1b2
    https://github.com/scummvm/scummvm/commit/2ef173acfb1f6146bb7fa69bbe3ac02653f6e1b2
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-01-14T19:48:39+01:00

Commit Message:
FREESCAPE: celestial bodies are fixed in the sky in eclipse

Changed paths:
    engines/freescape/gfx_opengl.cpp


diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index cdea6a65f6d..6a1caa0237b 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -287,66 +287,33 @@ void OpenGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, by
 	int triangleAmount = 20;
 	float twicePi = (float)(2.0 * M_PI);
 
-	glDisable(GL_DEPTH_TEST);
-	glDepthMask(GL_FALSE);
-
-	glEnableClientState(GL_VERTEX_ARRAY);
-	copyToVertexArray(0, position);
-
-	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)))
-		);
-	}
-
-	glVertexPointer(3, GL_FLOAT, 0, _verts);
-	glDrawArrays(GL_TRIANGLE_FAN, 0, triangleAmount + 2);
-	glDisableClientState(GL_VERTEX_ARRAY);
-
-	glEnable(GL_DEPTH_TEST);
-	glDepthMask(GL_TRUE);
-
-	/*uint8 r, g, b;
-
+	// Quick billboard effect inspired from this code:
+	// http://www.lighthouse3d.com/opengl/billboarding/index.php?billCheat
+	glMatrixMode(GL_MODELVIEW);
+	glPushMatrix();
 	GLfloat m[16];
-	GLfloat p[16];
-
 	glGetFloatv(GL_MODELVIEW_MATRIX, m);
-	glGetFloatv(GL_PROJECTION_MATRIX, p);
-
-	glMatrixMode(GL_MODELVIEW);
-	glLoadIdentity();
-
-	glMatrixMode(GL_PROJECTION);
-
-	Math::Matrix4 lookMatrix = Math::makeLookAtMatrix(pos, interest, up_vec);
-	glMultMatrixf(lookMatrix.getData());
-	//glLoadIdentity();
-	//glOrtho(0, _screenW, _screenH, 0, 0, 1);
-
-
-	r = 0xff;
-	g = 0xff;
-	b = 0x55;
+	for(int i = 1; i < 4; i++)
+		for(int j = 0; j < 4; j++ ) {
+			if (i == 2)
+				continue;
+			if (i == j)
+				m[i*4 + j] = 1.0;
+			else
+				m[i*4 + j] = 0.0;
+		}
 
+	glLoadMatrixf(m);
 	glDisable(GL_DEPTH_TEST);
 	glDepthMask(GL_FALSE);
 
-	glColor3ub(r, g, b);
-	int triangleAmount = 20;
-	float twicePi = (float)(2.0 * M_PI);
-	float radius = 10.0;
-
-	Common::Point ball_position(320 / 2, 200 / 2);
-
 	glEnableClientState(GL_VERTEX_ARRAY);
-	copyToVertexArray(0, Math::Vector3d(ball_position.x, ball_position.y, 0));
+	copyToVertexArray(0, position);
 
 	for(int i = 0; i <= triangleAmount; i++) {
 		copyToVertexArray(i + 1,
-			Math::Vector3d(ball_position.x + (radius * cos(i *  twicePi / triangleAmount)),
-						ball_position.y + (radius * sin(i * twicePi / triangleAmount)), 0)
+			Math::Vector3d(position.x(), position.y() + (radius * cos(i *  twicePi / triangleAmount)),
+						position.z() + (radius * sin(i * twicePi / triangleAmount)))
 		);
 	}
 
@@ -356,20 +323,15 @@ void OpenGLRenderer::drawCelestialBody(Math::Vector3d position, float radius, by
 
 	glEnable(GL_DEPTH_TEST);
 	glDepthMask(GL_TRUE);
-
-	glMatrixMode(GL_MODELVIEW);
-	glLoadMatrixf(m);
-
-	glMatrixMode(GL_PROJECTION);
-	glLoadMatrixf(p);*/
+	glPopMatrix();
 }
 
 void OpenGLRenderer::drawEclipse(byte color1, byte color2) {
 	Math::Vector3d sunPosition(-5000, 2000, 500);
-	float radius = 750.0;
+	float radius = 500.0;
 	drawCelestialBody(sunPosition, radius, color1);
 
-	Math::Vector3d moonPosition(-5000, 2000, 1500);
+	Math::Vector3d moonPosition(-5000, 2000, 1000);
 	drawCelestialBody(moonPosition, radius, color2);
 }
 


Commit: b1acc6449a6ae8934fbf0857272c49f8a052bae3
    https://github.com/scummvm/scummvm/commit/b1acc6449a6ae8934fbf0857272c49f8a052bae3
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-01-14T19:48:39+01:00

Commit Message:
FREESCAPE: initial implementation of water jar in 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 0c37e9892fb..3025b9e21b1 100644
--- a/engines/freescape/games/eclipse/dos.cpp
+++ b/engines/freescape/games/eclipse/dos.cpp
@@ -72,6 +72,7 @@ void EclipseEngine::drawDOSUI(Graphics::Surface *surface) {
 	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);
 
 	Common::String message;
 	int deadline;
@@ -95,6 +96,13 @@ void EclipseEngine::drawDOSUI(Graphics::Surface *surface) {
 		drawStringInSurface("<", 240, 135, black, yellow, surface, 'Z' - '$' + 1);
 	}
 	drawAnalogClock(surface, 90, 172, black, red, white);
+
+	Common::Rect jarBackground(124, 165, 148, 192);
+	surface->fillRect(jarBackground, black);
+
+	Common::Rect jarWater(124, 192 - _gameStateVars[k8bitVariableEnergy], 148, 192);
+	surface->fillRect(jarWater, blue);
+
 }
 
 } // 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 848663f49ca..a6c9390d952 100644
--- a/engines/freescape/games/eclipse/eclipse.cpp
+++ b/engines/freescape/games/eclipse/eclipse.cpp
@@ -86,6 +86,12 @@ EclipseEngine::EclipseEngine(OSystem *syst, const ADGameDescription *gd) : Frees
 	_angleRotations.push_back(5);
 	_angleRotations.push_back(10);
 	_angleRotations.push_back(15);
+
+	_maxEnergy = 27;
+	_maxShield = 10; // TODO
+
+	_initialEnergy = 16;
+	_initialShield = 10; // TODO
 }
 
 void EclipseEngine::initGameState() {
@@ -113,6 +119,9 @@ void EclipseEngine::initGameState() {
 	_lastMinute = 0;
 	_demoIndex = 0;
 	_demoEvents.clear();
+
+	_gameStateVars[k8bitVariableEnergy] = _initialEnergy;
+	_gameStateVars[k8bitVariableShield] = _initialShield;
 }
 
 void EclipseEngine::gotoArea(uint16 areaID, int entranceID) {
diff --git a/engines/freescape/games/eclipse/eclipse.h b/engines/freescape/games/eclipse/eclipse.h
index 2a935274c5e..c1d0bef1f4b 100644
--- a/engines/freescape/games/eclipse/eclipse.h
+++ b/engines/freescape/games/eclipse/eclipse.h
@@ -36,6 +36,9 @@ public:
 
 	void loadAssetsDOSFullGame() override;
 
+	uint32 _initialEnergy;
+	uint32 _initialShield;
+
 	void initDOS();
 	void initCPC();
 	void initZX();




More information about the Scummvm-git-logs mailing list