mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-13 07:57:52 +00:00
- made 'nocoloredspritelighting' a global option and also implemented it in the software renderer.
This commit is contained in:
parent
91da8aecdb
commit
3aa7687d91
17 changed files with 73 additions and 59 deletions
|
@ -142,6 +142,11 @@ struct PalEntry
|
||||||
return other;
|
return other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void Decolorize() // this for 'nocoloredspritelighting' and not the same as desaturation. The normal formula results in a value that's too dark.
|
||||||
|
{
|
||||||
|
int v = (r + g + b);
|
||||||
|
r = g = b = ((255*3) + v + v) / 9;
|
||||||
|
}
|
||||||
bool isBlack() const
|
bool isBlack() const
|
||||||
{
|
{
|
||||||
return (d & 0xffffff) == 0;
|
return (d & 0xffffff) == 0;
|
||||||
|
|
|
@ -240,6 +240,7 @@ enum ELevelFlags : unsigned int
|
||||||
LEVEL3_REMOVEITEMS = 0x00000002, // kills all INVBAR items on map change.
|
LEVEL3_REMOVEITEMS = 0x00000002, // kills all INVBAR items on map change.
|
||||||
LEVEL3_ATTENUATE = 0x00000004, // attenuate lights?
|
LEVEL3_ATTENUATE = 0x00000004, // attenuate lights?
|
||||||
LEVEL3_NOLIGHTFADE = 0x00000008, // no light fading to black.
|
LEVEL3_NOLIGHTFADE = 0x00000008, // no light fading to black.
|
||||||
|
LEVEL3_NOCOLOREDSPRITELIGHTING = 0x00000010, // draw sprites only with color-less light
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1357,6 +1357,7 @@ MapFlagHandlers[] =
|
||||||
{ "spawnwithweaponraised", MITYPE_SETFLAG2, LEVEL2_PRERAISEWEAPON, 0 },
|
{ "spawnwithweaponraised", MITYPE_SETFLAG2, LEVEL2_PRERAISEWEAPON, 0 },
|
||||||
{ "forcefakecontrast", MITYPE_SETFLAG3, LEVEL3_FORCEFAKECONTRAST, 0 },
|
{ "forcefakecontrast", MITYPE_SETFLAG3, LEVEL3_FORCEFAKECONTRAST, 0 },
|
||||||
{ "nolightfade", MITYPE_SETFLAG3, LEVEL3_NOLIGHTFADE, 0 },
|
{ "nolightfade", MITYPE_SETFLAG3, LEVEL3_NOLIGHTFADE, 0 },
|
||||||
|
{ "nocoloredspritelighting", MITYPE_SETFLAG3, LEVEL3_NOCOLOREDSPRITELIGHTING, 0 },
|
||||||
{ "nobotnodes", MITYPE_IGNORE, 0, 0 }, // Skulltag option: nobotnodes
|
{ "nobotnodes", MITYPE_IGNORE, 0, 0 }, // Skulltag option: nobotnodes
|
||||||
{ "compat_shorttex", MITYPE_COMPATFLAG, COMPATF_SHORTTEX, 0 },
|
{ "compat_shorttex", MITYPE_COMPATFLAG, COMPATF_SHORTTEX, 0 },
|
||||||
{ "compat_stairs", MITYPE_COMPATFLAG, COMPATF_STAIRINDEX, 0 },
|
{ "compat_stairs", MITYPE_COMPATFLAG, COMPATF_STAIRINDEX, 0 },
|
||||||
|
@ -1431,7 +1432,16 @@ void FMapInfoParser::ParseMapDefinition(level_info_t &info)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MITYPE_SETFLAG:
|
case MITYPE_SETFLAG:
|
||||||
|
if (!CheckAssign())
|
||||||
|
{
|
||||||
info.flags |= handler->data1;
|
info.flags |= handler->data1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sc.MustGetNumber();
|
||||||
|
if (sc.Number) info.flags |= handler->data1;
|
||||||
|
else info.flags &= ~handler->data1;
|
||||||
|
}
|
||||||
info.flags |= handler->data2;
|
info.flags |= handler->data2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1445,7 +1455,16 @@ void FMapInfoParser::ParseMapDefinition(level_info_t &info)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MITYPE_SETFLAG2:
|
case MITYPE_SETFLAG2:
|
||||||
|
if (!CheckAssign())
|
||||||
|
{
|
||||||
info.flags2 |= handler->data1;
|
info.flags2 |= handler->data1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sc.MustGetNumber();
|
||||||
|
if (sc.Number) info.flags2 |= handler->data1;
|
||||||
|
else info.flags2 &= ~handler->data1;
|
||||||
|
}
|
||||||
info.flags2 |= handler->data2;
|
info.flags2 |= handler->data2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1459,7 +1478,16 @@ void FMapInfoParser::ParseMapDefinition(level_info_t &info)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MITYPE_SETFLAG3:
|
case MITYPE_SETFLAG3:
|
||||||
|
if (!CheckAssign())
|
||||||
|
{
|
||||||
info.flags3 |= handler->data1;
|
info.flags3 |= handler->data1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sc.MustGetNumber();
|
||||||
|
if (sc.Number) info.flags3 |= handler->data1;
|
||||||
|
else info.flags3 &= ~handler->data1;
|
||||||
|
}
|
||||||
info.flags3 |= handler->data2;
|
info.flags3 |= handler->data2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -79,11 +79,6 @@ CUSTOM_CVAR(Bool, gl_notexturefill, false, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CUSTOM_CVAR(Bool, gl_nocoloredspritelighting, false, 0)
|
|
||||||
{
|
|
||||||
glset.nocoloredspritelighting = self;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gl_CreateSections();
|
void gl_CreateSections();
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -191,7 +186,6 @@ struct FGLROptions : public FOptionalMapinfoData
|
||||||
identifier = "gl_renderer";
|
identifier = "gl_renderer";
|
||||||
brightfog = false;
|
brightfog = false;
|
||||||
lightmode = -1;
|
lightmode = -1;
|
||||||
nocoloredspritelighting = -1;
|
|
||||||
notexturefill = -1;
|
notexturefill = -1;
|
||||||
skyrotatevector = FVector3(0,0,1);
|
skyrotatevector = FVector3(0,0,1);
|
||||||
skyrotatevector2 = FVector3(0,0,1);
|
skyrotatevector2 = FVector3(0,0,1);
|
||||||
|
@ -202,7 +196,6 @@ struct FGLROptions : public FOptionalMapinfoData
|
||||||
FGLROptions *newopt = new FGLROptions;
|
FGLROptions *newopt = new FGLROptions;
|
||||||
newopt->identifier = identifier;
|
newopt->identifier = identifier;
|
||||||
newopt->lightmode = lightmode;
|
newopt->lightmode = lightmode;
|
||||||
newopt->nocoloredspritelighting = nocoloredspritelighting;
|
|
||||||
newopt->notexturefill = notexturefill;
|
newopt->notexturefill = notexturefill;
|
||||||
newopt->skyrotatevector = skyrotatevector;
|
newopt->skyrotatevector = skyrotatevector;
|
||||||
newopt->skyrotatevector2 = skyrotatevector2;
|
newopt->skyrotatevector2 = skyrotatevector2;
|
||||||
|
@ -212,7 +205,6 @@ struct FGLROptions : public FOptionalMapinfoData
|
||||||
int lightmode;
|
int lightmode;
|
||||||
int brightfog;
|
int brightfog;
|
||||||
int8_t lightadditivesurfaces;
|
int8_t lightadditivesurfaces;
|
||||||
int8_t nocoloredspritelighting;
|
|
||||||
int8_t notexturefill;
|
int8_t notexturefill;
|
||||||
FVector3 skyrotatevector;
|
FVector3 skyrotatevector;
|
||||||
FVector3 skyrotatevector2;
|
FVector3 skyrotatevector2;
|
||||||
|
@ -234,20 +226,6 @@ DEFINE_MAP_OPTION(lightmode, false)
|
||||||
opt->lightmode = uint8_t(parse.sc.Number);
|
opt->lightmode = uint8_t(parse.sc.Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_MAP_OPTION(nocoloredspritelighting, false)
|
|
||||||
{
|
|
||||||
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
|
|
||||||
if (parse.CheckAssign())
|
|
||||||
{
|
|
||||||
parse.sc.MustGetNumber();
|
|
||||||
opt->nocoloredspritelighting = !!parse.sc.Number;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
opt->nocoloredspritelighting = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_MAP_OPTION(notexturefill, false)
|
DEFINE_MAP_OPTION(notexturefill, false)
|
||||||
{
|
{
|
||||||
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
|
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
|
||||||
|
@ -317,8 +295,6 @@ static void ResetOpts()
|
||||||
{
|
{
|
||||||
if (!IsLightmodeValid()) glset.lightmode = gl_lightmode;
|
if (!IsLightmodeValid()) glset.lightmode = gl_lightmode;
|
||||||
else glset.lightmode = glset.map_lightmode;
|
else glset.lightmode = glset.map_lightmode;
|
||||||
if (glset.map_nocoloredspritelighting == -1) glset.nocoloredspritelighting = gl_nocoloredspritelighting;
|
|
||||||
else glset.nocoloredspritelighting = !!glset.map_nocoloredspritelighting;
|
|
||||||
if (glset.map_notexturefill == -1) glset.notexturefill = gl_notexturefill;
|
if (glset.map_notexturefill == -1) glset.notexturefill = gl_notexturefill;
|
||||||
else glset.notexturefill = !!glset.map_notexturefill;
|
else glset.notexturefill = !!glset.map_notexturefill;
|
||||||
if (glset.map_brightfog == -1) glset.brightfog = gl_brightfog;
|
if (glset.map_brightfog == -1) glset.brightfog = gl_brightfog;
|
||||||
|
@ -336,7 +312,6 @@ void InitGLRMapinfoData()
|
||||||
glset.map_lightmode = opt->lightmode;
|
glset.map_lightmode = opt->lightmode;
|
||||||
glset.map_lightadditivesurfaces = opt->lightadditivesurfaces;
|
glset.map_lightadditivesurfaces = opt->lightadditivesurfaces;
|
||||||
glset.map_brightfog = opt->brightfog;
|
glset.map_brightfog = opt->brightfog;
|
||||||
glset.map_nocoloredspritelighting = opt->nocoloredspritelighting;
|
|
||||||
glset.map_notexturefill = opt->notexturefill;
|
glset.map_notexturefill = opt->notexturefill;
|
||||||
glset.skyrotatevector = opt->skyrotatevector;
|
glset.skyrotatevector = opt->skyrotatevector;
|
||||||
glset.skyrotatevector2 = opt->skyrotatevector2;
|
glset.skyrotatevector2 = opt->skyrotatevector2;
|
||||||
|
@ -346,7 +321,6 @@ void InitGLRMapinfoData()
|
||||||
glset.map_lightmode = -1;
|
glset.map_lightmode = -1;
|
||||||
glset.map_lightadditivesurfaces = -1;
|
glset.map_lightadditivesurfaces = -1;
|
||||||
glset.map_brightfog = -1;
|
glset.map_brightfog = -1;
|
||||||
glset.map_nocoloredspritelighting = -1;
|
|
||||||
glset.map_notexturefill = -1;
|
glset.map_notexturefill = -1;
|
||||||
glset.skyrotatevector = FVector3(0, 0, 1);
|
glset.skyrotatevector = FVector3(0, 0, 1);
|
||||||
glset.skyrotatevector2 = FVector3(0, 0, 1);
|
glset.skyrotatevector2 = FVector3(0, 0, 1);
|
||||||
|
|
|
@ -9,13 +9,11 @@
|
||||||
struct GLRenderSettings
|
struct GLRenderSettings
|
||||||
{
|
{
|
||||||
int8_t lightmode;
|
int8_t lightmode;
|
||||||
bool nocoloredspritelighting;
|
|
||||||
bool notexturefill;
|
bool notexturefill;
|
||||||
bool brightfog;
|
bool brightfog;
|
||||||
bool lightadditivesurfaces;
|
bool lightadditivesurfaces;
|
||||||
|
|
||||||
int8_t map_lightmode;
|
int8_t map_lightmode;
|
||||||
int8_t map_nocoloredspritelighting;
|
|
||||||
int8_t map_notexturefill;
|
int8_t map_notexturefill;
|
||||||
int8_t map_brightfog;
|
int8_t map_brightfog;
|
||||||
int8_t map_lightadditivesurfaces;
|
int8_t map_lightadditivesurfaces;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "gl/system/gl_system.h"
|
#include "gl/system/gl_system.h"
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
#include "r_utility.h"
|
#include "r_utility.h"
|
||||||
|
#include "g_levellocals.h"
|
||||||
|
|
||||||
#include "gl/system/gl_cvars.h"
|
#include "gl/system/gl_cvars.h"
|
||||||
#include "gl/data/gl_data.h"
|
#include "gl/data/gl_data.h"
|
||||||
|
@ -161,7 +162,7 @@ void GLWall::DrawDecal(DBaseDecal *decal)
|
||||||
|
|
||||||
FColormap p = Colormap;
|
FColormap p = Colormap;
|
||||||
|
|
||||||
if (glset.nocoloredspritelighting)
|
if (level.flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING)
|
||||||
{
|
{
|
||||||
p.Decolorize();
|
p.Decolorize();
|
||||||
}
|
}
|
||||||
|
@ -346,7 +347,7 @@ void GLWall::DrawDecal(DBaseDecal *decal)
|
||||||
thiscm.FadeColor = Colormap.FadeColor;
|
thiscm.FadeColor = Colormap.FadeColor;
|
||||||
thiscm.CopyFrom3DLight(&(*lightlist)[k]);
|
thiscm.CopyFrom3DLight(&(*lightlist)[k]);
|
||||||
mDrawer->SetColor(thisll, rel, thiscm, a);
|
mDrawer->SetColor(thisll, rel, thiscm, a);
|
||||||
if (glset.nocoloredspritelighting) thiscm.Decolorize();
|
if (level.flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING) thiscm.Decolorize();
|
||||||
mDrawer->SetFog(thisll, rel, &thiscm, RenderStyle == STYLE_Add);
|
mDrawer->SetFog(thisll, rel, &thiscm, RenderStyle == STYLE_Add);
|
||||||
gl_RenderState.SetSplitPlanes((*lightlist)[k].plane, lowplane);
|
gl_RenderState.SetSplitPlanes((*lightlist)[k].plane, lowplane);
|
||||||
|
|
||||||
|
|
|
@ -401,7 +401,7 @@ void GLSprite::Draw(int pass)
|
||||||
FColormap thiscm;
|
FColormap thiscm;
|
||||||
thiscm.CopyFog(Colormap);
|
thiscm.CopyFog(Colormap);
|
||||||
thiscm.CopyFrom3DLight(&(*lightlist)[i]);
|
thiscm.CopyFrom3DLight(&(*lightlist)[i]);
|
||||||
if (glset.nocoloredspritelighting)
|
if (level.flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING)
|
||||||
{
|
{
|
||||||
thiscm.Decolorize();
|
thiscm.Decolorize();
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,7 @@ void GLSprite::SplitSprite(sector_t * frontsector, bool translucent)
|
||||||
copySprite.lightlevel = gl_ClampLight(*lightlist[i].p_lightlevel);
|
copySprite.lightlevel = gl_ClampLight(*lightlist[i].p_lightlevel);
|
||||||
copySprite.Colormap.CopyLight(lightlist[i].extra_colormap);
|
copySprite.Colormap.CopyLight(lightlist[i].extra_colormap);
|
||||||
|
|
||||||
if (glset.nocoloredspritelighting)
|
if (level.flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING)
|
||||||
{
|
{
|
||||||
copySprite.Colormap.Decolorize();
|
copySprite.Colormap.Decolorize();
|
||||||
}
|
}
|
||||||
|
@ -940,7 +940,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
||||||
Colormap.LightColor.b = (3 * Colormap.LightColor.b + 0xff) / 4;
|
Colormap.LightColor.b = (3 * Colormap.LightColor.b + 0xff) / 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (glset.nocoloredspritelighting)
|
else if (level.flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING)
|
||||||
{
|
{
|
||||||
Colormap.Decolorize();
|
Colormap.Decolorize();
|
||||||
}
|
}
|
||||||
|
@ -1118,7 +1118,7 @@ void GLSprite::ProcessParticle (particle_t *particle, sector_t *sector)//, int s
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (glset.nocoloredspritelighting)
|
if (level.flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING)
|
||||||
{
|
{
|
||||||
Colormap.Decolorize(); // ZDoom never applies colored light to particles.
|
Colormap.Decolorize(); // ZDoom never applies colored light to particles.
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,7 +251,7 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
||||||
lightlevel = gl_ClampLight(fakesec->lightlevel);
|
lightlevel = gl_ClampLight(fakesec->lightlevel);
|
||||||
|
|
||||||
// calculate colormap for weapon sprites
|
// calculate colormap for weapon sprites
|
||||||
if (viewsector->e->XFloor.ffloors.Size() && !glset.nocoloredspritelighting)
|
if (viewsector->e->XFloor.ffloors.Size() && !(level.flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING))
|
||||||
{
|
{
|
||||||
TArray<lightlist_t> & lightlist = viewsector->e->XFloor.lightlist;
|
TArray<lightlist_t> & lightlist = viewsector->e->XFloor.lightlist;
|
||||||
for(i=0;i<lightlist.Size();i++)
|
for(i=0;i<lightlist.Size();i++)
|
||||||
|
@ -278,7 +278,7 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cm=fakesec->Colormap;
|
cm=fakesec->Colormap;
|
||||||
if (glset.nocoloredspritelighting) cm.ClearColor();
|
if (level.flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING) cm.ClearColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
lightlevel = gl_CalcLightLevel(lightlevel, getExtraLight(), true);
|
lightlevel = gl_CalcLightLevel(lightlevel, getExtraLight(), true);
|
||||||
|
|
|
@ -215,7 +215,7 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
|
||||||
|
|
||||||
bool noaccel = false;
|
bool noaccel = false;
|
||||||
|
|
||||||
FDynamicColormap *basecolormap = GetColorTable(viewpoint.sector->Colormap, viewpoint.sector->SpecialColors[sector_t::sprites]);
|
FDynamicColormap *basecolormap = GetColorTable(viewpoint.sector->Colormap, viewpoint.sector->SpecialColors[sector_t::sprites], true);
|
||||||
FDynamicColormap *colormap_to_use = basecolormap;
|
FDynamicColormap *colormap_to_use = basecolormap;
|
||||||
|
|
||||||
int ColormapNum = 0;
|
int ColormapNum = 0;
|
||||||
|
|
|
@ -162,7 +162,7 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const Vec4f &clipPla
|
||||||
args.stenciltestvalue = stencilValue;
|
args.stenciltestvalue = stencilValue;
|
||||||
args.stencilwritevalue = stencilValue;
|
args.stencilwritevalue = stencilValue;
|
||||||
args.SetTexture(tex, thing->Translation);
|
args.SetTexture(tex, thing->Translation);
|
||||||
args.SetColormap(GetColorTable(sub->sector->Colormap, sub->sector->SpecialColors[sector_t::sprites]));
|
args.SetColormap(GetColorTable(sub->sector->Colormap, sub->sector->SpecialColors[sector_t::sprites], true));
|
||||||
args.SetClipPlane(clipPlane.x, clipPlane.y, clipPlane.z, clipPlane.w);
|
args.SetClipPlane(clipPlane.x, clipPlane.y, clipPlane.z, clipPlane.w);
|
||||||
|
|
||||||
TriBlendMode blendmode;
|
TriBlendMode blendmode;
|
||||||
|
|
|
@ -123,7 +123,7 @@ void RenderPolyWallSprite::Render(const TriMatrix &worldToClip, const Vec4f &cli
|
||||||
args.stenciltestvalue = stencilValue;
|
args.stenciltestvalue = stencilValue;
|
||||||
args.stencilwritevalue = stencilValue;
|
args.stencilwritevalue = stencilValue;
|
||||||
args.SetTexture(tex);
|
args.SetTexture(tex);
|
||||||
args.SetColormap(GetColorTable(sub->sector->Colormap, sub->sector->SpecialColors[sector_t::sprites]));
|
args.SetColormap(GetColorTable(sub->sector->Colormap, sub->sector->SpecialColors[sector_t::sprites], true));
|
||||||
args.SetClipPlane(clipPlane.x, clipPlane.y, clipPlane.z, clipPlane.w);
|
args.SetClipPlane(clipPlane.x, clipPlane.y, clipPlane.z, clipPlane.w);
|
||||||
args.subsectorTest = true;
|
args.subsectorTest = true;
|
||||||
args.writeSubsector = false;
|
args.writeSubsector = false;
|
||||||
|
|
|
@ -64,10 +64,9 @@ struct FColormap
|
||||||
|
|
||||||
void CopyFrom3DLight(lightlist_t *light);
|
void CopyFrom3DLight(lightlist_t *light);
|
||||||
|
|
||||||
void Decolorize() // this for 'nocoloredspritelighting' and not the same as desaturation. The normal formula results in a value that's too dark.
|
void Decolorize()
|
||||||
{
|
{
|
||||||
int v = (LightColor.r + LightColor.g + LightColor.b) / 3;
|
LightColor.Decolorize();
|
||||||
LightColor.r = LightColor.g = LightColor.b = (255 + v + v) / 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator == (const FColormap &other)
|
bool operator == (const FColormap &other)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
#include "g_levellocals.h"
|
||||||
|
|
||||||
struct FSWColormap
|
struct FSWColormap
|
||||||
{
|
{
|
||||||
|
@ -46,9 +47,16 @@ void SetDefaultColormap (const char *name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// MSVC needs the forceinline here.
|
// MSVC needs the forceinline here.
|
||||||
FORCEINLINE FDynamicColormap *GetColorTable(const FColormap &cm, PalEntry SpecialColor = 0xffffff)
|
FORCEINLINE FDynamicColormap *GetColorTable(const FColormap &cm, PalEntry SpecialColor = 0xffffff, bool forsprites = false)
|
||||||
{
|
{
|
||||||
auto c = SpecialColor.Modulate(cm.LightColor);
|
PalEntry c;
|
||||||
|
if (!forsprites || !(level.flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING)) c = SpecialColor.Modulate(cm.LightColor);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
c = cm.LightColor;
|
||||||
|
c.Decolorize();
|
||||||
|
c = SpecialColor.Modulate(c);
|
||||||
|
}
|
||||||
auto p = &NormalLight;
|
auto p = &NormalLight;
|
||||||
if (c == p->Color &&
|
if (c == p->Color &&
|
||||||
cm.FadeColor == p->Fade &&
|
cm.FadeColor == p->Fade &&
|
||||||
|
|
|
@ -702,7 +702,7 @@ namespace swrenderer
|
||||||
ceilingplane = backupcp;
|
ceilingplane = backupcp;
|
||||||
}
|
}
|
||||||
|
|
||||||
basecolormap = GetColorTable(frontsector->Colormap, frontsector->SpecialColors[sector_t::sprites]);
|
basecolormap = GetColorTable(frontsector->Colormap, frontsector->SpecialColors[sector_t::sprites], true);
|
||||||
floorlightlevel = fll;
|
floorlightlevel = fll;
|
||||||
ceilinglightlevel = cll;
|
ceilinglightlevel = cll;
|
||||||
|
|
||||||
|
@ -886,7 +886,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
int lightlevel = thing->Sector->GetTexture(sector_t::ceiling) == skyflatnum ? thing->Sector->GetCeilingLight() : thing->Sector->GetFloorLight();
|
int lightlevel = thing->Sector->GetTexture(sector_t::ceiling) == skyflatnum ? thing->Sector->GetCeilingLight() : thing->Sector->GetFloorLight();
|
||||||
thingShade = LightVisibility::LightLevelToShade(lightlevel + LightVisibility::ActualExtraLight(foggy, Thread->Viewport.get()), foggy);
|
thingShade = LightVisibility::LightLevelToShade(lightlevel + LightVisibility::ActualExtraLight(foggy, Thread->Viewport.get()), foggy);
|
||||||
thingColormap = GetColorTable(thing->Sector->Colormap, thing->Sector->SpecialColors[sector_t::sprites]);
|
thingColormap = GetColorTable(thing->Sector->Colormap, thing->Sector->SpecialColors[sector_t::sprites], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((sprite.renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE)
|
if ((sprite.renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE)
|
||||||
|
|
|
@ -148,7 +148,7 @@ namespace swrenderer
|
||||||
botplane = &heightsec->ceilingplane;
|
botplane = &heightsec->ceilingplane;
|
||||||
toppic = sector->GetTexture(sector_t::ceiling);
|
toppic = sector->GetTexture(sector_t::ceiling);
|
||||||
botpic = heightsec->GetTexture(sector_t::ceiling);
|
botpic = heightsec->GetTexture(sector_t::ceiling);
|
||||||
map = GetColorTable(heightsec->Colormap, heightsec->SpecialColors[sector_t::sprites]);
|
map = GetColorTable(heightsec->Colormap, heightsec->SpecialColors[sector_t::sprites], true);
|
||||||
}
|
}
|
||||||
else if (fakeside == WaterFakeSide::BelowFloor)
|
else if (fakeside == WaterFakeSide::BelowFloor)
|
||||||
{
|
{
|
||||||
|
@ -156,7 +156,7 @@ namespace swrenderer
|
||||||
botplane = §or->floorplane;
|
botplane = §or->floorplane;
|
||||||
toppic = heightsec->GetTexture(sector_t::floor);
|
toppic = heightsec->GetTexture(sector_t::floor);
|
||||||
botpic = sector->GetTexture(sector_t::floor);
|
botpic = sector->GetTexture(sector_t::floor);
|
||||||
map = GetColorTable(heightsec->Colormap, heightsec->SpecialColors[sector_t::sprites]);
|
map = GetColorTable(heightsec->Colormap, heightsec->SpecialColors[sector_t::sprites], true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -164,7 +164,7 @@ namespace swrenderer
|
||||||
botplane = &heightsec->floorplane;
|
botplane = &heightsec->floorplane;
|
||||||
toppic = heightsec->GetTexture(sector_t::ceiling);
|
toppic = heightsec->GetTexture(sector_t::ceiling);
|
||||||
botpic = heightsec->GetTexture(sector_t::floor);
|
botpic = heightsec->GetTexture(sector_t::floor);
|
||||||
map = GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites]);
|
map = GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -173,7 +173,7 @@ namespace swrenderer
|
||||||
botplane = §or->floorplane;
|
botplane = §or->floorplane;
|
||||||
toppic = sector->GetTexture(sector_t::ceiling);
|
toppic = sector->GetTexture(sector_t::ceiling);
|
||||||
botpic = sector->GetTexture(sector_t::floor);
|
botpic = sector->GetTexture(sector_t::floor);
|
||||||
map = GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites]);
|
map = GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (botpic != skyflatnum && particle->Pos.Z < botplane->ZatPoint(particle->Pos))
|
if (botpic != skyflatnum && particle->Pos.Z < botplane->ZatPoint(particle->Pos))
|
||||||
|
|
|
@ -103,9 +103,9 @@ namespace swrenderer
|
||||||
break;
|
break;
|
||||||
sec = rover->model;
|
sec = rover->model;
|
||||||
if (rover->flags & FF_FADEWALLS)
|
if (rover->flags & FF_FADEWALLS)
|
||||||
basecolormap = GetColorTable(sec->Colormap, sec->SpecialColors[sector_t::sprites]);
|
basecolormap = GetColorTable(sec->Colormap, sec->SpecialColors[sector_t::sprites], true);
|
||||||
else
|
else
|
||||||
basecolormap = GetColorTable(Thread->Viewport->viewpoint.sector->e->XFloor.lightlist[i].extra_colormap, sec->SpecialColors[sector_t::sprites]);
|
basecolormap = GetColorTable(Thread->Viewport->viewpoint.sector->e->XFloor.lightlist[i].extra_colormap, sec->SpecialColors[sector_t::sprites], true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ namespace swrenderer
|
||||||
if (!sec)
|
if (!sec)
|
||||||
{
|
{
|
||||||
sec = Thread->Viewport->viewpoint.sector;
|
sec = Thread->Viewport->viewpoint.sector;
|
||||||
basecolormap = GetColorTable(sec->Colormap, sec->SpecialColors[sector_t::sprites]);
|
basecolormap = GetColorTable(sec->Colormap, sec->SpecialColors[sector_t::sprites], true);
|
||||||
}
|
}
|
||||||
floorlight = ceilinglight = sec->lightlevel;
|
floorlight = ceilinglight = sec->lightlevel;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ namespace swrenderer
|
||||||
sec = Thread->OpaquePass->FakeFlat(Thread->Viewport->viewpoint.sector, &tempsec, &floorlight, &ceilinglight, nullptr, 0, 0, 0, 0);
|
sec = Thread->OpaquePass->FakeFlat(Thread->Viewport->viewpoint.sector, &tempsec, &floorlight, &ceilinglight, nullptr, 0, 0, 0, 0);
|
||||||
|
|
||||||
// [RH] set basecolormap
|
// [RH] set basecolormap
|
||||||
basecolormap = GetColorTable(sec->Colormap, sec->SpecialColors[sector_t::sprites]);
|
basecolormap = GetColorTable(sec->Colormap, sec->SpecialColors[sector_t::sprites], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// [RH] set foggy flag
|
// [RH] set foggy flag
|
||||||
|
|
|
@ -113,11 +113,11 @@ namespace swrenderer
|
||||||
sec = rover->model;
|
sec = rover->model;
|
||||||
if (rover->flags & FF_FADEWALLS)
|
if (rover->flags & FF_FADEWALLS)
|
||||||
{
|
{
|
||||||
mybasecolormap = GetColorTable(sec->Colormap, spr->sector->SpecialColors[sector_t::sprites]);
|
mybasecolormap = GetColorTable(sec->Colormap, spr->sector->SpecialColors[sector_t::sprites], true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mybasecolormap = GetColorTable(spr->sector->e->XFloor.lightlist[i].extra_colormap, spr->sector->SpecialColors[sector_t::sprites]);
|
mybasecolormap = GetColorTable(spr->sector->e->XFloor.lightlist[i].extra_colormap, spr->sector->SpecialColors[sector_t::sprites], true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue