From aa12772e079f37cb48cba3602eaeacb2cabbc3c8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 20 Apr 2016 13:18:53 +0200 Subject: [PATCH] - crash fix and minor optimization. --- src/gl/scene/gl_bsp.cpp | 8 +++++--- src/r_defs.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gl/scene/gl_bsp.cpp b/src/gl/scene/gl_bsp.cpp index 4377f68f1..725ea8663 100644 --- a/src/gl/scene/gl_bsp.cpp +++ b/src/gl/scene/gl_bsp.cpp @@ -141,11 +141,13 @@ static void AddLine (seg_t *seg, bool portalclip) } currentsubsector->flags |= SSECF_DRAWN; + BYTE ispoly = BYTE(seg->sidedef->Flags & WALLF_POLYOBJ); + if (!seg->backsector) { clipper.SafeAddClipRange(startAngle, endAngle); } - else if (!(seg->sidedef->Flags & WALLF_POLYOBJ)) // Two-sided polyobjects never obstruct the view + else if (!ispoly) // Two-sided polyobjects never obstruct the view { if (currentsector->sectornum == seg->backsector->sectornum) { @@ -179,9 +181,9 @@ static void AddLine (seg_t *seg, bool portalclip) seg->linedef->flags |= ML_MAPPED; - if ((seg->sidedef->Flags & WALLF_POLYOBJ) || seg->linedef->validcount!=validcount) + if (ispoly || seg->linedef->validcount!=validcount) { - if (!(seg->sidedef->Flags & WALLF_POLYOBJ)) seg->linedef->validcount=validcount; + if (!ispoly) seg->linedef->validcount=validcount; if (gl_render_walls) { diff --git a/src/r_defs.h b/src/r_defs.h index 1f2f35621..2260dbf1d 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -1001,7 +1001,7 @@ public: int GetPortalType(int plane) { - return SkyBoxes[plane]->special1; + return SkyBoxes[plane] == nullptr? -1 : SkyBoxes[plane]->special1; } int GetOppositePortalGroup(int plane)