+ if( light->flags & LIGHT_ATTEN_ANGLE )
+ {
+ /* standard Lambert attenuation */
+ float dot = DotProduct( trace->normal, trace->direction );
+
+ /* twosided lighting */
+ if( trace->twoSided )
+ dot = fabs( dot );
+
+ /* jal: optional half Lambert attenuation (http://developer.valvesoftware.com/wiki/Half_Lambert) */
+ if( lightAngleHL )
+ {
+ if( dot > 0.001f ) // skip coplanar
+ {
+ if( dot > 1.0f ) dot = 1.0f;
+ dot = ( dot * 0.5f ) + 0.5f;
+ dot *= dot;
+ }
+ else
+ dot = 0;
+ }
+
+ angle = dot;
+ }
+ else
+ angle = 1.0f;
+