- added ability to customize font of automap marks

Set am_markfont CVAR to a desired font name
Use am_markcolor to select a text color, has no effect with the default font, AMMNUMx

# Conflicts:
#	src/am_map.cpp
This commit is contained in:
alexey.lysiuk 2019-02-13 13:05:31 +02:00 committed by drfrag
parent 5b78d7faaa
commit f5f1564f69
3 changed files with 41 additions and 3 deletions

View file

@ -870,6 +870,9 @@ void AM_minOutWindowScale ();
CVAR(Bool, am_followplayer, true, CVAR_ARCHIVE)
CVAR(Bool, am_portaloverlay, true, CVAR_ARCHIVE)
static const char *const DEFAULT_FONT_NAME = "AMMNUMx";
CVAR(String, am_markfont, DEFAULT_FONT_NAME, CVAR_ARCHIVE)
CVAR(Int, am_markcolor, CR_GREY, CVAR_ARCHIVE)
CCMD(am_togglefollow)
{
@ -1062,7 +1065,9 @@ void AM_restoreScaleAndLoc ()
bool AM_addMark ()
{
if (marknums[0].isValid())
// Add a mark when default font is selected and its textures (AMMNUM?)
// are loaded. Mark is always added when custom font is selected
if (stricmp(*am_markfont, DEFAULT_FONT_NAME) != 0 || marknums[0].isValid())
{
markpoints[markpointnum].x = m_x + m_w/2;
markpoints[markpointnum].y = m_y + m_h/2;
@ -3130,12 +3135,29 @@ static void DrawMarker (FTexture *tex, double x, double y, int yadjust,
void AM_drawMarks ()
{
FFont* font;
bool fontloaded = false;
for (int i = 0; i < AM_NUMMARKPOINTS; i++)
{
if (markpoints[i].x != -1)
{
DrawMarker (TexMan(marknums[i]), markpoints[i].x, markpoints[i].y, -3, 0,
1, 1, 0, 1, 0, LegacyRenderStyles[STYLE_Normal]);
if (!fontloaded)
{
font = stricmp(*am_markfont, DEFAULT_FONT_NAME) == 0 ? nullptr : V_GetFont(am_markfont);
fontloaded = true;
}
if (font == nullptr)
{
DrawMarker (TexMan(marknums[i]), markpoints[i].x, markpoints[i].y, -3, 0,
1, 1, 0, 1, 0, LegacyRenderStyles[STYLE_Normal]);
}
else
{
char numstr[2] = { char('0' + i), 0 };
screen->DrawText(font, am_markcolor, CXMTOF(markpoints[i].x), CYMTOF(markpoints[i].y), numstr, TAG_DONE);
}
}
}
}

View file

@ -2007,6 +2007,8 @@ AUTOMAPMNU_SHOWTRIGGERLINES = "Show trigger lines";
AUTOMAPMNU_SHOWTHINGSPRITES = "Show things as sprites";
AUTOMAPMNU_PTOVERLAY = "Overlay portals";
AUTOMAPMNU_EMPTYSPACEMARGIN = "Empty space margin";
AUTOMAPMNU_MARKFONT = "Mark font";
AUTOMAPMNU_MARKCOLOR = "Mark color";
// Automap Controls
MAPCNTRLMNU_TITLE = "CUSTOMIZE MAP CONTROLS";
@ -2490,6 +2492,9 @@ OPTVAL_VTAVANILLA = "Auto (Vanilla Preferred)";
OPTVAL_SCALENEAREST = "Scaled (Nearest)";
OPTVAL_SCALELINEAR = "Scaled (Linear)";
OPTVAL_LETTERBOX = "Letterbox";
OPTVAL_SMALL = "Small";
OPTVAL_LARGE = "Large";
OPTVAL_CONSOLE = "Console";
// Colors
C_BRICK = "\cabrick";

View file

@ -1083,6 +1083,14 @@ OptionValue MapTriggers
2, "$OPTVAL_ON"
}
OptionString MapMarkFont
{
"AMMNUMx", "$OPTVAL_DEFAULT"
"SmallFont", "$OPTVAL_SMALL"
"BigFont", "$OPTVAL_LARGE"
"ConsoleFont", "$OPTVAL_CONSOLE"
}
OptionMenu AutomapOptions protected
{
Title "$AUTOMAPMNU_TITLE"
@ -1109,6 +1117,9 @@ OptionMenu AutomapOptions protected
Option "$AUTOMAPMNU_SHOWKEYS", "am_showkeys", "OnOff"
Option "$AUTOMAPMNU_SHOWTRIGGERLINES", "am_showtriggerlines", "MapTriggers"
Option "$AUTOMAPMNU_SHOWTHINGSPRITES", "am_showthingsprites", "STSTypes"
StaticText " "
Option "$AUTOMAPMNU_MARKFONT", "am_markfont", "MapMarkFont"
Option "$AUTOMAPMNU_MARKCOLOR", "am_markcolor", "TextColors"
}
//-------------------------------------------------------------------------------------------