Skip to content
Permalink
Browse files

- add cvar 'cl_disableinvertedcolormap' - changes the invulnerability… (

#972)

* - 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
  • Loading branch information
madame-rachelle committed Nov 26, 2019
1 parent 20d3752 commit a3741abbf359537998f5532f9afcc5d36059c3ed
Showing with 45 additions and 2 deletions.
  1. +5 −0 src/d_main.cpp
  2. +36 −1 src/r_data/colormaps.cpp
  3. +1 −1 src/r_data/colormaps.h
  4. +3 −0 wadsrc/static/menudef.txt
@@ -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
@@ -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<FakeCmap> fakecmaps;

TArray<FSpecialColormap> 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)
@@ -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
@@ -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"

0 comments on commit a3741ab

Please sign in to comment.
You can’t perform that action at this time.