if (projectdistance >= 0.1 && projectdistance < lightradius)
{
VectorSubtract(relativelightorigin, surf->poly_center, temp);
- if (DotProduct(temp, temp) < (surf->poly_radius2 + lightradius2))
+ if (DotProduct(temp, temp) < lightradius2 - surf->poly_radius2)
{
for (mesh = surf->mesh;mesh;mesh = mesh->chain)
{
for (surfnum = 0, surf = ent->model->surfaces + ent->model->firstmodelsurface;surfnum < ent->model->nummodelsurfaces;surfnum++, surf++)
{
VectorSubtract(relativelightorigin, surf->poly_center, temp);
- if (DotProduct(temp, temp) < lightradius2 + surf->poly_radius2)
+ if (DotProduct(temp, temp) < lightradius2 - surf->poly_radius2)
{
f = PlaneDiff(relativelightorigin, surf->plane);
if (surf->flags & SURF_PLANEBACK)
if (surf->visframe == r_framecount)
{
VectorSubtract(relativelightorigin, surf->poly_center, temp);
- if (DotProduct(temp, temp) < lightradius2 + surf->poly_radius2)
+ if (DotProduct(temp, temp) < lightradius2 - surf->poly_radius2)
{
f = PlaneDiff(relativelightorigin, surf->plane);
if (surf->flags & SURF_PLANEBACK)
if (dist > 0 && dist < e->cullradius)
{
VectorSubtract(e->origin, surf->poly_center, temp);
- if (DotProduct(temp, temp) - surf->poly_radius2 < e->cullradius2)
+ if (DotProduct(temp, temp) < e->cullradius2 - surf->poly_radius2)
loadmodel->surfacevisframes[*mark] = -2;
}
}