From 91b31cec39b08df84c6653ca97d1226c2b4660de Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 23 Aug 2020 22:46:53 +0200 Subject: [PATCH] - fixed: hud_messages completely blocked the messages, even from going to the console. It should only block the on-screen notification display, which the backend already implements. The game code should not check this CVAR again. --- source/core/gamecvars.cpp | 5 +---- source/core/gamecvars.h | 2 +- source/games/duke/src/game_misc.cpp | 6 +++--- source/sw/src/sprite.cpp | 13 ++++++++----- source/sw/src/text.cpp | 22 +--------------------- 5 files changed, 14 insertions(+), 34 deletions(-) diff --git a/source/core/gamecvars.cpp b/source/core/gamecvars.cpp index 948cf9484..c03630f3e 100644 --- a/source/core/gamecvars.cpp +++ b/source/core/gamecvars.cpp @@ -229,10 +229,7 @@ CVARD(Bool, hud_showmapname, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disab CVARD(Bool, hud_position, false, CVAR_ARCHIVE, "aligns the status bar to the bottom/top") CVARD(Bool, hud_bgstretch, false, CVAR_ARCHIVE|CVAR_FRONTEND_DUKELIKE, "enable/disable background image stretching in wide resolutions") CVARD(Int, hud_messagetime, 120, CVAR_ARCHIVE|CVAR_FRONTEND_DUKELIKE, "length of time to display multiplayer chat messages") -CUSTOM_CVARD(Int, hud_messages, 1, CVAR_ARCHIVE, "enable/disable showing messages") -{ - if (self < 0 || self > 2) self = 1; -} +CVARD(Bool, hud_messages, 1, CVAR_ARCHIVE, "enable/disable showing messages") // This cannot be done with the 'toggle' CCMD because it needs to control itself when to output the message CCMD (togglemessages) diff --git a/source/core/gamecvars.h b/source/core/gamecvars.h index 913fb07b3..8e68e06fb 100644 --- a/source/core/gamecvars.h +++ b/source/core/gamecvars.h @@ -63,7 +63,7 @@ EXTERN_CVAR(Int, hud_messagetime) EXTERN_CVAR(Bool, hud_glowingquotes) EXTERN_CVAR(Int, hud_textscale) EXTERN_CVAR(Int, hud_weaponscale) -EXTERN_CVAR(Int, hud_messages) +EXTERN_CVAR(Bool, hud_messages) EXTERN_CVAR(Int, althud_numbertile) EXTERN_CVAR(Int, althud_numberpal) diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 8ff35e184..243b48c48 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -139,14 +139,14 @@ void GameInterface::ExitFromMenu() //--------------------------------------------------------------------------- // -// This now redirects the messagew to the console's notification display +// This now redirects the messages to the console's notification display // which has all the features to reasonably do this in Duke style. // //--------------------------------------------------------------------------- void FTA(int q, struct player_struct* p) { - if (hud_messages == 0 || q < 0 || !(p->gm & MODE_GAME)) + if (q < 0 || !(p->gm & MODE_GAME)) return; if (p->ftq != q || (totalclock - p->ftt > TICRATE && q != QUOTE_DEAD)) @@ -156,7 +156,7 @@ void FTA(int q, struct player_struct* p) if (p == &ps[screenpeek] && qu[0] != '\0') { #if 0 - if (q >= 70 && q <= 72 && hud_messages == 2) + if (q >= 70 && q <= 72) { // Todo: redirect this to a centered message (these are "need a key" messages) } diff --git a/source/sw/src/sprite.cpp b/source/sw/src/sprite.cpp index dd94777f4..af8cb4435 100644 --- a/source/sw/src/sprite.cpp +++ b/source/sw/src/sprite.cpp @@ -5720,15 +5720,18 @@ KeyMain: PlayerUpdateHealth(pp, InventoryDecls[InvDecl_Booster].amount); // This is for health // over 100% // Say something witty - if (pp == Player+myconnectindex && hud_messages) + if (pp == Player+myconnectindex) { int cookie = (adult_lockout)? STD_RANDOM_RANGE(10) : STD_RANDOM_RANGE(MAX_FORTUNES); // print to the console, and the user quote display. FStringf msg("%s %s", GStrings("TXTS_FORTUNE"), quoteMgr.GetQuote(QUOTE_COOKIE + cookie)); - Printf(TEXTCOLOR_SAPPHIRE "%s\n", msg.GetChars()); - strncpy(pp->cookieQuote, msg, 255); - pp->cookieQuote[255] = 0; - pp->cookieTime = 540; + Printf(PRINT_NONOTIFY, TEXTCOLOR_SAPPHIRE "%s\n", msg.GetChars()); + if (hud_messages) + { + strncpy(pp->cookieQuote, msg, 255); + pp->cookieQuote[255] = 0; + pp->cookieTime = 540; + } } SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup diff --git a/source/sw/src/text.cpp b/source/sw/src/text.cpp index 277701b60..c59d4d7ec 100644 --- a/source/sw/src/text.cpp +++ b/source/sw/src/text.cpp @@ -167,28 +167,8 @@ void MNU_DrawSmallString(int x, int y, const char* string, int shade, int pal, i void PutStringInfo(PLAYERp pp, const char *string) { - if (pp-Player == myconnectindex && hud_messages) + if (pp-Player == myconnectindex) Printf(PRINT_MEDIUM|PRINT_NOTIFY, "%s\n", string); // Put it in the console too } - -#if 0 // kept as a reminder to reimplement a 'native' looking display option in the backend -void PutStringInfoLine(PLAYERp pp, const char *string) -{ - short GlobInfoStringTime = TEXT_INFO_TIME; - - short x,y; - short w,h; - - if (pp-Player != myconnectindex) - return; - - x = 160; - y = TEXT_INFO_LINE(0); - - PutStringTimer(pp, x, y, string, GlobInfoStringTime); - -} -#endif - END_SW_NS