From fa3a62e954f6f106e598f0721a5e264a0c77221f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 31 Aug 2014 23:01:53 +0200 Subject: [PATCH] - fix a render glitch with Back to Saturn X MAP06: Do not flood missing upper and lower textures with the backsector's flat if that backsector is malformed (i.e. has no area.) --- src/gl/data/gl_setup.cpp | 3 ++- src/gl/scene/gl_walls.cpp | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/gl/data/gl_setup.cpp b/src/gl/data/gl_setup.cpp index fc63cb95b..5e6e0767b 100644 --- a/src/gl/data/gl_setup.cpp +++ b/src/gl/data/gl_setup.cpp @@ -233,6 +233,7 @@ static void SpreadHackedFlag(subsector_t * sub) if (!(sub2->hacked&1) && sub2->render_sector == sub->render_sector) { sub2->hacked|=1; + sub->hacked &= ~4; SpreadHackedFlag (sub2); } } @@ -285,7 +286,7 @@ static void PrepareSectorData() subsectors[i].render_sector != seg[j].PartnerSeg->Subsector->render_sector) { DPrintf("Found hack: (%d,%d) (%d,%d)\n", seg[j].v1->x>>16, seg[j].v1->y>>16, seg[j].v2->x>>16, seg[j].v2->y>>16); - subsectors[i].hacked|=1; + subsectors[i].hacked|=5; SpreadHackedFlag(&subsectors[i]); } if (seg[j].PartnerSeg==NULL) subsectors[i].hacked|=2; // used for quick termination checks diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index bb160a790..e86b03d49 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -1417,7 +1417,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) sector_t * realback; #ifdef _DEBUG - if (seg->linedef-lines==636) + if (seg->linedef-lines==1276) { int a = 0; } @@ -1635,7 +1635,11 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) } else if (!(seg->sidedef->Flags & WALLF_POLYOBJ)) { - gl_drawinfo->AddUpperMissingTexture(seg->sidedef, sub, bch1a); + // skip processing if the back is a malformed subsector + if (!(seg->PartnerSeg->Subsector->hacked & 4)) + { + gl_drawinfo->AddUpperMissingTexture(seg->sidedef, sub, bch1a); + } } } } @@ -1704,7 +1708,11 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) else if (backsector->GetTexture(sector_t::floor) != skyflatnum && !(seg->sidedef->Flags & WALLF_POLYOBJ)) { - gl_drawinfo->AddLowerMissingTexture(seg->sidedef, sub, bfh1); + // skip processing if the back is a malformed subsector + if (!(seg->PartnerSeg->Subsector->hacked & 4)) + { + gl_drawinfo->AddLowerMissingTexture(seg->sidedef, sub, bfh1); + } } } }