Commit ee0c4b42 by Monster Iestyn

fix P_CheckSight to consider FOFs that completely block the view

(this could probably be in its own branch to be tested properly, but I'm on a roll with this atm)
parent b9611c3a
......@@ -254,7 +254,8 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
// no wall to block sight with?
if ((front = seg->frontsector)->floorheight ==
(back = seg->backsector)->floorheight &&
front->ceilingheight == back->ceilingheight)
front->ceilingheight == back->ceilingheight
&& !front->ffloors && !back->ffloors)
continue;
// possible occluder
......@@ -288,6 +289,41 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
if (los->topslope <= los->bottomslope)
return false;
// Monster Iestyn: check FOFs!
if (front->ffloors || back->ffloors)
{
ffloor_t *rover;
fixed_t topslope, bottomslope;
// check front sector's FOFs first
for (rover = front->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS)
|| !(rover->flags & FF_RENDERSIDES) || rover->flags & FF_TRANSLUCENT)
{
continue;
}
topslope = FixedDiv(*rover->topheight - los->sightzstart , frac);
bottomslope = FixedDiv(*rover->bottomheight - los->sightzstart , frac);
if (topslope >= los->topslope && bottomslope <= los->bottomslope)
return false; // view completely blocked
}
// check back sector's FOFs as well
for (rover = back->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS)
|| !(rover->flags & FF_RENDERSIDES) || rover->flags & FF_TRANSLUCENT)
{
continue;
}
topslope = FixedDiv(*rover->topheight - los->sightzstart , frac);
bottomslope = FixedDiv(*rover->bottomheight - los->sightzstart , frac);
if (topslope >= los->topslope && bottomslope <= los->bottomslope)
return false; // view completely blocked
}
// TODO: figure out if it's worth considering partially blocked cases or not?
// maybe to adjust los's top/bottom slopes if needed
}
}
// passed the subsector ok
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment