Skip to content

Commit b7d6f0b

Browse files
DyNaM1KkRicardoLuis0
authored andcommitted
Added am_showlevelname CVar
Allows controlling the visibility of the level name on the automap.
1 parent 880ebfd commit b7d6f0b

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/am_map.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ CVAR(Bool, am_showmonsters, true, CVAR_ARCHIVE);
170170
CVAR(Bool, am_showitems, false, CVAR_ARCHIVE);
171171
CVAR(Bool, am_showtime, true, CVAR_ARCHIVE);
172172
CVAR(Bool, am_showtotaltime, false, CVAR_ARCHIVE);
173+
CVAR(Bool, am_showlevelname, true, CVAR_ARCHIVE);
173174
CVAR(Int, am_colorset, 0, CVAR_ARCHIVE);
174175
CVAR(Bool, am_customcolors, true, CVAR_ARCHIVE);
175176
CVAR(Int, am_map_secrets, 1, CVAR_ARCHIVE);

src/g_statusbar/shared_sbar.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ EXTERN_CVAR (Bool, am_showsecrets)
8585
EXTERN_CVAR (Bool, am_showitems)
8686
EXTERN_CVAR (Bool, am_showtime)
8787
EXTERN_CVAR (Bool, am_showtotaltime)
88+
EXTERN_CVAR (Bool, am_showlevelname)
8889
EXTERN_CVAR(Bool, inter_subtitles)
8990
EXTERN_CVAR(Bool, ui_screenborder_classic_scaling)
9091

@@ -598,6 +599,8 @@ void DBaseStatusBar::DoDrawAutomapHUD(int crdefault, int highlight)
598599
}
599600

600601
FormatMapName(primaryLevel, crdefault, &textbuffer);
602+
if (textbuffer.IsEmpty())
603+
return;
601604

602605
if (!generic_ui)
603606
{

src/scripting/vmthunks.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -2282,6 +2282,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetSpotState, GetSpotState)
22822282
//---------------------------------------------------------------------------
22832283

22842284
EXTERN_CVAR(Int, am_showmaplabel)
2285+
EXTERN_CVAR(Bool, am_showlevelname)
22852286

22862287
void FormatMapName(FLevelLocals *self, int cr, FString *result)
22872288
{
@@ -2295,13 +2296,19 @@ void FormatMapName(FLevelLocals *self, int cr, FString *result)
22952296
if (self->info->MapLabel.IsNotEmpty())
22962297
{
22972298
if (self->info->MapLabel.Compare("*"))
2298-
*result << self->info->MapLabel << ": ";
2299+
*result << self->info->MapLabel;
22992300
}
23002301
else if (am_showmaplabel == 1 || (am_showmaplabel == 2 && !ishub))
23012302
{
2302-
*result << self->MapName << ": ";
2303+
*result << self->MapName;
2304+
}
2305+
2306+
if (am_showlevelname)
2307+
{
2308+
if (!result->IsEmpty())
2309+
*result << ": ";
2310+
*result << mapnamecolor << self->LevelName;
23032311
}
2304-
*result << mapnamecolor << self->LevelName;
23052312
}
23062313

23072314
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, FormatMapName, FormatMapName)

0 commit comments

Comments
 (0)