From 97781108e8b30e9305ffd9e6d023262005f4921e Mon Sep 17 00:00:00 2001 From: Ian Curtis Date: Wed, 21 Jun 2017 17:04:53 +0000 Subject: [PATCH] A second go at fixing the fixed lighting in star wars .. Fixed shading is per vertex poly colours. For some reason in star wars they are treated as unsigned values instead of signed, like in every other game. These polys are all marked with specular enabled, where as in the rest of the games they are missing this flag. That's the only difference I can find. --- Src/Graphics/New3D/New3D.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Src/Graphics/New3D/New3D.cpp b/Src/Graphics/New3D/New3D.cpp index 7fd756a..5c8ed66 100644 --- a/Src/Graphics/New3D/New3D.cpp +++ b/Src/Graphics/New3D/New3D.cpp @@ -1184,7 +1184,12 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data) } } else { - shade = (((ix + 128) & 0xFF) / 255.f); // Step 2+ uses signed or unsigned values for lighting 0-255. Todo finish this logic + if (ph.SpecularEnabled()) { + shade = (ix & 0xFF) / 255.f; // Star wars is the only game to use unsigned fixed shaded values. It's also the only game to set the specular flag on these polys + } + else { + shade = (((ix + 128) & 0xFF) / 255.f); // Step 2+ uses signed or unsigned values for lighting 0-255. Todo finish this logic + } } shade += offset;