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

aquadran noreply at scummvm.org
Sun Oct 13 10:03:30 UTC 2024


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

Summary:
ca85e3d8e9 WINTERMUTE: Restore getProjectionParams from original code


Commit: ca85e3d8e901a91b2af9fc22c8dc8084ca2b6680
    https://github.com/scummvm/scummvm/commit/ca85e3d8e901a91b2af9fc22c8dc8084ca2b6680
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2024-10-13T12:03:24+02:00

Commit Message:
WINTERMUTE: Restore getProjectionParams from original code

Changed paths:
    engines/wintermute/base/gfx/base_renderer3d.cpp
    engines/wintermute/base/gfx/base_renderer3d.h


diff --git a/engines/wintermute/base/gfx/base_renderer3d.cpp b/engines/wintermute/base/gfx/base_renderer3d.cpp
index f0d0e96a3b6..4e6379a158a 100644
--- a/engines/wintermute/base/gfx/base_renderer3d.cpp
+++ b/engines/wintermute/base/gfx/base_renderer3d.cpp
@@ -57,6 +57,35 @@ bool BaseRenderer3D::drawSprite(BaseSurfaceOpenGL3D &tex, const Wintermute::Rect
 	return drawSpriteEx(tex, rect, pos, Vector2(0.0f, 0.0f), scale, 0.0f, color, alphaDisable, blendMode, mirrorX, mirrorY);
 }
 
+bool BaseRenderer3D::getProjectionParams(float *resWidth, float *resHeight, float *layerWidth, float *layerHeight,
+										 float *modWidth, float *modHeight, bool *customViewport) {
+	*resWidth = _width;
+	*resHeight = _height;
+
+	int lWidth, lHeight;
+	Rect32 sceneViewport;
+	_gameRef->getLayerSize(&lWidth, &lHeight, &sceneViewport, customViewport);
+	*layerWidth = (float)lWidth;
+	*layerHeight = (float)lHeight;
+
+	*modWidth = 0.0f;
+	*modHeight = 0.0f;
+	if (*layerWidth > *resWidth)
+		*modWidth  = (*layerWidth - *resWidth) / 2.0f;
+	if (*layerHeight > *resHeight)
+		*modHeight = (*layerHeight - *resHeight) / 2.0f;
+
+	// new in 1.7.2.1
+	// if layer height is smaller than resolution, we assume that we don't want to scroll
+	// and that the camera overviews the entire resolution
+	if (*layerHeight < *resHeight) {
+		*modHeight -= (*resHeight - *layerHeight) / 2;
+		*layerHeight = *resHeight;
+	}
+
+	return true;
+}
+
 void BaseRenderer3D::project(const Math::Matrix4 &worldMatrix, const Math::Vector3d &point, int32 &x, int32 &y) {
 	Math::Matrix4 tmp = worldMatrix;
 	tmp.transpose();
diff --git a/engines/wintermute/base/gfx/base_renderer3d.h b/engines/wintermute/base/gfx/base_renderer3d.h
index ef57f984eba..baee2675179 100644
--- a/engines/wintermute/base/gfx/base_renderer3d.h
+++ b/engines/wintermute/base/gfx/base_renderer3d.h
@@ -59,6 +59,8 @@ public:
 	BaseRenderer3D(BaseGame *inGame = nullptr);
 	~BaseRenderer3D() override;
 
+	bool getProjectionParams(float *resWidth, float *resHeight, float *layerWidth, float *layerHeight,
+							 float *modWidth, float *modHeight, bool *customViewport);
 	bool setAmbientLightColor(uint32 color);
 	bool setDefaultAmbientLightColor();
 	virtual void setAmbientLight() = 0;




More information about the Scummvm-git-logs mailing list