From 180c73d8cad1c0bc4edffce9009cbc38e3747ee2 Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 18 Feb 2019 22:02:42 +0000 Subject: [PATCH] Fix the automap glitch in the region around the full status bar in Polymost git-svn-id: https://svn.eduke32.com/eduke32@7331 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/2d.cpp | 29 +++++++++++++++++++++++++++++ source/duke3d/src/screens.cpp | 6 ++++++ 2 files changed, 35 insertions(+) diff --git a/source/build/src/2d.cpp b/source/build/src/2d.cpp index 43b442548..27b6e07e0 100644 --- a/source/build/src/2d.cpp +++ b/source/build/src/2d.cpp @@ -138,6 +138,35 @@ static void drawlinegl(int32_t x1, int32_t y1, int32_t x2, int32_t y2, palette_t polymost_useColorOnly(true); glBegin(GL_LINES); glColor4ub(p.r, p.g, p.b, 255); + + int const dx = x2-x1; + int const dy = y2-y1; + + if (dx >= 0) + { + if ((x1 >= wx2) || (x2 < wx1)) return; + if (x1 < wx1) y1 += scale(wx1-x1, dy, dx), x1 = wx1; + if (x2 > wx2) y2 += scale(wx2-x2, dy, dx), x2 = wx2; + } + else + { + if ((x2 >= wx2) || (x1 < wx1)) return; + if (x2 < wx1) y2 += scale(wx1-x2, dy, dx), x2 = wx1; + if (x1 > wx2) y1 += scale(wx2-x1, dy, dx), x1 = wx2; + } + if (dy >= 0) + { + if ((y1 >= wy2) || (y2 < wy1)) return; + if (y1 < wy1) x1 += scale(wy1-y1, dx, dy), y1 = wy1; + if (y2 > wy2) x2 += scale(wy2-y2, dx, dy), y2 = wy2; + } + else + { + if ((y2 >= wy2) || (y1 < wy1)) return; + if (y2 < wy1) x2 += scale(wy1-y2, dx, dy), y2 = wy1; + if (y1 > wy2) x1 += scale(wy2-y1, dx, dy), y1 = wy2; + } + glVertex2f((float) x1 * (1.f/4096.f), (float) y1 * (1.f/4096.f)); glVertex2f((float) x2 * (1.f/4096.f), (float) y2 * (1.f/4096.f)); diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index 300195d09..412c96eec 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -1102,6 +1102,12 @@ void G_DisplayRest(int32_t smoothratio) if (ud.overhead_on == 2) { videoClearViewableArea(0L); +#ifdef USE_OPENGL + if (videoGetRenderMode() >= REND_POLYMOST) + { + G_DrawBackground(); // Necessary GL fills the entire screen with black + } +#endif renderDrawMapView(cposx, cposy, pp->zoom, cang); } G_DrawOverheadMap(cposx, cposy, pp->zoom, cang);