From 9c389f90c8cf1553667128b81356e78173d5c23c Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 29 Aug 2010 04:04:37 +0000 Subject: [PATCH] - Fixed: ZDBSP wrote uninitialized data for normal segs. SVN r2630 (trunk) --- nodebuild.cpp | 4 +++- nodebuild_classify_sse2_vect.cpp | 6 +++--- processor.cpp | 12 ++++++------ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/nodebuild.cpp b/nodebuild.cpp index 25d319f..c761149 100644 --- a/nodebuild.cpp +++ b/nodebuild.cpp @@ -203,10 +203,12 @@ void FNodeBuilder::CreateSubsectorsForReal () } for (unsigned int i = sub.firstline; i < SegList.Size(); ++i) { - D(printf (" Seg %5d%c(%5d,%5d)-(%5d,%5d)\n", SegList[i].SegPtr - &Segs[0], + D(printf (" Seg %5d%c%d(%5d,%5d)-%d(%5d,%5d)\n", SegList[i].SegPtr - &Segs[0], SegList[i].SegPtr->linedef == -1 ? '+' : ' ', + SegList[i].SegPtr->v1, Vertices[SegList[i].SegPtr->v1].x>>16, Vertices[SegList[i].SegPtr->v1].y>>16, + SegList[i].SegPtr->v2, Vertices[SegList[i].SegPtr->v2].x>>16, Vertices[SegList[i].SegPtr->v2].y>>16)); SegList[i].SegNum = DWORD(SegList[i].SegPtr - &Segs[0]); diff --git a/nodebuild_classify_sse2_vect.cpp b/nodebuild_classify_sse2_vect.cpp index c231d9c..0e52e11 100644 --- a/nodebuild_classify_sse2_vect.cpp +++ b/nodebuild_classify_sse2_vect.cpp @@ -114,7 +114,7 @@ extern "C" int ClassifyLineSSE2 (node_t &node, const FSimpleVert *v1, const FSim } else { - nears = 2 | ((_.ni[2] | _.pi[2]) ? 0 : 1); + nears = 2 | (((_.ni[2] | _.pi[2]) & 1) ^ 1); } __m128d zero = _mm_setzero_pd(); @@ -133,11 +133,11 @@ extern "C" int ClassifyLineSSE2 (node_t &node, const FSimpleVert *v1, const FSim __m128d epsilon = _mm_set1_pd(SIDE_EPSILON); __m128d close = _mm_cmplt_pd(dist, epsilon); _mm_storeu_pd(_.n, close); - if ((nears & 2) && _.ni[0]) + if (nears & _.ni[0] & 2) { sv1 = 0; } - if ((nears & 1) && _.ni[2]) + if (nears & _.ni[2] & 1) { sv2 = 0; } diff --git a/processor.cpp b/processor.cpp index f9803be..2def63c 100644 --- a/processor.cpp +++ b/processor.cpp @@ -1041,12 +1041,12 @@ void FProcessor::WriteSegs (FWadWriter &out) for (i = 0; i < Level.NumSegs; ++i) { - segdata[i].v1 = LittleShort(segdata[i].v1); - segdata[i].v2 = LittleShort(segdata[i].v2); - segdata[i].angle = LittleShort(segdata[i].angle); - segdata[i].linedef = LittleShort(segdata[i].linedef); - segdata[i].side = LittleShort(segdata[i].side); - segdata[i].offset = LittleShort(segdata[i].offset); + segdata[i].v1 = LittleShort(WORD(Level.Segs[i].v1)); + segdata[i].v2 = LittleShort(WORD(Level.Segs[i].v2)); + segdata[i].angle = LittleShort(Level.Segs[i].angle); + segdata[i].linedef = LittleShort(Level.Segs[i].linedef); + segdata[i].side = LittleShort(Level.Segs[i].side); + segdata[i].offset = LittleShort(Level.Segs[i].offset); } out.WriteLump ("SEGS", segdata, sizeof(*segdata)*Level.NumSegs);