From ebb926e7b052572decb40d259062a3c08ddbf8df Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 9 Dec 2017 17:38:34 +0200 Subject: [PATCH] Added free space margin aka safe frame for automap am_freespacemargin CVAR and corresponding menu options can set empty space margin for automap in percentage of zoomed out size https://forum.zdoom.org/viewtopic.php?t=58653 --- src/am_map.cpp | 19 +++++++++++++++++-- wadsrc/static/language.enu | 1 + wadsrc/static/menudef.txt | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index d5c6a05f0..5ab41cd09 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -98,6 +98,20 @@ CVAR (Bool, am_showkeys, true, CVAR_ARCHIVE); CVAR (Int, am_showtriggerlines, 0, CVAR_ARCHIVE); CVAR (Int, am_showthingsprites, 0, CVAR_ARCHIVE); +CUSTOM_CVAR (Int, am_emptyspacemargin, 0, CVAR_ARCHIVE) +{ + if (self < 0) + { + self = 0; + } + else if (self > 50) + { + self = 50; + } + + AM_NewResolution(); +} + //============================================================================= // // Automap colors @@ -1063,8 +1077,9 @@ static void AM_findMinMaxBoundaries () static void AM_calcMinMaxMtoF() { - double a = SCREENWIDTH / max_w; - double b = StatusBar->GetTopOfStatusbar() / max_h; + const double safe_frame = 1.0 - am_emptyspacemargin / 100.0; + double a = safe_frame * (SCREENWIDTH / max_w); + double b = safe_frame * (StatusBar->GetTopOfStatusbar() / max_h); min_scale_mtof = a < b ? a : b; max_scale_mtof = SCREENHEIGHT / (2*PLAYERRADIUS); diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index c66c97612..a147eeb80 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -1941,6 +1941,7 @@ AUTOMAPMNU_SHOWKEYS = "Show keys (cheat)"; AUTOMAPMNU_SHOWTRIGGERLINES = "Show trigger lines"; AUTOMAPMNU_SHOWTHINGSPRITES = "Show things as sprites"; AUTOMAPMNU_PTOVERLAY = "Overlay portals"; +AUTOMAPMNU_EMPTYSPACEMARGIN = "Empty space margin"; // Automap Controls MAPCNTRLMNU_TITLE = "CUSTOMIZE MAP CONTROLS"; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 9e45f4137..9574608f3 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1091,6 +1091,7 @@ OptionMenu AutomapOptions protected Option "$AUTOMAPMNU_TEXTURED", "am_textured", "OnOff" Option "$AUTOMAPMNU_FOLLOW", "am_followplayer", "OnOff" Option "$AUTOMAPMNU_PTOVERLAY", "am_portaloverlay", "OnOff" + Slider "$AUTOMAPMNU_EMPTYSPACEMARGIN", "am_emptyspacemargin", 0, 50, 5, 0 StaticText " " Option "$AUTOMAPMNU_SHOWITEMS", "am_showitems", "OnOff" Option "$AUTOMAPMNU_SHOWMONSTERS", "am_showmonsters", "OnOff"