From 6369a88e0fedc47887710d23d022f386f7625f89 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 27 Apr 2012 02:50:23 +0000 Subject: [PATCH] - Fixed: sector_t::GetHeightSec() was too aggressive about not returning heightsec. SVN r3600 (trunk) --- src/p_sectors.cpp | 25 +++++++++++++++++++++++++ src/r_defs.h | 9 +-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index 4fcfebaf0..330344679 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -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; diff --git a/src/r_defs.h b/src/r_defs.h index efc72bcf7..1bc9f6e01 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -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);