- add cvar 'cl_customizeinvulmap' - 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

# Conflicts:
#	src/d_main.cpp
This commit is contained in:
Rachael Alexanderson 2019-11-26 07:46:18 -05:00 committed by drfrag
parent 75a8091002
commit ed654150eb
4 changed files with 45 additions and 2 deletions

View file

@ -122,6 +122,7 @@
#include "s_music.h"
EXTERN_CVAR(Bool, hud_althud)
EXTERN_CVAR(Bool, cl_customizeinvulmap)
void DrawHUD();
void D_DoAnonStats();
@ -2695,6 +2696,10 @@ void D_DoomMain (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

View file

@ -55,6 +55,22 @@
#include "r_utility.h"
#include "r_renderer.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;
@ -175,7 +191,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
@ -253,6 +269,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)

View file

@ -3,7 +3,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

View file

@ -903,6 +903,9 @@ OptionMenu "VideoOptions" protected
Slider "$DSPLYMNU_SATURATION", "vid_saturation", -3.0, 3.0, 0.25, 2
Option "$DSPLYMNU_HWGAMMA", "vid_hwgamma", "HWGammaModes"
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"