From 703343c05b249739b5827f79f70cfad2d3c71f34 Mon Sep 17 00:00:00 2001
From: MaxED <j.maxed@gmail.com>
Date: Tue, 29 Dec 2015 12:45:31 +0000
Subject: [PATCH] Fixed, Things mode: light radius for SectorPointLight was
 calculated incorrectly.

---
 Source/Core/Geometry/Tools.cs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Source/Core/Geometry/Tools.cs b/Source/Core/Geometry/Tools.cs
index 14937a277..fc133d3e8 100644
--- a/Source/Core/Geometry/Tools.cs
+++ b/Source/Core/Geometry/Tools.cs
@@ -2140,14 +2140,15 @@ namespace CodeImp.DoomBuilder.Geometry
 				if(lightid < GZBuilder.GZGeneral.GZ_LIGHT_TYPES[2]) //if it's gzdoom light
 				{
 					int n;
-					if(t.Type < GZBuilder.GZGeneral.GZ_LIGHT_TYPES[0]) n = 0;
-					else if(t.Type < GZBuilder.GZGeneral.GZ_LIGHT_TYPES[1]) n = 10;
+					if(lightid < GZBuilder.GZGeneral.GZ_LIGHT_TYPES[0]) n = 0;
+					else if(lightid < GZBuilder.GZGeneral.GZ_LIGHT_TYPES[1]) n = 10;
 					else n = 20;
 					DynamicLightType lightType = (DynamicLightType)(t.Type - 9800 - n);
 
 					if(lightType == DynamicLightType.SECTOR)
 					{
-						int scaler = (t.Sector != null ? t.Sector.Brightness / 4 : 1);
+						if(t.Sector == null) t.DetermineSector();
+						int scaler = (t.Sector != null ? t.Sector.Brightness / 4 : 2);
 						primaryradius = (int)Math.Round((t.Args[3] * scaler) * General.Settings.GZDynamicLightRadius);
 					}
 					else
-- 
GitLab