From bb3959fb0f24c67812d6a6836ff50a3601ecac3c Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 30 Aug 2022 00:08:41 +1000 Subject: [PATCH] - Floatified `drawredlines()`. --- source/core/automap.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/source/core/automap.cpp b/source/core/automap.cpp index 3a581bee4..aa83a32ed 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -409,10 +409,10 @@ bool ShowRedLine(int j, int i) // //--------------------------------------------------------------------------- -static void drawredlines(int cposx, int cposy, const double czoom, const DAngle cang) +static void drawredlines(const DVector2& cpos, const double czoom, const DAngle cang) { - int xvect = -cang.Sin() * 16384. * czoom; - int yvect = -cang.Cos() * 16384. * czoom; + double xvect = -cang.Sin() * czoom * (1. / 1024.); + double yvect = -cang.Cos() * czoom * (1. / 1024.); int width = screen->GetWidth(); int height = screen->GetHeight(); @@ -434,16 +434,14 @@ static void drawredlines(int cposx, int cposy, const double czoom, const DAngle if (ShowRedLine(wallnum(&wal), i)) { - int ox = wal.wall_int_pos().X - cposx; - int oy = wal.wall_int_pos().Y - cposy; - int x1 = DMulScale(ox, xvect, -oy, yvect, 16) + (width << 11); - int y1 = DMulScale(oy, xvect, ox, yvect, 16) + (height << 11); + auto oxy1 = wal.pos - cpos; + double x1 = (oxy1.X * xvect) - (oxy1.Y * yvect) + (width * 0.5); + double y1 = (oxy1.Y * xvect) + (oxy1.X * yvect) + (height * 0.5); auto wal2 = wal.point2Wall(); - ox = wal2->wall_int_pos().X - cposx; - oy = wal2->wall_int_pos().Y - cposy; - int x2 = DMulScale(ox, xvect, -oy, yvect, 16) + (width << 11); - int y2 = DMulScale(oy, xvect, ox, yvect, 16) + (height << 11); + auto oxy2 = wal2->pos - cpos; + double x2 = (oxy2.X * xvect) - (oxy2.Y * yvect) + (width * 0.5); + double y2 = (oxy2.Y * xvect) + (oxy2.X * yvect) + (height * 0.5); drawlinergb(x1, y1, x2, y2, RedLineColor()); } @@ -670,7 +668,7 @@ void DrawOverheadMap(int pl_x, int pl_y, const DAngle pl_angle, double const smo twod->ClearScreen(); renderDrawMapView(follow, gZoom, follow_a); } - drawredlines(x, y, gZoom, follow_a); + drawredlines(follow, gZoom, follow_a); drawwhitelines(x, y, gZoom, follow_a); if (!gi->DrawAutomapPlayer(pl_x, pl_y, x, y, gZoom, follow_a, smoothratio)) DrawPlayerArrow(x, y, follow_a, pl_x, pl_y, gZoom, -pl_angle);