- reduced number of references to r_viewpoint in hw_fakeflat.cpp

This commit is contained in:
Christoph Oelckers 2018-06-19 10:30:18 +02:00
parent 18f43dea1e
commit 3eb4b137f3

View file

@ -392,15 +392,16 @@ sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void HWDrawInfo::SetViewArea() void HWDrawInfo::SetViewArea()
{ {
auto &vp = r_viewpoint;
// The render_sector is better suited to represent the current position in GL // The render_sector is better suited to represent the current position in GL
r_viewpoint.sector = R_PointInSubsector(r_viewpoint.Pos)->render_sector; vp.sector = R_PointInSubsector(vp.Pos)->render_sector;
// Get the heightsec state from the render sector, not the current one! // Get the heightsec state from the render sector, not the current one!
if (r_viewpoint.sector->GetHeightSec()) if (vp.sector->GetHeightSec())
{ {
in_area = r_viewpoint.Pos.Z <= r_viewpoint.sector->heightsec->floorplane.ZatPoint(r_viewpoint.Pos) ? area_below : in_area = vp.Pos.Z <= vp.sector->heightsec->floorplane.ZatPoint(vp.Pos) ? area_below :
(r_viewpoint.Pos.Z > r_viewpoint.sector->heightsec->ceilingplane.ZatPoint(r_viewpoint.Pos) && (vp.Pos.Z > vp.sector->heightsec->ceilingplane.ZatPoint(vp.Pos) &&
!(r_viewpoint.sector->heightsec->MoreFlags&SECMF_FAKEFLOORONLY)) ? area_above : area_normal; !(vp.sector->heightsec->MoreFlags&SECMF_FAKEFLOORONLY)) ? area_above : area_normal;
} }
else else
{ {