diff --git a/source/core/rendering/scene/hw_bunchdrawer.cpp b/source/core/rendering/scene/hw_bunchdrawer.cpp index 188ba3e51..4f1c31fd9 100644 --- a/source/core/rendering/scene/hw_bunchdrawer.cpp +++ b/source/core/rendering/scene/hw_bunchdrawer.cpp @@ -272,34 +272,35 @@ int BunchDrawer::ClipLine(int aline, bool portal) if (!portal && !clipper->IsRangeVisible(startAngle, endAngle)) { + //Printf("\nWall %d from %2.3f - %2.3f (clipped away)\n", line, DAngle::fromBam(startAngle).Degrees(), DAngle::fromBam(endAngle).Degrees()); return CL_Skip; } - if (line < 0) - return CL_Pass; - float topclip = 0, bottomclip = 0; - if (cline->partner == -1 || (wall[line].cstat & CSTAT_WALL_1WAY) || CheckClip(&wall[line], &topclip, &bottomclip)) + if (line >= 0 && (cline->partner == -1 || (wall[line].cstat & CSTAT_WALL_1WAY) || CheckClip(&wall[line], &topclip, &bottomclip))) { // one-sided if (!portal && !dontclip && !(sector[sections[section].sector].exflags & SECTOREX_DONTCLIP)) { clipper->AddClipRange(startAngle, endAngle); - //Printf("\nWall %d from %2.3f - %2.3f (blocking)\n", line, bamang(startAngle).asdeg(), bamang(endAngle).asdeg()); + //Printf("\nWall %d from %2.3f - %2.3f (blocking)\n", line, DAngle::fromBam(startAngle).Degrees(), DAngle::fromBam(endAngle).Degrees()); //clipper->DumpClipper(); } return CL_Draw; } else { - if (portal) clipper->RemoveClipRange(startAngle, endAngle); - else + if (line > 0) { - if ((topclip < FLT_MAX || bottomclip > -FLT_MAX) && !dontclip) + if (portal) clipper->RemoveClipRange(startAngle, endAngle); + else { - clipper->AddWindowRange(startAngle, endAngle, topclip, bottomclip, viewz); - //Printf("\nWall %d from %2.3f - %2.3f, (%2.3f, %2.3f) (passing)\n", line, bamang(startAngle).asdeg(), bamang(endAngle).asdeg(), topclip, bottomclip); - //clipper->DumpClipper(); + if ((topclip < FLT_MAX || bottomclip > -FLT_MAX) && !dontclip) + { + clipper->AddWindowRange(startAngle, endAngle, topclip, bottomclip, viewz); + //Printf("\nWall %d from %2.3f - %2.3f, (%2.3f, %2.3f) (passing)\n", line, DAngle::fromBam(startAngle).Degrees(), DAngle::fromBam(endAngle).Degrees(), topclip, bottomclip); + //clipper->DumpClipper(); + } } } @@ -316,7 +317,7 @@ int BunchDrawer::ClipLine(int aline, bool portal) if (endAngle > sectionendang[nsection]) sectionendang[nsection] = endAngle; } - return dontclip? CL_Draw : CL_Draw | CL_Pass; + return line < 0? CL_Pass : dontclip? CL_Draw : CL_Draw | CL_Pass; } } @@ -347,6 +348,7 @@ void BunchDrawer::ProcessBunch(int bnch) if (!gotwall[i]) { + //Printf("\nWall %d processed\n", i); gotwall.Set(i); ClipWall.Unclock(); Bsp.Unclock(); @@ -649,7 +651,7 @@ int BunchDrawer::FindClosestBunch() int nsection = sectionLines[Bunches[closest].startline].section; Printf("\n=====================================\npicked bunch starting at sector %d, wall %d - Range at (%2.3f - %2.3f)\n", sections[nsection].sector, Bunches[closest].startline, - bamang(sectionstartang[nsection]).asdeg(), bamang(sectionendang[nsection]).asdeg()); + DAngle::fromBam(sectionstartang[nsection]).Degrees(), DAngle::fromBam(sectionendang[nsection]).Degrees()); */ return closest; }