mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
- Fully Implemented GZDoom fullbright emulation
This commit is contained in:
parent
1cd27ca98a
commit
b327a3312e
6 changed files with 32 additions and 13 deletions
|
@ -105,6 +105,7 @@ TArray<PortalDrawseg> WallPortals(1000); // note: this array needs to go away as
|
|||
subsector_t *InSubsector;
|
||||
|
||||
CVAR (Bool, r_drawflat, false, 0) // [RH] Don't texture segs?
|
||||
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
||||
|
||||
|
||||
void R_StoreWallRange (int start, int stop);
|
||||
|
@ -1108,7 +1109,7 @@ void R_Subsector (subsector_t *sub)
|
|||
}
|
||||
else
|
||||
{
|
||||
basecolormap = frontsector->ColorMap;
|
||||
basecolormap = (r_fullbrightignoresectorcolor && fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap;
|
||||
}
|
||||
|
||||
portal = frontsector->ValidatePortal(sector_t::ceiling);
|
||||
|
@ -1142,7 +1143,7 @@ void R_Subsector (subsector_t *sub)
|
|||
}
|
||||
else
|
||||
{
|
||||
basecolormap = frontsector->ColorMap;
|
||||
basecolormap = (r_fullbrightignoresectorcolor && fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap;
|
||||
}
|
||||
|
||||
// killough 3/7/98: Add (x,y) offsets to flats, add deep water check
|
||||
|
|
|
@ -59,6 +59,7 @@ static bool R_CheckForFixedLights(const BYTE *colormaps);
|
|||
|
||||
extern "C" {
|
||||
FDynamicColormap NormalLight;
|
||||
FDynamicColormap FullNormalLight; //[SP] Emulate GZDoom brightness
|
||||
}
|
||||
bool NormalLightHasFixedLights;
|
||||
|
||||
|
@ -547,6 +548,9 @@ void R_InitColormaps ()
|
|||
NormalLight.Color = PalEntry (255, 255, 255);
|
||||
NormalLight.Fade = 0;
|
||||
NormalLight.Maps = realcolormaps.Maps;
|
||||
FullNormalLight.Color = PalEntry (255, 255, 255);
|
||||
FullNormalLight.Fade = 0;
|
||||
FullNormalLight.Maps = realcolormaps.Maps;
|
||||
NormalLightHasFixedLights = R_CheckForFixedLights(realcolormaps.Maps);
|
||||
numfakecmaps = fakecmaps.Size();
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@ extern BYTE DesaturateColormap[31][256];
|
|||
extern "C"
|
||||
{
|
||||
extern FDynamicColormap NormalLight;
|
||||
extern FDynamicColormap FullNormalLight;
|
||||
}
|
||||
extern bool NormalLightHasFixedLights;
|
||||
|
||||
|
|
|
@ -451,6 +451,8 @@ void R_CopyStackedViewParameters()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
|
||||
|
||||
void R_SetupColormap(player_t *player)
|
||||
{
|
||||
realfixedcolormap = NULL;
|
||||
|
@ -477,6 +479,11 @@ void R_SetupColormap(player_t *player)
|
|||
else if (player->fixedlightlevel >= 0 && player->fixedlightlevel < NUMCOLORMAPS)
|
||||
{
|
||||
fixedlightlev = player->fixedlightlevel * 256;
|
||||
// [SP] Emulate GZDoom's light-amp goggles.
|
||||
if (r_fullbrightignoresectorcolor && fixedlightlev >= 0)
|
||||
{
|
||||
fixedcolormap = &FullNormalLight;
|
||||
}
|
||||
}
|
||||
}
|
||||
// [RH] Inverse light for shooting the Sigil
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
|
||||
|
||||
CVAR(Bool, r_np2, true, 0)
|
||||
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
|
||||
|
||||
//CVAR (Int, ty, 8, 0)
|
||||
//CVAR (Int, tx, 8, 0)
|
||||
|
@ -318,7 +319,7 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
|
|||
rw_scalestep = ds->iscalestep;
|
||||
|
||||
if (fixedlightlev >= 0)
|
||||
R_SetColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
else if (fixedcolormap != NULL)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
|
||||
|
@ -635,7 +636,7 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover)
|
|||
}
|
||||
|
||||
if (fixedlightlev >= 0)
|
||||
R_SetColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
else if (fixedcolormap != NULL)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
|
||||
|
@ -1762,7 +1763,7 @@ void R_RenderSegLoop ()
|
|||
fixed_t xoffset = rw_offset;
|
||||
|
||||
if (fixedlightlev >= 0)
|
||||
R_SetColorMapLight(basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
else if (fixedcolormap != NULL)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
|
||||
|
@ -3161,11 +3162,11 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
|
|||
|
||||
rw_light = rw_lightleft + (x1 - WallC.sx1) * rw_lightstep;
|
||||
if (fixedlightlev >= 0)
|
||||
R_SetColorMapLight(usecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(fixedlightlev));
|
||||
else if (fixedcolormap != NULL)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT))
|
||||
R_SetColorMapLight(usecolormap, 0, 0);
|
||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
|
||||
else
|
||||
calclighting = true;
|
||||
|
||||
|
|
|
@ -570,7 +570,7 @@ void R_DrawWallSprite(vissprite_t *spr)
|
|||
else if (fixedcolormap != NULL)
|
||||
R_SetColorMapLight(fixedcolormap, 0, 0);
|
||||
else if (!foggy && (spr->renderflags & RF_FULLBRIGHT))
|
||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &NormalLight : usecolormap, 0, 0);
|
||||
R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0);
|
||||
else
|
||||
calclighting = true;
|
||||
|
||||
|
@ -1166,7 +1166,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
|
|||
}
|
||||
else if (!foggy && ((renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)))
|
||||
{ // full bright
|
||||
vis->Style.BaseColormap = (r_fullbrightignoresectorcolor) ? &NormalLight : mybasecolormap;
|
||||
vis->Style.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap;
|
||||
vis->Style.ColormapNum = 0;
|
||||
}
|
||||
else
|
||||
|
@ -1489,12 +1489,12 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
|
|||
}
|
||||
if (fixedlightlev >= 0)
|
||||
{
|
||||
vis->Style.BaseColormap = mybasecolormap;
|
||||
vis->Style.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap;
|
||||
vis->Style.ColormapNum = fixedlightlev >> COLORMAPSHIFT;
|
||||
}
|
||||
else if (!foggy && pspr->GetState()->GetFullbright())
|
||||
{ // full bright
|
||||
vis->Style.BaseColormap = mybasecolormap; // [RH] use basecolormap
|
||||
vis->Style.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; // [RH] use basecolormap
|
||||
vis->Style.ColormapNum = 0;
|
||||
}
|
||||
else
|
||||
|
@ -1546,6 +1546,11 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
|
|||
{
|
||||
noaccel = true;
|
||||
}
|
||||
// [SP] If emulating GZDoom fullbright, disable acceleration
|
||||
if (r_fullbrightignoresectorcolor && fixedlightlev >= 0)
|
||||
mybasecolormap = &FullNormalLight;
|
||||
if (r_fullbrightignoresectorcolor && !foggy && pspr->GetState()->GetFullbright())
|
||||
mybasecolormap = &FullNormalLight;
|
||||
colormap_to_use = mybasecolormap;
|
||||
}
|
||||
else
|
||||
|
@ -2088,7 +2093,7 @@ void R_DrawSprite (vissprite_t *spr)
|
|||
}
|
||||
else if (!foggy && (spr->renderflags & RF_FULLBRIGHT))
|
||||
{ // full bright
|
||||
spr->Style.BaseColormap = mybasecolormap;
|
||||
spr->Style.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap;
|
||||
spr->Style.ColormapNum = 0;
|
||||
}
|
||||
else
|
||||
|
@ -2652,7 +2657,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
|||
}
|
||||
else if (particle->bright)
|
||||
{
|
||||
vis->Style.BaseColormap = map;
|
||||
vis->Style.BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : map;
|
||||
vis->Style.ColormapNum = 0;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue