diff --git a/src/d_main.cpp b/src/d_main.cpp index 36b74f033f..134c848809 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -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); + } } diff --git a/src/g_cvars.cpp b/src/g_cvars.cpp index 5ac6d9fc9d..cff4ec1d83 100644 --- a/src/g_cvars.cpp +++ b/src/g_cvars.cpp @@ -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(); } diff --git a/src/g_level.cpp b/src/g_level.cpp index 909e73cdb8..6424f118c2 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -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)