- Implemented r_fullbrightignoresectorcolor from QZDoom

This commit is contained in:
raa-eruanna 2016-10-21 06:54:45 -04:00
parent 4b956a2f2b
commit c76431414a
8 changed files with 37 additions and 14 deletions

View file

@ -105,6 +105,7 @@ TArray<PortalDrawseg> WallPortals(1000); // note: this array needs to go away as
subsector_t *InSubsector; subsector_t *InSubsector;
CVAR (Bool, r_drawflat, false, 0) // [RH] Don't texture segs? CVAR (Bool, r_drawflat, false, 0) // [RH] Don't texture segs?
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
void R_StoreWallRange (int start, int stop); void R_StoreWallRange (int start, int stop);
@ -1108,7 +1109,7 @@ void R_Subsector (subsector_t *sub)
} }
else else
{ {
basecolormap = frontsector->ColorMap; basecolormap = (r_fullbrightignoresectorcolor && fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap;
} }
portal = frontsector->ValidatePortal(sector_t::ceiling); portal = frontsector->ValidatePortal(sector_t::ceiling);
@ -1142,7 +1143,7 @@ void R_Subsector (subsector_t *sub)
} }
else 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 // killough 3/7/98: Add (x,y) offsets to flats, add deep water check

View file

@ -59,6 +59,7 @@ static bool R_CheckForFixedLights(const BYTE *colormaps);
extern "C" { extern "C" {
FDynamicColormap NormalLight; FDynamicColormap NormalLight;
FDynamicColormap FullNormalLight; //[SP] Emulate GZDoom brightness
} }
bool NormalLightHasFixedLights; bool NormalLightHasFixedLights;
@ -551,6 +552,9 @@ void R_InitColormaps ()
NormalLight.Color = PalEntry (255, 255, 255); NormalLight.Color = PalEntry (255, 255, 255);
NormalLight.Fade = 0; NormalLight.Fade = 0;
NormalLight.Maps = realcolormaps; NormalLight.Maps = realcolormaps;
FullNormalLight.Color = PalEntry (255, 255, 255);
FullNormalLight.Fade = 0;
FullNormalLight.Maps = realcolormaps;
NormalLightHasFixedLights = R_CheckForFixedLights(realcolormaps); NormalLightHasFixedLights = R_CheckForFixedLights(realcolormaps);
numfakecmaps = fakecmaps.Size(); numfakecmaps = fakecmaps.Size();

View file

@ -80,6 +80,7 @@ extern BYTE DesaturateColormap[31][256];
extern "C" extern "C"
{ {
extern FDynamicColormap NormalLight; extern FDynamicColormap NormalLight;
extern FDynamicColormap FullNormalLight;
} }
extern bool NormalLightHasFixedLights; extern bool NormalLightHasFixedLights;

View file

@ -455,6 +455,8 @@ void R_CopyStackedViewParameters()
// //
//========================================================================== //==========================================================================
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
void R_SetupColormap(player_t *player) void R_SetupColormap(player_t *player)
{ {
realfixedcolormap = NULL; realfixedcolormap = NULL;
@ -481,6 +483,11 @@ void R_SetupColormap(player_t *player)
else if (player->fixedlightlevel >= 0 && player->fixedlightlevel < NUMCOLORMAPS) else if (player->fixedlightlevel >= 0 && player->fixedlightlevel < NUMCOLORMAPS)
{ {
fixedlightlev = player->fixedlightlevel * 256; 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 // [RH] Inverse light for shooting the Sigil

View file

@ -57,6 +57,7 @@
CVAR(Bool, r_np2, true, 0) CVAR(Bool, r_np2, true, 0)
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
//CVAR (Int, ty, 8, 0) //CVAR (Int, ty, 8, 0)
//CVAR (Int, tx, 8, 0) //CVAR (Int, tx, 8, 0)
@ -313,7 +314,7 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2)
rw_scalestep = ds->iscalestep; rw_scalestep = ds->iscalestep;
if (fixedlightlev >= 0) if (fixedlightlev >= 0)
dc_colormap = basecolormap->Maps + fixedlightlev; dc_colormap = (r_fullbrightignoresectorcolor) ? (&FullNormalLight->Maps + fixedlightlev) : (basecolormap->Maps + fixedlightlev);
else if (fixedcolormap != NULL) else if (fixedcolormap != NULL)
dc_colormap = fixedcolormap; dc_colormap = fixedcolormap;
@ -630,7 +631,7 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover)
} }
if (fixedlightlev >= 0) if (fixedlightlev >= 0)
dc_colormap = basecolormap->Maps + fixedlightlev; dc_colormap = (r_fullbrightignoresectorcolor) ? (&FullNormalLight->Maps + fixedlightlev) : (basecolormap->Maps + fixedlightlev);
else if (fixedcolormap != NULL) else if (fixedcolormap != NULL)
dc_colormap = fixedcolormap; dc_colormap = fixedcolormap;
@ -1788,7 +1789,7 @@ void R_RenderSegLoop ()
fixed_t xoffset = rw_offset; fixed_t xoffset = rw_offset;
if (fixedlightlev >= 0) if (fixedlightlev >= 0)
dc_colormap = basecolormap->Maps + fixedlightlev; dc_colormap = (r_fullbrightignoresectorcolor) ? (&FullNormalLight->Maps + fixedlightlev) : (basecolormap->Maps + fixedlightlev);
else if (fixedcolormap != NULL) else if (fixedcolormap != NULL)
dc_colormap = fixedcolormap; dc_colormap = fixedcolormap;
@ -3187,11 +3188,11 @@ static void R_RenderDecal (side_t *wall, DBaseDecal *decal, drawseg_t *clipper,
rw_light = rw_lightleft + (x1 - WallC.sx1) * rw_lightstep; rw_light = rw_lightleft + (x1 - WallC.sx1) * rw_lightstep;
if (fixedlightlev >= 0) if (fixedlightlev >= 0)
dc_colormap = usecolormap->Maps + fixedlightlev; dc_colormap = (r_fullbrightignoresectorcolor) ? (&FullNormalLight->Maps + fixedlightlev) : (usecolormap->Maps + fixedlightlev);
else if (fixedcolormap != NULL) else if (fixedcolormap != NULL)
dc_colormap = fixedcolormap; dc_colormap = fixedcolormap;
else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT)) else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT))
dc_colormap = usecolormap->Maps; dc_colormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight->Maps : usecolormap->Maps;
else else
calclighting = true; calclighting = true;

View file

@ -99,6 +99,7 @@ EXTERN_CVAR (Bool, st_scale)
EXTERN_CVAR(Bool, r_shadercolormaps) EXTERN_CVAR(Bool, r_shadercolormaps)
EXTERN_CVAR(Int, r_drawfuzz) EXTERN_CVAR(Int, r_drawfuzz)
EXTERN_CVAR(Bool, r_deathcamera); EXTERN_CVAR(Bool, r_deathcamera);
CVAR(Bool, r_fullbrightignoresectorcolor, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
// //
// Sprite rotation 0 is facing the viewer, // Sprite rotation 0 is facing the viewer,
@ -548,7 +549,7 @@ void R_DrawWallSprite(vissprite_t *spr)
else if (fixedcolormap != NULL) else if (fixedcolormap != NULL)
dc_colormap = fixedcolormap; dc_colormap = fixedcolormap;
else if (!foggy && (spr->renderflags & RF_FULLBRIGHT)) else if (!foggy && (spr->renderflags & RF_FULLBRIGHT))
dc_colormap = usecolormap->Maps; dc_colormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight->Maps : usecolormap->Maps;
else else
calclighting = true; calclighting = true;
@ -1066,7 +1067,8 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
vis->deltax = float(pos.X - ViewPos.X); vis->deltax = float(pos.X - ViewPos.X);
vis->deltay = float(pos.Y - ViewPos.Y); vis->deltay = float(pos.Y - ViewPos.Y);
vis->renderflags = renderflags; vis->renderflags = renderflags;
if(thing->flags5 & MF5_BRIGHT) vis->renderflags |= RF_FULLBRIGHT; // kg3D if(thing->flags5 & MF5_BRIGHT)
vis->renderflags |= RF_FULLBRIGHT; // kg3D
vis->Style.RenderStyle = thing->RenderStyle; vis->Style.RenderStyle = thing->RenderStyle;
vis->FillColor = thing->fillcolor; vis->FillColor = thing->fillcolor;
vis->Translation = thing->Translation; // [RH] thing translation table vis->Translation = thing->Translation; // [RH] thing translation table
@ -1140,7 +1142,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
} }
else if (!foggy && ((renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT))) else if (!foggy && ((renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)))
{ // full bright { // full bright
vis->Style.colormap = mybasecolormap->Maps; vis->Style.colormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight->Maps : mybasecolormap->Maps;
} }
else else
{ // diminished light { // diminished light
@ -1462,11 +1464,11 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
} }
if (fixedlightlev >= 0) if (fixedlightlev >= 0)
{ {
vis->Style.colormap = mybasecolormap->Maps + fixedlightlev; vis->Style.colormap = (r_fullbrightignoresectorcolor) ? (&FullNormalLight->Maps + fixedlightlev) : (mybasecolormap->Maps + fixedlightlev);
} }
else if (!foggy && pspr->GetState()->GetFullbright()) else if (!foggy && pspr->GetState()->GetFullbright())
{ // full bright { // full bright
vis->Style.colormap = mybasecolormap->Maps; // [RH] use basecolormap vis->Style.colormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight->Maps : mybasecolormap->Maps; // [RH] use basecolormap
} }
else else
{ // local light { // local light
@ -1516,6 +1518,11 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
{ {
noaccel = true; 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; colormap_to_use = mybasecolormap;
} }
else else
@ -2057,7 +2064,7 @@ void R_DrawSprite (vissprite_t *spr)
} }
else if (!foggy && (spr->renderflags & RF_FULLBRIGHT)) else if (!foggy && (spr->renderflags & RF_FULLBRIGHT))
{ // full bright { // full bright
spr->Style.colormap = mybasecolormap->Maps; spr->Style.colormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight->Maps : mybasecolormap->Maps;
} }
else else
{ // diminished light { // diminished light
@ -2615,7 +2622,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
} }
else if (particle->bright) else if (particle->bright)
{ {
vis->Style.colormap = map; vis->Style.colormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight->Maps : map;
} }
else else
{ {

View file

@ -1787,6 +1787,7 @@ DSPLYMNU_PICKUPFADE = "Pickup Flash Intensity";
DSPLYMNU_PALLETEHACK = "DirectDraw palette hack"; // Not used DSPLYMNU_PALLETEHACK = "DirectDraw palette hack"; // Not used
DSPLYMNU_ATTACHEDSURFACES = "Use attached surfaces"; // Not used DSPLYMNU_ATTACHEDSURFACES = "Use attached surfaces"; // Not used
DSPLYMNU_SKYMODE = "Sky render mode"; DSPLYMNU_SKYMODE = "Sky render mode";
DSPLYMNU_GZDFULLBRIGHT = "Emulate GZDoom FullBright";
DSPLYMNU_DRAWFUZZ = "Use fuzz effect"; DSPLYMNU_DRAWFUZZ = "Use fuzz effect";
DSPLYMNU_TRANSSOUL = "Lost Soul translucency"; DSPLYMNU_TRANSSOUL = "Lost Soul translucency";
DSPLYMNU_FAKECONTRAST = "Use fake contrast"; DSPLYMNU_FAKECONTRAST = "Use fake contrast";

View file

@ -682,6 +682,7 @@ OptionMenu "VideoOptions"
} }
Option "$DSPLYMNU_SKYMODE", "r_skymode", "SkyModes" Option "$DSPLYMNU_SKYMODE", "r_skymode", "SkyModes"
Option "$DSPLYMNU_GZDFULLBRIGHT", "r_fullbrightignoresectorcolor", "OnOff"
Option "$DSPLYMNU_DRAWFUZZ", "r_drawfuzz", "Fuzziness" Option "$DSPLYMNU_DRAWFUZZ", "r_drawfuzz", "Fuzziness"
Slider "$DSPLYMNU_TRANSSOUL", "transsouls", 0.25, 1.0, 0.05, 2 Slider "$DSPLYMNU_TRANSSOUL", "transsouls", 0.25, 1.0, 0.05, 2
Option "$DSPLYMNU_FAKECONTRAST", "r_fakecontrast", "Contrast" Option "$DSPLYMNU_FAKECONTRAST", "r_fakecontrast", "Contrast"