From 91ce22931d60ce0549571405efd3fb7c042382da Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sat, 10 Jul 2021 00:18:59 +0200 Subject: [PATCH] Add cvars to control automap line alpha and thickness This can be used to improve automap readability on high-resolution displays. --- source/core/automap.cpp | 9 ++++++++- wadsrc/static/menudef.txt | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/source/core/automap.cpp b/source/core/automap.cpp index b28645f9a..98a0b5c66 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -49,6 +49,8 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au) CVAR(Bool, am_followplayer, true, CVAR_ARCHIVE) CVAR(Bool, am_rotate, true, CVAR_ARCHIVE) +CVAR(Float, am_linealpha, 1.0f, CVAR_ARCHIVE) +CVAR(Int, am_linethickness, 1, CVAR_ARCHIVE) CVAR(Bool, am_textfont, false, CVAR_ARCHIVE) CVAR(Bool, am_showlabel, false, CVAR_ARCHIVE) CVAR(Bool, am_nameontop, false, CVAR_ARCHIVE) @@ -322,7 +324,12 @@ void MarkSectorSeen(int i) void drawlinergb(int32_t x1, int32_t y1, int32_t x2, int32_t y2, PalEntry p) { - twod->AddLine(x1 / 4096.f, y1 / 4096.f, x2 / 4096.f, y2 / 4096.f, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y, p); + if (am_linethickness >= 2) { + twod->AddThickLine(x1 / 4096.f, y1 / 4096.f, x2 / 4096.f, y2 / 4096.f, 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, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y, p, uint8_t(am_linealpha * 255)); + } } //--------------------------------------------------------------------------- diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 56b1c91f3..107028224 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1173,6 +1173,8 @@ OptionMenu "AutomapOptions" StaticText "" Option "$AUTOMAPMNU_ROTATE", "am_rotate", "OnOff" Option "$AUTOMAPMNU_FOLLOW", "am_followplayer", "OnOff" + Slider "$AUTOMAPMNU_LINEALPHA", "am_linealpha", 0.1, 1.0, 0.1, 1 + Slider "$AUTOMAPMNU_LINETHICKNESS", "am_linethickness", 1, 8, 1, 0 // todo: //CVAR(Bool, am_textfont, false, CVAR_ARCHIVE)