shithub: qk1

Download patch

ref: aa84da621a8b302933639033ffbb5a131536264c
parent: 1239323a2cfeb1b44db192c51155d70cd8aaf03b
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Wed Oct 11 15:21:19 EDT 2023

surf: import the moving brush dynamic light fix

--- a/r_surf.c
+++ b/r_surf.c
@@ -46,7 +46,7 @@
 	int			lnum;
 	int			sd, td;
 	float		dist, rad, minlight;
-	vec3_t		impact, local;
+	vec3_t		impact, local, entorigin;
 	int			s, t;
 	int			i;
 	int			smax, tmax;
@@ -63,7 +63,8 @@
 			continue;		// not lit by this light
 
 		rad = cl_dlights[lnum].radius;
-		dist = DotProduct (cl_dlights[lnum].origin, surf->plane->normal) -
+		VectorSubtract(cl_dlights[lnum].origin, currententity->origin, entorigin);
+		dist = DotProduct (entorigin, surf->plane->normal) -
 				surf->plane->dist;
 		rad -= fabs(dist);
 		minlight = cl_dlights[lnum].minlight;
@@ -73,7 +74,7 @@
 
 		for (i=0 ; i<3 ; i++)
 		{
-			impact[i] = cl_dlights[lnum].origin[i] -
+			impact[i] = entorigin[i] -
 					surf->plane->normal[i]*dist;
 		}