- update window title with current level name

This commit is contained in:
Rachael Alexanderson 2019-12-25 09:52:57 -05:00
parent 9858ed70b0
commit 2e467bd239
3 changed files with 29 additions and 10 deletions

View File

@ -144,6 +144,7 @@ void ParseGLDefs();
void DrawFullscreenSubtitle(const char *text);
void D_Cleanup();
void FreeSBarInfoScript();
void I_UpdateWindowTitle();
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
@ -161,7 +162,6 @@ EXTERN_CVAR (Bool, lookstrafe)
EXTERN_CVAR (Int, screenblocks)
EXTERN_CVAR (Bool, sv_cheats)
EXTERN_CVAR (Bool, sv_unlimited_pickup)
EXTERN_CVAR (Bool, I_FriendlyWindowTitle)
EXTERN_CVAR (Bool, r_drawplayersprites)
EXTERN_CVAR (Bool, show_messages)
@ -2848,8 +2848,7 @@ static int D_DoomMain_Internal (void)
D_DoAnonStats();
if (I_FriendlyWindowTitle)
I_SetWindowTitle(DoomStartupInfo.Name.GetChars());
I_UpdateWindowTitle();
D_DoomLoop (); // this only returns if a 'restart' CCMD is given.
//
@ -3086,11 +3085,27 @@ DEFINE_FIELD_X(InputEventData, event_t, data3)
DEFINE_FIELD_X(InputEventData, event_t, x)
DEFINE_FIELD_X(InputEventData, event_t, y)
CUSTOM_CVAR(Bool, I_FriendlyWindowTitle, true, CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_NOINITCALL)
CUSTOM_CVAR(Int, I_FriendlyWindowTitle, 1, CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_NOINITCALL)
{
if (self)
I_SetWindowTitle(DoomStartupInfo.Name.GetChars());
else
I_SetWindowTitle(NULL);
I_UpdateWindowTitle();
}
void I_UpdateWindowTitle()
{
switch (I_FriendlyWindowTitle)
{
case 1:
if (level.LevelName && level.LevelName.GetChars()[0])
{
FString titlestr;
titlestr.Format("%s - %s", level.LevelName, DoomStartupInfo.Name.GetChars());
I_SetWindowTitle(titlestr.GetChars());
break;
}
case 2:
I_SetWindowTitle(DoomStartupInfo.Name.GetChars());
break;
default:
I_SetWindowTitle(NULL);
}
}

View File

@ -41,6 +41,8 @@
#include "v_font.h"
#include "utf8.h"
void I_UpdateWindowTitle();
CVAR (Bool, cl_spreaddecals, true, CVAR_ARCHIVE)
CVAR(Bool, var_pushers, true, CVAR_SERVERINFO);
CVAR(Bool, gl_cachenodes, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
@ -201,4 +203,5 @@ CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOB
if (Level->info != nullptr) Level->LevelName = Level->info->LookupLevelName();
}
UpdateGenericUI(ui_generic);
I_UpdateWindowTitle();
}

View File

@ -110,6 +110,7 @@ extern uint8_t globalfreeze, globalchangefreeze;
#define PCLS_ID MAKE_ID('p','c','L','s')
void G_VerifySkill();
void I_UpdateWindowTitle();
CUSTOM_CVAR(Bool, gl_brightfog, false, CVAR_ARCHIVE | CVAR_NOINITCALL)
{
@ -1060,7 +1061,7 @@ void G_DoLoadLevel(const FString &nextmapname, int position, bool autosave, bool
C_FlushDisplay();
P_ResetSightCounters(true);
I_UpdateWindowTitle();
}
void FLevelLocals::DoLoadLevel(const FString &nextmapname, int position, bool autosave, bool newGame)