From a3741abbf359537998f5532f9afcc5d36059c3ed Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson <18584402+madame-rachelle@users.noreply.github.com> Date: Tue, 26 Nov 2019 07:46:18 -0500 Subject: [PATCH] =?UTF-8?q?-=20add=20cvar=20'cl=5Fdisableinvertedcolormap'?= =?UTF-8?q?=20-=20changes=20the=20invulnerability=E2=80=A6=20(#972)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * - add cvar 'cl_disableinvertedcolormap' - changes the invulnerability sphere to instead be a regular desaturated colormap that transitions from deep blue to pale yellow * - add menu option for cl_disableinvertedcolormap * - added customization for invulnerability colormap * - fixed custom colormap being calculated incorrectly * - disable custom invulnerability map before the main game loop --- src/d_main.cpp | 5 +++++ src/r_data/colormaps.cpp | 37 ++++++++++++++++++++++++++++++++++++- src/r_data/colormaps.h | 2 +- wadsrc/static/menudef.txt | 3 +++ 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index d12b93ad58..73cc1927a1 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -106,6 +106,7 @@ EXTERN_CVAR(Bool, hud_althud) EXTERN_CVAR(Int, vr_mode) +EXTERN_CVAR(Bool, cl_customizeinvulmap) void DrawHUD(); void D_DoAnonStats(); void I_DetectOS(); @@ -2752,6 +2753,10 @@ static int D_DoomMain_Internal (void) C_RunDelayedCommands(); gamestate = GS_STARTUP; + // enable custom invulnerability map here + if (cl_customizeinvulmap) + R_InitColormaps(true); + if (!restart) { // start the apropriate game based on parms diff --git a/src/r_data/colormaps.cpp b/src/r_data/colormaps.cpp index 5c5ed6a3b2..b9944c765b 100644 --- a/src/r_data/colormaps.cpp +++ b/src/r_data/colormaps.cpp @@ -44,6 +44,22 @@ #include "colormaps.h" #include "templates.h" +CUSTOM_CVAR(Bool, cl_customizeinvulmap, false, CVAR_ARCHIVE|CVAR_NOINITCALL) +{ + R_InitColormaps(true); +} +CUSTOM_CVAR(Color, cl_custominvulmapcolor1, 0x00001a, CVAR_ARCHIVE|CVAR_NOINITCALL) +{ + if (cl_customizeinvulmap) + R_InitColormaps(true); +} +CUSTOM_CVAR(Color, cl_custominvulmapcolor2, 0xa6a67a, CVAR_ARCHIVE|CVAR_NOINITCALL) +{ + if (cl_customizeinvulmap) + R_InitColormaps(true); +} + + TArray fakecmaps; TArray SpecialColormaps; @@ -164,7 +180,7 @@ void R_DeinitColormaps () // //========================================================================== -void R_InitColormaps () +void R_InitColormaps (bool allowCustomColormap) { // [RH] Try and convert BOOM colormaps into blending values. // This is a really rough hack, but it's better than @@ -242,6 +258,25 @@ void R_InitColormaps () } } + // some of us really don't like Doom's idea of an invulnerability sphere colormap + // this hack will override that + if (allowCustomColormap && cl_customizeinvulmap) + { + uint32_t color1 = cl_custominvulmapcolor1; + uint32_t color2 = cl_custominvulmapcolor2; + float r1 = (float)((color1 & 0xff0000) >> 16) / 128.f; + float g1 = (float)((color1 & 0x00ff00) >> 8) / 128.f; + float b1 = (float)((color1 & 0x0000ff) >> 0) / 128.f; + float r2 = (float)((color2 & 0xff0000) >> 16) / 128.f; + float g2 = (float)((color2 & 0x00ff00) >> 8) / 128.f; + float b2 = (float)((color2 & 0x0000ff) >> 0) / 128.f; + SpecialColormapParms[0] = {{r1, g1, b1}, {r2, g2, b2}}; + } + else + { + SpecialColormapParms[0] = {{1.0, 1.0, 1.0}, {0.0, 0.0, 0.0}}; + } + // build default special maps (e.g. invulnerability) for (unsigned i = 0; i < countof(SpecialColormapParms); ++i) diff --git a/src/r_data/colormaps.h b/src/r_data/colormaps.h index cb57f8b796..97d4d89028 100644 --- a/src/r_data/colormaps.h +++ b/src/r_data/colormaps.h @@ -5,7 +5,7 @@ struct lightlist_t; -void R_InitColormaps (); +void R_InitColormaps (bool allowCustomColormap = false); void R_DeinitColormaps (); uint32_t R_ColormapNumForName(const char *name); // killough 4/4/98 diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index fa46b7307b..d4d325e05f 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -925,6 +925,9 @@ OptionMenu "VideoOptions" protected Slider "$DSPLYMNU_CONTRAST", "vid_contrast", 0.1, 3.0, 0.1 Slider "$DSPLYMNU_SATURATION", "vid_saturation", -3.0, 3.0, 0.25, 2 StaticText " " + Option "$DSPLYMNU_CUSTOMINVERTMAP", "cl_customizeinvulmap", "OnOff" + ColorPicker "$DSPLYMNU_CUSTOMINVERTC1", "cl_custominvulmapcolor1" + ColorPicker "$DSPLYMNU_CUSTOMINVERTC2", "cl_custominvulmapcolor2" Option "$DSPLYMNU_WIPETYPE", "wipetype", "Wipes" Option "$DSPLYMNU_DRAWFUZZ", "r_drawfuzz", "Fuzziness" Option "$DSPLYMNU_OLDTRANS", "r_vanillatrans", "VanillaTrans"