- Fixed: sector_t::GetHeightSec() was too aggressive about not returning heightsec.

SVN r3600 (trunk)
This commit is contained in:
Randy Heit 2012-04-27 02:50:23 +00:00
parent fc6d55c508
commit 6369a88e0f
2 changed files with 26 additions and 8 deletions

View file

@ -802,6 +802,31 @@ int sector_t::GetCeilingLight () const
}
}
sector_t *sector_t::GetHeightSec() const
{
if (heightsec == NULL)
{
return NULL;
}
if (heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC)
{
return NULL;
}
if (e && e->XFloor.ffloors.Size())
{
// If any of these fake floors render their planes, ignore heightsec.
for (unsigned i = e->XFloor.ffloors.Size(); i-- > 0; )
{
if ((e->XFloor.ffloors[i]->flags & (FF_EXISTS | FF_RENDERPLANES)) == (FF_EXISTS | FF_RENDERPLANES))
{
return NULL;
}
}
}
return heightsec;
}
bool secplane_t::CopyPlaneIfValid (secplane_t *dest, const secplane_t *opp) const
{
bool copy = false;

View file

@ -439,6 +439,7 @@ struct sector_t
void ClosestPoint(fixed_t x, fixed_t y, fixed_t &ox, fixed_t &oy) const;
int GetFloorLight () const;
int GetCeilingLight () const;
sector_t *GetHeightSec() const;
DInterpolation *SetInterpolation(int position, bool attach);
void StopInterpolation(int position);
@ -600,14 +601,6 @@ struct sector_t
planes[pos].TexZ += val;
}
sector_t *GetHeightSec() const
{
return (heightsec &&
!(heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC) &&
!(this->e && this->e->XFloor.ffloors.Size())
)? heightsec : NULL;
}
static inline short ClampLight(int level)
{
return (short)clamp(level, SHRT_MIN, SHRT_MAX);