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
This commit is contained in:
alexey.lysiuk 2017-12-09 17:38:34 +02:00
parent eb5da3e641
commit ebb926e7b0
3 changed files with 19 additions and 2 deletions

View file

@ -98,6 +98,20 @@ CVAR (Bool, am_showkeys, true, CVAR_ARCHIVE);
CVAR (Int, am_showtriggerlines, 0, CVAR_ARCHIVE); CVAR (Int, am_showtriggerlines, 0, CVAR_ARCHIVE);
CVAR (Int, am_showthingsprites, 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 // Automap colors
@ -1063,8 +1077,9 @@ static void AM_findMinMaxBoundaries ()
static void AM_calcMinMaxMtoF() static void AM_calcMinMaxMtoF()
{ {
double a = SCREENWIDTH / max_w; const double safe_frame = 1.0 - am_emptyspacemargin / 100.0;
double b = StatusBar->GetTopOfStatusbar() / max_h; double a = safe_frame * (SCREENWIDTH / max_w);
double b = safe_frame * (StatusBar->GetTopOfStatusbar() / max_h);
min_scale_mtof = a < b ? a : b; min_scale_mtof = a < b ? a : b;
max_scale_mtof = SCREENHEIGHT / (2*PLAYERRADIUS); max_scale_mtof = SCREENHEIGHT / (2*PLAYERRADIUS);

View file

@ -1941,6 +1941,7 @@ AUTOMAPMNU_SHOWKEYS = "Show keys (cheat)";
AUTOMAPMNU_SHOWTRIGGERLINES = "Show trigger lines"; AUTOMAPMNU_SHOWTRIGGERLINES = "Show trigger lines";
AUTOMAPMNU_SHOWTHINGSPRITES = "Show things as sprites"; AUTOMAPMNU_SHOWTHINGSPRITES = "Show things as sprites";
AUTOMAPMNU_PTOVERLAY = "Overlay portals"; AUTOMAPMNU_PTOVERLAY = "Overlay portals";
AUTOMAPMNU_EMPTYSPACEMARGIN = "Empty space margin";
// Automap Controls // Automap Controls
MAPCNTRLMNU_TITLE = "CUSTOMIZE MAP CONTROLS"; MAPCNTRLMNU_TITLE = "CUSTOMIZE MAP CONTROLS";

View file

@ -1091,6 +1091,7 @@ OptionMenu AutomapOptions protected
Option "$AUTOMAPMNU_TEXTURED", "am_textured", "OnOff" Option "$AUTOMAPMNU_TEXTURED", "am_textured", "OnOff"
Option "$AUTOMAPMNU_FOLLOW", "am_followplayer", "OnOff" Option "$AUTOMAPMNU_FOLLOW", "am_followplayer", "OnOff"
Option "$AUTOMAPMNU_PTOVERLAY", "am_portaloverlay", "OnOff" Option "$AUTOMAPMNU_PTOVERLAY", "am_portaloverlay", "OnOff"
Slider "$AUTOMAPMNU_EMPTYSPACEMARGIN", "am_emptyspacemargin", 0, 50, 5, 0
StaticText " " StaticText " "
Option "$AUTOMAPMNU_SHOWITEMS", "am_showitems", "OnOff" Option "$AUTOMAPMNU_SHOWITEMS", "am_showitems", "OnOff"
Option "$AUTOMAPMNU_SHOWMONSTERS", "am_showmonsters", "OnOff" Option "$AUTOMAPMNU_SHOWMONSTERS", "am_showmonsters", "OnOff"