mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-21 02:51:37 +00:00
- customized invulnerability colormap does not interfere with Powerup.ColorMap
https://forum.zdoom.org/viewtopic.php?t=66955
This commit is contained in:
parent
8ffadb64b5
commit
63df9b13d0
3 changed files with 54 additions and 25 deletions
|
@ -2763,7 +2763,7 @@ static int D_DoomMain_Internal (void)
|
|||
|
||||
// enable custom invulnerability map here
|
||||
if (cl_customizeinvulmap)
|
||||
R_InitColormaps(true);
|
||||
R_UpdateInvulnerabilityColormap();
|
||||
|
||||
if (!restart)
|
||||
{
|
||||
|
|
|
@ -57,17 +57,17 @@
|
|||
|
||||
CUSTOM_CVAR(Bool, cl_customizeinvulmap, false, CVAR_ARCHIVE|CVAR_NOINITCALL)
|
||||
{
|
||||
R_InitColormaps(true);
|
||||
R_UpdateInvulnerabilityColormap();
|
||||
}
|
||||
CUSTOM_CVAR(Color, cl_custominvulmapcolor1, 0x00001a, CVAR_ARCHIVE|CVAR_NOINITCALL)
|
||||
{
|
||||
if (cl_customizeinvulmap)
|
||||
R_InitColormaps(true);
|
||||
R_UpdateInvulnerabilityColormap();
|
||||
}
|
||||
CUSTOM_CVAR(Color, cl_custominvulmapcolor2, 0xa6a67a, CVAR_ARCHIVE|CVAR_NOINITCALL)
|
||||
{
|
||||
if (cl_customizeinvulmap)
|
||||
R_InitColormaps(true);
|
||||
R_UpdateInvulnerabilityColormap();
|
||||
}
|
||||
|
||||
|
||||
|
@ -110,6 +110,8 @@ static void FreeSpecialLights();
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static void UpdateSpecialColormap(unsigned int index, float r1, float g1, float b1, float r2, float g2, float b2);
|
||||
|
||||
int AddSpecialColormap(float r1, float g1, float b1, float r2, float g2, float b2)
|
||||
{
|
||||
// Clamp these in range for the hardware shader.
|
||||
|
@ -134,8 +136,15 @@ int AddSpecialColormap(float r1, float g1, float b1, float r2, float g2, float b
|
|||
}
|
||||
}
|
||||
|
||||
FSpecialColormap *cm = &SpecialColormaps[SpecialColormaps.Reserve(1)];
|
||||
UpdateSpecialColormap(SpecialColormaps.Reserve(1), r1, g1, b1, r2, g2, b2);
|
||||
return SpecialColormaps.Size() - 1;
|
||||
}
|
||||
|
||||
static void UpdateSpecialColormap(unsigned int index, float r1, float g1, float b1, float r2, float g2, float b2)
|
||||
{
|
||||
assert(index < SpecialColormaps.Size());
|
||||
|
||||
FSpecialColormap *cm = &SpecialColormaps[index];
|
||||
cm->ColorizeStart[0] = float(r1);
|
||||
cm->ColorizeStart[1] = float(g1);
|
||||
cm->ColorizeStart[2] = float(b1);
|
||||
|
@ -170,7 +179,6 @@ int AddSpecialColormap(float r1, float g1, float b1, float r2, float g2, float b
|
|||
MIN(255, int(g1 + i*g2)),
|
||||
MIN(255, int(b1 + i*b2)));
|
||||
}
|
||||
return SpecialColormaps.Size() - 1;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -269,25 +277,6 @@ void R_InitColormaps (bool allowCustomColormap)
|
|||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
@ -352,3 +341,41 @@ uint32_t R_BlendForColormap (uint32_t map)
|
|||
map < fakecmaps.Size() ? uint32_t(fakecmaps[map].blend) : 0;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_UpdateInvulnerabilityColormap
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void R_UpdateInvulnerabilityColormap()
|
||||
{
|
||||
float r1, g1, b1, r2, g2, b2;
|
||||
|
||||
// some of us really don't like Doom's idea of an invulnerability sphere colormap
|
||||
// this hack will override that
|
||||
if (cl_customizeinvulmap)
|
||||
{
|
||||
uint32_t color1 = cl_custominvulmapcolor1;
|
||||
uint32_t color2 = cl_custominvulmapcolor2;
|
||||
r1 = (float)((color1 & 0xff0000) >> 16) / 128.f;
|
||||
g1 = (float)((color1 & 0x00ff00) >> 8) / 128.f;
|
||||
b1 = (float)((color1 & 0x0000ff) >> 0) / 128.f;
|
||||
r2 = (float)((color2 & 0xff0000) >> 16) / 128.f;
|
||||
g2 = (float)((color2 & 0x00ff00) >> 8) / 128.f;
|
||||
b2 = (float)((color2 & 0x0000ff) >> 0) / 128.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
FSpecialColormapParameters &defaultColors = SpecialColormapParms[0];
|
||||
r1 = defaultColors.Start[0];
|
||||
g1 = defaultColors.Start[1];
|
||||
b1 = defaultColors.Start[2];
|
||||
r2 = defaultColors.End[0];
|
||||
g2 = defaultColors.End[1];
|
||||
b2 = defaultColors.End[2];
|
||||
}
|
||||
|
||||
UpdateSpecialColormap(0, r1, g1, b1, r2, g2, b2);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ struct lightlist_t;
|
|||
void R_InitColormaps (bool allowCustomColormap = false);
|
||||
void R_DeinitColormaps ();
|
||||
|
||||
void R_UpdateInvulnerabilityColormap ();
|
||||
|
||||
uint32_t R_ColormapNumForName(const char *name); // killough 4/4/98
|
||||
void R_SetDefaultColormap (const char *name); // [RH] change normal fadetable
|
||||
uint32_t R_BlendForColormap (uint32_t map); // [RH] return calculated blend for a colormap
|
||||
|
|
Loading…
Reference in a new issue