Skip to content

Commit

Permalink
- add cvar 'cl_disableinvertedcolormap' - changes the invulnerability… (
Browse files Browse the repository at this point in the history
#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 a3741ab
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/d_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
37 changes: 36 additions & 1 deletion src/r_data/colormaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/r_data/colormaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions wadsrc/static/menudef.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit a3741ab

Please sign in to comment.