2017-03-15 21:04:23 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
2017-03-15 23:56:03 +00:00
|
|
|
#include "g_levellocals.h"
|
2017-03-15 21:04:23 +00:00
|
|
|
|
|
|
|
struct FSWColormap
|
|
|
|
{
|
|
|
|
uint8_t *Maps = nullptr;
|
|
|
|
PalEntry Color = 0xffffffff;
|
|
|
|
PalEntry Fade = 0xff000000;
|
|
|
|
int Desaturate = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FDynamicColormap : FSWColormap
|
|
|
|
{
|
|
|
|
void ChangeFade (PalEntry fadecolor);
|
|
|
|
void ChangeColor (PalEntry lightcolor, int desaturate);
|
|
|
|
void ChangeColorFade (PalEntry lightcolor, PalEntry fadecolor);
|
|
|
|
void ChangeFogDensity(int newdensity);
|
|
|
|
void BuildLights ();
|
|
|
|
static void RebuildAllLights();
|
|
|
|
|
|
|
|
FDynamicColormap *Next;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern FSWColormap realcolormaps; // [RH] make the colormaps externally visible
|
|
|
|
|
|
|
|
extern FDynamicColormap NormalLight;
|
|
|
|
extern FDynamicColormap FullNormalLight;
|
|
|
|
extern bool NormalLightHasFixedLights;
|
|
|
|
extern TArray<FSWColormap> SpecialSWColormaps;
|
|
|
|
|
|
|
|
void InitSWColorMaps();
|
|
|
|
FDynamicColormap *GetSpecialLights (PalEntry lightcolor, PalEntry fadecolor, int desaturate);
|
|
|
|
void SetDefaultColormap (const char *name);
|
|
|
|
|
|
|
|
|
|
|
|
// Give the compiler a strong hint we want these functions inlined:
|
|
|
|
#ifndef FORCEINLINE
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define FORCEINLINE __forceinline
|
|
|
|
#elif defined(__GNUC__)
|
|
|
|
#define FORCEINLINE __attribute__((always_inline)) inline
|
|
|
|
#else
|
|
|
|
#define FORCEINLINE inline
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// MSVC needs the forceinline here.
|
2017-03-15 23:56:03 +00:00
|
|
|
FORCEINLINE FDynamicColormap *GetColorTable(const FColormap &cm, PalEntry SpecialColor = 0xffffff, bool forsprites = false)
|
2017-03-15 21:04:23 +00:00
|
|
|
{
|
2017-03-15 23:56:03 +00:00
|
|
|
PalEntry c;
|
|
|
|
if (!forsprites || !(level.flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING)) c = SpecialColor.Modulate(cm.LightColor);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
c = cm.LightColor;
|
|
|
|
c.Decolorize();
|
|
|
|
c = SpecialColor.Modulate(c);
|
|
|
|
}
|
2017-05-28 21:57:09 +00:00
|
|
|
|
|
|
|
// First colormap is the default Doom colormap.
|
|
|
|
// testcolor and testfade CCMDs modifies the first colormap, so we have to do the check without looking at the actual values stored in NormalLight.
|
|
|
|
if (c == PalEntry(255, 255, 255) && cm.FadeColor == 0 && cm.Desaturation == 0)
|
|
|
|
return &NormalLight;
|
2017-03-15 21:04:23 +00:00
|
|
|
|
2017-03-15 22:24:53 +00:00
|
|
|
return GetSpecialLights(c, cm.FadeColor, cm.Desaturation);
|
2017-03-15 21:04:23 +00:00
|
|
|
}
|