From 94892cc1f8b5aeba85e1b015c8fdb3954696ef59 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 25 Oct 2020 15:06:06 +0100 Subject: [PATCH] - set up the main menu background as default console background for Duke and its offspring games. --- source/common/2d/v_2ddrawer.cpp | 4 ++-- source/common/2d/v_2ddrawer.h | 2 +- source/common/console/c_console.cpp | 20 +++++++++++++++----- source/common/console/c_console.h | 3 ++- source/common/engine/printf.h | 2 +- source/games/duke/src/game.cpp | 1 + 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/source/common/2d/v_2ddrawer.cpp b/source/common/2d/v_2ddrawer.cpp index 22d8565a4..a3b3bd12d 100644 --- a/source/common/2d/v_2ddrawer.cpp +++ b/source/common/2d/v_2ddrawer.cpp @@ -753,14 +753,14 @@ float F2DDrawer::GetClassicFlatScalarHeight() return sh; } -void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, int local_origin, double flatscale, PalEntry color) +void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, int local_origin, double flatscale, PalEntry color, ERenderStyle style) { float fU1, fU2, fV1, fV2; RenderCommand dg; dg.mType = DrawTypeTriangles; - dg.mRenderStyle = DefaultRenderStyle(); + dg.mRenderStyle = LegacyRenderStyles[style]; dg.mTexture = src; dg.mVertCount = 4; dg.mTexture = src; diff --git a/source/common/2d/v_2ddrawer.h b/source/common/2d/v_2ddrawer.h index 1087ec63e..2e02e9160 100644 --- a/source/common/2d/v_2ddrawer.h +++ b/source/common/2d/v_2ddrawer.h @@ -190,7 +190,7 @@ public: void AddPoly(FGameTexture* img, FVector4 *vt, size_t vtcount, unsigned int *ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2); void FillPolygon(int* rx1, int* ry1, int* xb1, int32_t npoints, int picnum, int palette, int shade, int props, const FVector2& xtex, const FVector2& ytex, const FVector2& otex, int clipx1, int clipy1, int clipx2, int clipy2); - void AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, int local_origin = false, double flatscale = 1.0, PalEntry color = 0xffffffff); + void AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, int local_origin = false, double flatscale = 1.0, PalEntry color = 0xffffffff, ERenderStyle rs = STYLE_Normal); void AddColorOnlyQuad(int left, int top, int width, int height, PalEntry color, FRenderStyle *style = nullptr, bool prepend = false); void ClearScreen(PalEntry color = 0xff000000); diff --git a/source/common/console/c_console.cpp b/source/common/console/c_console.cpp index eff9db322..52147d162 100644 --- a/source/common/console/c_console.cpp +++ b/source/common/console/c_console.cpp @@ -89,6 +89,7 @@ void C_SetNotifyFontScale(double scale) FConsoleBuffer *conbuffer; static FTextureID conback; +static FTextureID conflat; static uint32_t conshade; static bool conline; @@ -211,15 +212,16 @@ CUSTOM_CVAR (Int, msgmidcolor2, CR_BROWN, CVAR_ARCHIVE) setmsgcolor (PRINTLEVELS+1, self); } -void C_InitConback() +void C_InitConback(FTextureID fallback, bool tile, double brightness) { conback = TexMan.CheckForTexture ("CONBACK", ETextureType::MiscPatch); - + conflat = fallback; if (!conback.isValid()) { conback.SetInvalid(); - conshade = MAKEARGB(175,0,0,0); + conshade = MAKEARGB(uint8_t(255 - 60*brightness),0,0,0); conline = true; + if (!tile) conback = fallback; } else { @@ -612,8 +614,16 @@ void C_DrawConsole () } else { - PalEntry pe((uint8_t)(con_alpha * 255), 0, 0, 0); - twod->AddColorOnlyQuad(0, 0, screen->GetWidth(), visheight, pe); + if (conflat.isValid()) + { + PalEntry pe((uint8_t(255 * con_alpha)), 64, 64, 64); + twod->AddFlatFill(0, visheight - screen->GetHeight(), screen->GetWidth(), visheight, TexMan.GetGameTexture(conflat), 1, CleanXfac, pe, STYLE_Shaded); + } + else + { + PalEntry pe((uint8_t)(con_alpha * 255), 0, 0, 0); + twod->AddColorOnlyQuad(0, 0, screen->GetWidth(), visheight, pe); + } } if (conline && visheight < screen->GetHeight()) diff --git a/source/common/console/c_console.h b/source/common/console/c_console.h index b91ba3cee..2d79992bf 100644 --- a/source/common/console/c_console.h +++ b/source/common/console/c_console.h @@ -37,6 +37,7 @@ #include #include "basics.h" #include "c_tabcomplete.h" +#include "textureid.h" struct event_t; @@ -57,7 +58,7 @@ extern constate_e ConsoleState; // Initialize the console void C_InitConsole (int width, int height, bool ingame); void C_DeinitConsole (); -void C_InitConback(); +void C_InitConback(FTextureID fallback, bool tile, double lightlevel = 1.); // Adjust the console for a new screen mode void C_NewModeAdjust (void); diff --git a/source/common/engine/printf.h b/source/common/engine/printf.h index 29faefd51..35efdd5fd 100644 --- a/source/common/engine/printf.h +++ b/source/common/engine/printf.h @@ -58,10 +58,10 @@ enum PRINT_TEAMCHAT, // chat messages from a teammate PRINT_LOG, // only to logfile PRINT_BOLD = 200, // What Printf_Bold used + PRINT_TYPES = 1023, // Bitmask. PRINT_NONOTIFY = 1024, // Flag - do not add to notify buffer PRINT_NOLOG = 2048, // Flag - do not print to log file PRINT_NOTIFY = 4096, // Flag - add to game-native notify display - messages without this only go to the generic notification buffer. - PRINT_TYPES = 1023, // Bitmask. }; enum diff --git a/source/games/duke/src/game.cpp b/source/games/duke/src/game.cpp index 8ca840ebd..08a282fff 100644 --- a/source/games/duke/src/game.cpp +++ b/source/games/duke/src/game.cpp @@ -336,6 +336,7 @@ void GameInterface::app_init() LoadDefinitions(); SetTileNames(); TileFiles.SetBackup(); + C_InitConback(TexMan.CheckForTexture("MENUSCREEN", ETextureType::Any), false, 0.75); if (ud.multimode > 1) {