From 3afa8149deaa0bbe1968ed80f56ed5095fa69534 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Aug 2010 16:53:11 +0000 Subject: [PATCH] - added a fix from GZDoom to handle levels with compressed sidedefs that were processed by older ZDBSPs. SVN r2612 (trunk) --- src/p_setup.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index b0a92b2c4..3f7f91454 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -3830,6 +3830,28 @@ void P_SetupLevel (char *lumpname, int position) DPrintf ("BSP generation took %.3f sec (%d segs)\n", (endTime - startTime) * 0.001, numsegs); reloop = true; } + else + { + // Older ZDBSPs had problems with compressed sidedefs and assigned wrong sides to the segs if both sides were the same sidedef. + for(i=0;ibacksector == seg->frontsector && seg->linedef) + { + fixed_t d1=P_AproxDistance(seg->v1->x-seg->linedef->v1->x,seg->v1->y-seg->linedef->v1->y); + fixed_t d2=P_AproxDistance(seg->v2->x-seg->linedef->v1->x,seg->v2->y-seg->linedef->v1->y); + + if (d2sidedef = seg->linedef->sidedef[1]; + } + else // front side + { + seg->sidedef = seg->linedef->sidedef[0]; + } + } + } + } // Copy pointers to the old nodes so that R_PointInSubsector can use them if (nodes && subsectors)