From 60f5d9b67c49f769637da85606518790537e1cae Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 30 Aug 2022 00:08:15 +1000 Subject: [PATCH] - Rework some automap functions in prep for floatification. --- source/common/2d/v_2ddrawer.cpp | 2 +- source/common/2d/v_2ddrawer.h | 2 +- source/core/automap.cpp | 6 +++--- source/core/automap.h | 7 ++++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/source/common/2d/v_2ddrawer.cpp b/source/common/2d/v_2ddrawer.cpp index 367fdbc33..2971e4f4c 100644 --- a/source/common/2d/v_2ddrawer.cpp +++ b/source/common/2d/v_2ddrawer.cpp @@ -1075,7 +1075,7 @@ void F2DDrawer::AddLine(double x1, double y1, double x2, double y2, const IntRec // //========================================================================== -void F2DDrawer::AddThickLine(int x1, int y1, int x2, int y2, double thickness, uint32_t color, uint8_t alpha) +void F2DDrawer::AddThickLine(double x1, double y1, double x2, double y2, double thickness, uint32_t color, uint8_t alpha) { PalEntry p = (PalEntry)color; p.a = alpha; diff --git a/source/common/2d/v_2ddrawer.h b/source/common/2d/v_2ddrawer.h index 904b66820..038de6199 100644 --- a/source/common/2d/v_2ddrawer.h +++ b/source/common/2d/v_2ddrawer.h @@ -228,7 +228,7 @@ public: void AddLine(double x1, double y1, double x2, double y2, const IntRect* clip, uint32_t color, uint8_t alpha = 255); - void AddThickLine(int x1, int y1, int x2, int y2, double thickness, uint32_t color, uint8_t alpha = 255); + void AddThickLine(double x1, double y1, double x2, double y2, double thickness, uint32_t color, uint8_t alpha = 255); void AddPixel(int x1, int y1, uint32_t color); void AddEnableStencil(bool on); diff --git a/source/core/automap.cpp b/source/core/automap.cpp index 00d23857c..3a581bee4 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -318,13 +318,13 @@ void MarkSectorSeen(sectortype* sec) // //--------------------------------------------------------------------------- -void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, PalEntry p) +void drawlinergb(const double x1, const double y1, const double x2, const double y2, PalEntry p) { if (am_linethickness >= 2) { - twod->AddThickLine(x1 / 4096, y1 / 4096, x2 / 4096, y2 / 4096, am_linethickness, p, uint8_t(am_linealpha * 255)); + twod->AddThickLine(x1, y1, x2, y2, am_linethickness, p, uint8_t(am_linealpha * 255)); } else { // Use more efficient thin line drawing routine. - twod->AddLine(x1 / 4096.f, y1 / 4096.f, x2 / 4096.f, y2 / 4096.f, &viewport3d, p, uint8_t(am_linealpha * 255)); + twod->AddLine(x1, y1, x2, y2, &viewport3d, p, uint8_t(am_linealpha * 255)); } } diff --git a/source/core/automap.h b/source/core/automap.h index 9cdbfe3b2..f0e058ac6 100644 --- a/source/core/automap.h +++ b/source/core/automap.h @@ -18,7 +18,12 @@ void ClearAutomap(); void MarkSectorSeen(sectortype* sect); void DrawOverheadMap(int pl_x, int pl_y, const DAngle pl_angle, double const smoothratio); bool AM_Responder(event_t* ev, bool last); -void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, PalEntry p); +void drawlinergb(const double x1, const double y1, const double x2, const double y2, PalEntry p); + +inline void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, PalEntry p) +{ + drawlinergb(x1 / 4096., y1 / 4096., x2 / 4096., y2 / 4096., p); +} enum AM_Mode {