From 914930ff9addeaf2988d2d744e1193262cf98352 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sat, 27 Aug 2022 19:38:37 +1000 Subject: [PATCH] - Change `BunchDrawer::ang1`, `BunchDrawer::ang2` and `BunchDrawer::angrange` from `binangle` to `angle_t`. --- .../core/rendering/scene/hw_bunchdrawer.cpp | 30 +++++++++---------- source/core/rendering/scene/hw_bunchdrawer.h | 4 +-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/source/core/rendering/scene/hw_bunchdrawer.cpp b/source/core/rendering/scene/hw_bunchdrawer.cpp index 66ca407d1..0378f0c46 100644 --- a/source/core/rendering/scene/hw_bunchdrawer.cpp +++ b/source/core/rendering/scene/hw_bunchdrawer.cpp @@ -55,8 +55,8 @@ void BunchDrawer::Init(HWDrawInfo *_di, Clipper* c, vec2_t& view, binangle a1, binangle a2) { - ang1 = a1; - ang2 = a2; + ang1 = a1.asbam(); + ang2 = a2.asbam(); angrange = ang2 - ang1; di = _di; clipper = c; @@ -120,7 +120,7 @@ bool BunchDrawer::StartBunch(int sectnum, int linenum, binangle startan, binangl bunch->endangle = endan.asbam(); bunch->portal = portal; assert(bunch->endangle >= bunch->startangle); - return bunch->endangle != angrange.asbam(); + return bunch->endangle != angrange; } //========================================================================== @@ -135,7 +135,7 @@ bool BunchDrawer::AddLineToBunch(int line, binangle newan) assert(newan.asbam() > Bunches[LastBunch].endangle); Bunches[LastBunch].endangle = newan.asbam(); assert(Bunches[LastBunch].endangle > Bunches[LastBunch].startangle); - return Bunches[LastBunch].endangle != angrange.asbam(); + return Bunches[LastBunch].endangle != angrange; } //========================================================================== @@ -241,7 +241,7 @@ int BunchDrawer::ClipLine(int aline, bool portal) int startAngle = startAngleBam.asbam(); int endAngle = endAngleBam.asbam(); if (startAngle < 0) startAngle = 0; - if (endAngle < 0 || endAngle > (int)angrange.asbam()) endAngle = angrange.asbam(); + if (endAngle < 0 || endAngle > (int)angrange) endAngle = angrange; // since these values are derived from previous calls of this function they cannot be out of range. int sectStartAngle = sectionstartang[section]; @@ -715,15 +715,15 @@ void BunchDrawer::ProcessSection(int sectionnum, bool portal) binangle walang2 = ClipAngle(thisline->endpoint); // outside the visible area or seen from the backside. - if ((walang1.asbam() > angrange.asbam() && walang2.asbam() > angrange.asbam() && walang1.asbam() < walang2.asbam()) || + if ((walang1.asbam() > angrange && walang2.asbam() > angrange && walang1.asbam() < walang2.asbam()) || (walang1.asbam() - walang2.asbam() < ANGLE_180)) { inbunch = false; } else { - if (walang1.asbam() >= angrange.asbam()) { walang1 = bamang(0); inbunch = false; } - if (walang2.asbam() >= angrange.asbam()) walang2 = angrange; + if (walang1.asbam() >= angrange) { walang1 = bamang(0); inbunch = false; } + if (walang2.asbam() >= angrange) walang2 = bamang(angrange); if (section->lines[i] >= (int)wall.Size()) inbunch = false; if (!inbunch) { @@ -751,14 +751,14 @@ void BunchDrawer::RenderScene(const int* viewsectors, unsigned sectcount, bool p //Printf("----------------------------------------- \nstart at sector %d, z = %2.3f\n", viewsectors[0], viewz); auto process = [&]() { - clipper->Clear(ang1); + clipper->Clear(bamang(ang1)); for (unsigned i = 0; i < sectcount; i++) { for (auto j : sectionsPerSector[viewsectors[i]]) { sectionstartang[j] = 0; - sectionendang[j] = int(angrange.asbam()); + sectionendang[j] = int(angrange); } } for (unsigned i = 0; i < sectcount; i++) @@ -777,7 +777,7 @@ void BunchDrawer::RenderScene(const int* viewsectors, unsigned sectcount, bool p }; Bsp.Clock(); - if (ang1.asbam() != 0 || ang2.asbam() != 0) + if (ang1 != 0 || ang2 != 0) { process(); } @@ -786,13 +786,13 @@ void BunchDrawer::RenderScene(const int* viewsectors, unsigned sectcount, bool p // with a 360° field of view we need to split the scene into two halves. // The BunchInFront check can fail with angles that may wrap around. auto rotang = di->Viewpoint.RotAngle; - ang1 = bamang(rotang - ANGLE_90); - ang2 = bamang(rotang + ANGLE_90 - 1); + ang1 = rotang - ANGLE_90; + ang2 = rotang + ANGLE_90 - 1; angrange = ang2 - ang1; process(); gotsection2.Zero(); - ang1 = bamang(rotang + ANGLE_90); - ang2 = bamang(rotang - ANGLE_90 - 1); + ang1 = rotang + ANGLE_90; + ang2 = rotang - ANGLE_90 - 1; angrange = ang2 - ang1; process(); } diff --git a/source/core/rendering/scene/hw_bunchdrawer.h b/source/core/rendering/scene/hw_bunchdrawer.h index b1b1322ee..fb1a07f91 100644 --- a/source/core/rendering/scene/hw_bunchdrawer.h +++ b/source/core/rendering/scene/hw_bunchdrawer.h @@ -31,7 +31,7 @@ class BunchDrawer BitArray gotsection2; BitArray gotwall; BitArray blockwall; - binangle ang1, ang2, angrange; + angle_t ang1, ang2, angrange; float viewz; TArray sectionstartang, sectionendang; @@ -45,7 +45,7 @@ private: CL_Pass = 2, }; - binangle ClipAngle(int wal) { return bamang(wall[wal].clipangle) - ang1; } + binangle ClipAngle(int wal) { return bamang(wall[wal].clipangle - ang1); } void StartScene(); bool StartBunch(int sectnum, int linenum, binangle startan, binangle endan, bool portal); bool AddLineToBunch(int line, binangle newan);