- Change all binangle members in Clipper struct to angle_t.

This commit is contained in:
Mitchell Richters 2022-08-27 19:47:20 +10:00 committed by Christoph Oelckers
parent 914930ff9a
commit e6fe9b7031
4 changed files with 19 additions and 19 deletions

View file

@ -751,7 +751,7 @@ 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(bamang(ang1));
clipper->Clear(ang1);
for (unsigned i = 0; i < sectcount; i++)
{

View file

@ -184,7 +184,7 @@ void Clipper::SplitRange(ClipNode* node, int start, int end, float topclip, floa
//
//-----------------------------------------------------------------------------
void Clipper::Clear(binangle rangestart)
void Clipper::Clear(angle_t rangestart)
{
ClipNode *node = cliphead;
ClipNode *temp;
@ -198,12 +198,12 @@ void Clipper::Clear(binangle rangestart)
cliphead = nullptr;
if (visibleStart.asbam() != 0 || visibleEnd.asbam() != 0)
if (visibleStart != 0 || visibleEnd != 0)
{
int vstart = int(visibleStart.asbam() - rangestart.asbam());
int vstart = int(visibleStart - rangestart);
if (vstart > 1) AddClipRange(0, vstart);
int vend = int(visibleEnd.asbam() - rangestart.asbam());
int vend = int(visibleEnd - rangestart);
if (vend > 0 && vend < INT_MAX) AddClipRange(vend, INT_MAX);
}

View file

@ -24,7 +24,7 @@ class Clipper
ClipNode * freelist = nullptr;
ClipNode * cliphead = nullptr;
binangle visibleStart, visibleEnd;
angle_t visibleStart, visibleEnd;
public:
bool IsRangeVisible(int startangle, int endangle);
@ -34,7 +34,7 @@ public:
public:
void Clear(binangle rangestart);
void Clear(angle_t rangestart);
void Free(ClipNode *node)
{
@ -78,13 +78,13 @@ public:
{
if (a2 != 0xffffffff)
{
visibleStart = bamang(a1 - a2);
visibleEnd = bamang(a1 + a2);
visibleStart = a1 - a2;
visibleEnd = a1 + a2;
}
else visibleStart = visibleEnd = bamang(0);
else visibleStart = visibleEnd = 0;
}
void RestrictVisibleRange(binangle a1, binangle a2)
void RestrictVisibleRange(angle_t a1, angle_t a2)
{
if (visibleStart == visibleEnd)
{
@ -93,8 +93,8 @@ public:
}
else
{
if (a1.asbam() - visibleStart.asbam() < visibleEnd.asbam() - visibleStart.asbam()) visibleStart = a1;
if (a2.asbam() - visibleStart.asbam() < visibleEnd.asbam() - visibleStart.asbam()) visibleStart = a2;
if (a1 - visibleStart < visibleEnd - visibleStart) visibleStart = a1;
if (a2 - visibleStart < visibleEnd - visibleStart) visibleStart = a2;
}
}

View file

@ -564,8 +564,8 @@ bool HWMirrorPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *clippe
ClearClipper(di, clipper);
auto startan = bvectangbam(line->pos.X - newx, line->pos.Y - newy);
auto endan = bvectangbam(line->point2Wall()->pos.X - newx, line->point2Wall()->pos.Y - newy);
auto startan = RAD2BAM(atan2(line->pos.Y - newy, line->pos.X - newx));
auto endan = RAD2BAM(atan2(line->point2Wall()->pos.Y - newy, line->point2Wall()->pos.X - newx));
clipper->RestrictVisibleRange(endan, startan); // we check the line from the backside so angles are reversed.
return true;
}
@ -634,8 +634,8 @@ bool HWLineToLinePortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *cl
ClearClipper(di, clipper);
auto startan = bvectangbam(origin->wall_int_pos().X - origx, origin->wall_int_pos().Y - origy);
auto endan = bvectangbam(origin->point2Wall()->wall_int_pos().X - origx, origin->point2Wall()->wall_int_pos().Y - origy);
auto startan = RAD2BAM(atan2(origin->wall_int_pos().Y - origy, origin->wall_int_pos().X - origx));
auto endan = RAD2BAM(atan2(origin->point2Wall()->wall_int_pos().Y - origy, origin->point2Wall()->wall_int_pos().X - origx));
clipper->RestrictVisibleRange(startan, endan);
return true;
}
@ -686,8 +686,8 @@ bool HWLineToSpritePortal::Setup(HWDrawInfo* di, FRenderState& rstate, Clipper*
ClearClipper(di, clipper);
auto startan = bvectangbam(origin->pos.X - origx, origin->pos.Y - origy);
auto endan = bvectangbam(origin->point2Wall()->pos.X - origx, origin->point2Wall()->pos.Y - origy);
auto startan = RAD2BAM(atan2(origin->pos.Y - origy, origin->pos.X - origx));
auto endan = RAD2BAM(atan2(origin->point2Wall()->pos.Y - origy, origin->point2Wall()->pos.X - origx));
clipper->RestrictVisibleRange(startan, endan);
return true;
}