[Scummvm-git-logs] scummvm master -> 27a7c8c8bbb2deaf665d9cdd5d2cabd9b2699174

somaen noreply at scummvm.org
Fri Dec 4 00:03:59 UTC 2026


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

Summary:
27a7c8c8bb WATCHMAKER: Fix mistake in handling of addNumFacesAdditionalMaterial


Commit: 27a7c8c8bbb2deaf665d9cdd5d2cabd9b2699174
    https://github.com/scummvm/scummvm/commit/27a7c8c8bbb2deaf665d9cdd5d2cabd9b2699174
Author: Einar Johan Trøan Sømåen (somaen at scummvm.org)
Date: 2026-12-04T00:50:21+01:00

Commit Message:
WATCHMAKER: Fix mistake in handling of addNumFacesAdditionalMaterial

The change to using Common::Array led to a mistake where we passed
the number of actual elements and not the capacity, addNumFacesAdditionalMaterial
then checked this against 0, which then led to the face being dropped
from rendering, as it fails the lookup for the Sub-Material.

Assisted-by: Claude:claude-opus-5-5

Changed paths:
    engines/watchmaker/3d/material.cpp
    engines/watchmaker/3d/material.h
    engines/watchmaker/3d/t3d_body.cpp


diff --git a/engines/watchmaker/3d/material.cpp b/engines/watchmaker/3d/material.cpp
index df41fabc01f..88a90aa4574 100644
--- a/engines/watchmaker/3d/material.cpp
+++ b/engines/watchmaker/3d/material.cpp
@@ -93,8 +93,8 @@ void gMaterial::addColor(unsigned char r_add, unsigned char g_add, unsigned char
 	this->b = (unsigned char)bb;
 }
 
-bool gMaterial::addNumFacesAdditionalMaterial(MaterialPtr am, unsigned int num) {
-	if (!num || !am)
+bool gMaterial::addAdditionalMaterial(MaterialPtr am) {
+	if (!am)
 		return false;
 
 	Common::SharedPtr<gMaterial> cm;
@@ -125,8 +125,7 @@ MaterialPtr rMergeMaterial(MaterialPtr Mat1, MaterialPtr Mat2) {
 		return nullptr;
 
 	for (int i = 0; i < Mat2->NumAddictionalMaterial; i++) {
-		Mat1->addNumFacesAdditionalMaterial(Mat2->AddictionalMaterial[i],
-		                                    /*Mat2->AddictionalMaterial[i]->NumAllocatedFaces*/ Mat2->AddictionalMaterial[i]->NumFaces());
+		Mat1->addAdditionalMaterial(Mat2->AddictionalMaterial[i]);
 	}
 	//reset mat2
 	rRemoveMaterial(Mat2);
diff --git a/engines/watchmaker/3d/material.h b/engines/watchmaker/3d/material.h
index dc27dab0035..9f707875bf9 100644
--- a/engines/watchmaker/3d/material.h
+++ b/engines/watchmaker/3d/material.h
@@ -81,7 +81,7 @@ public:
 	bool hasFlag(int flag);
 	void clearFlag(int flag);
 	bool addNumFaces(unsigned int num);
-	bool addNumFacesAdditionalMaterial(MaterialPtr am, unsigned int num);
+	bool addAdditionalMaterial(MaterialPtr am);
 	void clear();
 };
 
diff --git a/engines/watchmaker/3d/t3d_body.cpp b/engines/watchmaker/3d/t3d_body.cpp
index 8efe5ae5a33..d6b60da9b27 100644
--- a/engines/watchmaker/3d/t3d_body.cpp
+++ b/engines/watchmaker/3d/t3d_body.cpp
@@ -389,7 +389,7 @@ void LoadLightmaps(WGame &game, t3dBODY *b) {
 							gv[f.VertexIndex[1]].diffuse = RGBA_MAKE(254, 254, 254, alphaval2);
 							gv[f.VertexIndex[2]].diffuse = RGBA_MAKE(254, 254, 254, alphaval3);
 							f.lightmap = b->LightmapTable[Map];
-							f.getMaterial()->addNumFacesAdditionalMaterial(f.lightmap, 1);
+							f.getMaterial()->addAdditionalMaterial(f.lightmap);
 						} else if (((f.hasMaterialFlag(T3D_MATERIAL_OPACITY))) ||
 						           ((f.hasMaterialFlag(T3D_MATERIAL_CLIPMAP))) ||
 						           ((f.hasMaterialFlag(T3D_MATERIAL_BOTTLE))) ||




More information about the Scummvm-git-logs mailing list