From f4becd06d520b52d89fc611f17da881304cb121f Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 16 Jun 2014 23:17:11 +0000 Subject: [PATCH] Instead of displaying "Unknown GRP - EDuke32", simply display "EDuke32". Much classier this way. git-svn-id: https://svn.eduke32.com/eduke32@4516 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 27 ++++++++++++++++++--------- polymer/eduke32/source/game.h | 1 + polymer/eduke32/source/gamedef.c | 3 +-- polymer/eduke32/source/premap.c | 13 +++++++++++-- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 89e85700f..f01991f07 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -10373,6 +10373,19 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) } } +void G_UpdateAppTitle(void) +{ + if (g_gameNamePtr) + { + Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr); + wm_setapptitle(tempbuf); + } + else + { + wm_setapptitle(APPNAME); + } +} + static void G_DisplayLogo(void) { int32_t soundanm = 0; @@ -10389,8 +10402,7 @@ static void G_DisplayLogo(void) flushperms(); nextpage(); - Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr); - wm_setapptitle(tempbuf); + G_UpdateAppTitle(); S_StopMusic(); FX_StopAllSounds(); // JBF 20031228 @@ -11034,8 +11046,7 @@ void G_BackToMenu(void) g_player[myconnectindex].ps->gm = MODE_MENU; M_ChangeMenu(MENU_MAIN); KB_FlushKeyboardQueue(); - Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr); - wm_setapptitle(tempbuf); + G_UpdateAppTitle(); } static int32_t G_EndOfLevel(void) @@ -11470,7 +11481,7 @@ int32_t app_main(int32_t argc, const char **argv) g_gameType = first->game; g_gameNamePtr = listgrps->name; } - else if (!fg) g_gameNamePtr = "Unknown GRP"; + else if (!fg) g_gameNamePtr = NULL; } #ifdef STARTUP_SETUP_WINDOW @@ -11608,8 +11619,7 @@ int32_t app_main(int32_t argc, const char **argv) // gotta set the proper title after we compile the CONs if this is the full version - Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr); - wm_setapptitle(tempbuf); + G_UpdateAppTitle(); if (g_scriptDebug) initprintf("CON debugging activated (level %d).\n",g_scriptDebug); @@ -12655,8 +12665,7 @@ void G_BonusScreen(int32_t bonusonly) if (g_networkMode == NET_DEDICATED_SERVER) return; - Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr); - wm_setapptitle(tempbuf); + G_UpdateAppTitle(); if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0]) { diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index de07b123c..462e9716a 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -372,6 +372,7 @@ void G_GameQuit(void); void G_GetCrosshairColor(void); void G_HandleLocalKeys(void); void G_HandleSpecialKeys(void); +void G_UpdateAppTitle(void); void G_PrintGameQuotes(int32_t snum); //void G_SE40(int32_t smoothratio); void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b); diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 7e1bed000..ac17dee79 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -5543,8 +5543,7 @@ repeatcase: } gamename[i] = '\0'; g_gameNamePtr = Xstrdup(gamename); - Bsprintf(tempbuf,"%s - " APPNAME,g_gameNamePtr); - wm_setapptitle(tempbuf); + G_UpdateAppTitle(); } continue; diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index f2808ab82..978a88ec2 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -1865,9 +1865,18 @@ int32_t G_EnterLevel(int32_t g) if (G_HaveUserMap()) { Bstrcpy(levname, boardfilename); - Bsprintf(apptitle,"%s - %s - " APPNAME,levname,g_gameNamePtr); + if (g_gameNamePtr) + Bsprintf(apptitle,"%s - %s - " APPNAME,levname,g_gameNamePtr); + else + Bsprintf(apptitle,"%s - " APPNAME,levname); + } + else + { + if (g_gameNamePtr) + Bsprintf(apptitle,"%s - %s - " APPNAME,MapInfo[mii].name,g_gameNamePtr); + else + Bsprintf(apptitle,"%s - " APPNAME,MapInfo[mii].name); } - else Bsprintf(apptitle,"%s - %s - " APPNAME,MapInfo[mii].name,g_gameNamePtr); Bstrcpy(tempbuf,apptitle); wm_setapptitle(tempbuf);