light: CalcPoints: also check submodel traces against the world

fixes https://github.com/ericwa/tyrutils-ericw/issues/115
This commit is contained in:
Eric Wasylishen 2016-11-04 02:14:05 -06:00
parent dfcbfe5be1
commit 1cca79710c
1 changed files with 17 additions and 5 deletions

View File

@ -596,11 +596,23 @@ CheckObstructed(const lightsurf_t *surf, const vec3_t offset, const vec_t us, co
}
// trace from surf->midpoint to testpoint
vec_t hitdist = 0;
if (IntersectSingleModel(surf->midpoint, dirn, dist, surf->modelinfo->model, &hitdist)) {
// make a corrected point
VectorMA(surf->midpoint, qmax(0.0f, hitdist - 0.25f), dirn, corrected);
return true;
{
vec_t hitdist = 0;
if (IntersectSingleModel(surf->midpoint, dirn, dist, surf->modelinfo->model, &hitdist)) {
// make a corrected point
VectorMA(surf->midpoint, qmax(0.0f, hitdist - 0.25f), dirn, corrected);
return true;
}
}
// also check against the world, fixes https://github.com/ericwa/tyrutils-ericw/issues/115
if (surf->modelinfo->model != &surf->bsp->dmodels[0]) {
vec_t hitdist = 0;
if (IntersectSingleModel(surf->midpoint, dirn, dist, &surf->bsp->dmodels[0], &hitdist)) {
// make a corrected point
VectorMA(surf->midpoint, qmax(0.0f, hitdist - 0.25f), dirn, corrected);
return true;
}
}
}
}