From 6aa55dcd13084a3a3b728cd56dc00dfa42cd4107 Mon Sep 17 00:00:00 2001 From: XProger Date: Wed, 9 May 2018 03:43:47 +0300 Subject: [PATCH] #15 fix shadows for TR3 PSX levels --- src/format.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/format.h b/src/format.h index ae78f67..f9af4d9 100644 --- a/src/format.h +++ b/src/format.h @@ -3434,8 +3434,10 @@ namespace TR { if (version & VER_TR2) stream.read(r.lightMode); - } else + } else { + r.ambient = 0x1FFF - r.ambient; stream.read(r.ambient2); + } // lights r.lights = stream.read(r.lightsCount) ? new Room::Light[r.lightsCount] : NULL; @@ -3464,11 +3466,14 @@ namespace TR { stream.seek(4); // radius2 if ((version & VER_VERSION) < VER_TR3) { - int value = 2555 - clamp((intensity > 0x1FFF) ? 0 : (intensity >> 5), 0, 255); + int value = 255 - clamp((intensity > 0x1FFF) ? 0 : (intensity >> 5), 0, 255); light.color.r = light.color.g = light.color.b = value; light.color.a = 0; } + if (version == VER_TR3_PSX) + light.radius >>= 2; + light.radius *= 2; } // meshes