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
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_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);