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

neuromancer noreply at scummvm.org
Sat Jul 1 19:24:05 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:
2117c5a0f3 FREESCAPE: invert colors when rendering player shots in driller
b1dcace573 FREESCAPE: added offsetOrigin function to avoid breaking setOrigin


Commit: 2117c5a0f3795c4d60c6ad862e0a2aa41dbdbdb4
    https://github.com/scummvm/scummvm/commit/2117c5a0f3795c4d60c6ad862e0a2aa41dbdbdb4
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-07-01T21:20:52+02:00

Commit Message:
FREESCAPE: invert colors when rendering player shots in driller

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


diff --git a/engines/freescape/gfx_opengl.cpp b/engines/freescape/gfx_opengl.cpp
index f00435c79fb..ff692cee8a4 100644
--- a/engines/freescape/gfx_opengl.cpp
+++ b/engines/freescape/gfx_opengl.cpp
@@ -192,7 +192,7 @@ void OpenGLRenderer::renderSensorShoot(byte color, const Math::Vector3d sensor,
 }
 
 void OpenGLRenderer::renderPlayerShoot(byte color, const Common::Point position, const Common::Rect viewArea) {
-	uint8 a, r, g, b;
+	uint8 r, g, b;
 
 	glMatrixMode(GL_PROJECTION);
 	glLoadIdentity();
@@ -202,11 +202,8 @@ void OpenGLRenderer::renderPlayerShoot(byte color, const Common::Point position,
 	if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderZX) {
 		r = g = b = 255;
 	} else {
-		uint32 pixel = 0x0;
-		glReadPixels(g_system->getWidth() / 2, g_system->getHeight() / 2, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel);
-		_texturePixelFormat.colorToARGB(pixel, a, r, g, b);
-		color = indexFromColor(r, g, b);
-		readFromPalette((color + 3) % (_renderMode == Common::kRenderCGA ? 4 : 16), r, g, b);
+		glEnable(GL_COLOR_LOGIC_OP);
+		glLogicOp(GL_INVERT);
 	}
 
 	glDisable(GL_DEPTH_TEST);
@@ -232,6 +229,7 @@ void OpenGLRenderer::renderPlayerShoot(byte color, const Common::Point position,
 	glDisableClientState(GL_VERTEX_ARRAY);
 	glLineWidth(1);
 
+	glDisable(GL_COLOR_LOGIC_OP);
 	glEnable(GL_DEPTH_TEST);
 	glDepthMask(GL_TRUE);
 }
diff --git a/engines/freescape/gfx_opengl_shaders.cpp b/engines/freescape/gfx_opengl_shaders.cpp
index 1055d4d2a96..56c203b7955 100644
--- a/engines/freescape/gfx_opengl_shaders.cpp
+++ b/engines/freescape/gfx_opengl_shaders.cpp
@@ -183,7 +183,7 @@ float remap(float f, float s) {
 }
 
 void OpenGLShaderRenderer::renderPlayerShoot(byte color, const Common::Point position, const Common::Rect viewArea) {
-	uint8 a, r, g, b;
+	uint8 r, g, b;
 
 	Math::Matrix4 identity;
 	identity(0, 0) = 1.0;
@@ -198,11 +198,8 @@ void OpenGLShaderRenderer::renderPlayerShoot(byte color, const Common::Point pos
 	if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderZX) {
 		r = g = b = 255;
 	} else {
-		uint32 pixel = 0x0;
-		glReadPixels(g_system->getWidth() / 2, g_system->getHeight() / 2, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel);
-		_texturePixelFormat.colorToARGB(pixel, a, r, g, b);
-		color = indexFromColor(r, g, b);
-		readFromPalette((color + 3) % (_renderMode == Common::kRenderCGA ? 4 : 16), r, g, b);
+		glEnable(GL_COLOR_LOGIC_OP);
+		glLogicOp(GL_INVERT);
 	}
 
 	glDisable(GL_DEPTH_TEST);
@@ -231,6 +228,7 @@ void OpenGLShaderRenderer::renderPlayerShoot(byte color, const Common::Point pos
 
 	glLineWidth(1);
 
+	glDisable(GL_COLOR_LOGIC_OP);
 	glEnable(GL_DEPTH_TEST);
 	glDepthMask(GL_TRUE);
 }


Commit: b1dcace573b84a92c63742b499af6b9380caf9b1
    https://github.com/scummvm/scummvm/commit/b1dcace573b84a92c63742b499af6b9380caf9b1
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-07-01T21:20:52+02:00

Commit Message:
FREESCAPE: added offsetOrigin function to avoid breaking setOrigin

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


diff --git a/engines/freescape/objects/geometricobject.cpp b/engines/freescape/objects/geometricobject.cpp
index b754c528df3..b3f444b0746 100644
--- a/engines/freescape/objects/geometricobject.cpp
+++ b/engines/freescape/objects/geometricobject.cpp
@@ -171,6 +171,11 @@ GeometricObject::GeometricObject(
 }
 
 void GeometricObject::setOrigin(Math::Vector3d origin_) {
+	_origin = origin_;
+	computeBoundingBox();
+}
+
+void GeometricObject::offsetOrigin(Math::Vector3d origin_) {
 	if (isPolygon(_type)) {
 		Math::Vector3d offset = origin_ - _origin;
 		offset = 32 * offset;
@@ -180,9 +185,7 @@ void GeometricObject::setOrigin(Math::Vector3d origin_) {
 			(*_ordinates)[i + 2] += uint16(offset.z());
 		}
 	}
-
-	_origin = origin_;
-	computeBoundingBox();
+	setOrigin(origin_);
 }
 
 void GeometricObject::scale(int factor) {
diff --git a/engines/freescape/objects/geometricobject.h b/engines/freescape/objects/geometricobject.h
index a7a0ed90f17..2c320241b88 100644
--- a/engines/freescape/objects/geometricobject.h
+++ b/engines/freescape/objects/geometricobject.h
@@ -49,6 +49,7 @@ public:
 		Common::String conditionSource = "");
 	virtual ~GeometricObject();
 	void setOrigin(Math::Vector3d origin) override;
+	void offsetOrigin(Math::Vector3d origin_);
 
 	Object *duplicate() override;
 	void scale(int factor) override;
diff --git a/engines/freescape/objects/group.cpp b/engines/freescape/objects/group.cpp
index a097259e301..7804a062bfa 100644
--- a/engines/freescape/objects/group.cpp
+++ b/engines/freescape/objects/group.cpp
@@ -30,12 +30,12 @@ Group::Group(uint16 objectID_, uint16 flags_, const Common::Array<byte> data_) {
 	_scale = 0;
 
 	int i;
-	for (i = 0; i < 9; i++) {
+	for (i = 0; i < 5; i++) {
 		debugC(1, kFreescapeDebugParser, "group data[%d] = %d", i, data_[i]);
 		if (data_[i] > 0)
 			_objectIds.push_back(data_[i]);
 	}
-	i = 9;
+	i = 5;
 	while (i < int(data_.size() - 4)) {
 		debugC(1, kFreescapeDebugParser, "group data[%d] = %d (index)	", i, data_[i]);
 		_objectIndices.push_back(data_[i]);
@@ -68,20 +68,21 @@ void Group::linkObject(Object *obj) {
 	if (objectIndex == -1)
 		return;
 
+	_origins.push_back(obj->getOrigin());
 	obj->makeInitiallyVisible();
 	obj->makeVisible();
 	_objects.push_back(obj);
 }
 
 void Group::assemble(int frame, int index) {
-	Object *obj = _objects[index];
+	GeometricObject *gobj = (GeometricObject *)_objects[index];
 	Math::Vector3d position = _objectPositions[frame];
 
-	if (!GeometricObject::isPolygon(obj->getType()))
+	if (!GeometricObject::isPolygon(gobj->getType()))
 		position = 32 * position / _scale;
 	else
 		position = position / _scale;
 
-	obj->setOrigin(position);
+	gobj->offsetOrigin(position);
 }
 } // End of namespace Freescape
\ No newline at end of file
diff --git a/engines/freescape/objects/group.h b/engines/freescape/objects/group.h
index 09aad72adbd..04587dbc386 100644
--- a/engines/freescape/objects/group.h
+++ b/engines/freescape/objects/group.h
@@ -33,6 +33,7 @@ public:
 	void assemble(int frame, int index);
 
 	Common::Array<Object *> _objects;
+	Common::Array<Math::Vector3d> _origins;
 	Common::Array<Math::Vector3d> _objectPositions;
 	Common::Array<int16> _objectIndices;
 	Common::Array<int16> _objectIds;




More information about the Scummvm-git-logs mailing list