diff --git a/src/polyrenderer/scene/poly_playersprite.cpp b/src/polyrenderer/scene/poly_playersprite.cpp index dd8fc4850..b4b518933 100644 --- a/src/polyrenderer/scene/poly_playersprite.cpp +++ b/src/polyrenderer/scene/poly_playersprite.cpp @@ -30,11 +30,11 @@ #include "d_player.h" #include "swrenderer/scene/r_viewport.h" #include "swrenderer/scene/r_light.h" +#include "g_levellocals.h" EXTERN_CVAR(Bool, r_drawplayersprites) EXTERN_CVAR(Bool, r_deathcamera) EXTERN_CVAR(Bool, st_scale) -EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor) EXTERN_CVAR(Bool, r_shadercolormaps) void RenderPolyPlayerSprites::Render() @@ -269,12 +269,12 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa } if (swrenderer::fixedlightlev >= 0) { - BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; + BaseColormap = (!level.PreserveSectorColor()) ? &FullNormalLight : mybasecolormap; ColormapNum = swrenderer::fixedlightlev >> COLORMAPSHIFT; } else if (!foggy && sprite->GetState()->GetFullbright()) { // full bright - BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : mybasecolormap; // [RH] use basecolormap + BaseColormap = (!level.PreserveSectorColor()) ? &FullNormalLight : mybasecolormap; // [RH] use basecolormap ColormapNum = 0; } else @@ -334,9 +334,9 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa noaccel = true; } // [SP] If emulating GZDoom fullbright, disable acceleration - if (r_fullbrightignoresectorcolor && cameraLight->fixedlightlev >= 0) + if (!level.PreserveSectorColor() && cameraLight->fixedlightlev >= 0) mybasecolormap = &FullNormalLight; - if (r_fullbrightignoresectorcolor && !foggy && sprite->GetState()->GetFullbright()) + if (!level.PreserveSectorColor() && !foggy && sprite->GetState()->GetFullbright()) mybasecolormap = &FullNormalLight; colormap_to_use = mybasecolormap; } diff --git a/src/swrenderer/line/r_line.cpp b/src/swrenderer/line/r_line.cpp index 09b1965e4..e0975a0af 100644 --- a/src/swrenderer/line/r_line.cpp +++ b/src/swrenderer/line/r_line.cpp @@ -52,7 +52,6 @@ CVAR(Bool, r_fogboundary, true, 0) CVAR(Bool, r_drawmirrors, true, 0) -EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor); namespace swrenderer { @@ -935,7 +934,7 @@ namespace swrenderer CameraLight *cameraLight = CameraLight::Instance(); if (cameraLight->fixedlightlev >= 0) - R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); + R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); else if (cameraLight->fixedcolormap != nullptr) R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0); diff --git a/src/swrenderer/line/r_renderdrawsegment.cpp b/src/swrenderer/line/r_renderdrawsegment.cpp index 214ed52b1..a381781c7 100644 --- a/src/swrenderer/line/r_renderdrawsegment.cpp +++ b/src/swrenderer/line/r_renderdrawsegment.cpp @@ -41,8 +41,7 @@ #include "swrenderer/things/r_visiblesprite.h" #include "swrenderer/scene/r_light.h" #include "swrenderer/scene/r_viewport.h" - -EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor); +#include "g_levellocals.h" namespace swrenderer { @@ -142,7 +141,7 @@ namespace swrenderer rw_scalestep = ds->iscalestep; if (cameraLight->fixedlightlev >= 0) - R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); + R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); else if (cameraLight->fixedcolormap != nullptr) R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0); @@ -445,7 +444,7 @@ namespace swrenderer CameraLight *cameraLight = CameraLight::Instance(); if (cameraLight->fixedlightlev >= 0) - R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); + R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); else if (cameraLight->fixedcolormap != nullptr) R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0); diff --git a/src/swrenderer/scene/r_light.cpp b/src/swrenderer/scene/r_light.cpp index 851fab750..f214e5261 100644 --- a/src/swrenderer/scene/r_light.cpp +++ b/src/swrenderer/scene/r_light.cpp @@ -32,9 +32,9 @@ #include "d_player.h" #include "swrenderer/scene/r_light.h" #include "swrenderer/scene/r_viewport.h" +#include "g_levellocals.h" CVAR(Bool, r_shadercolormaps, true, CVAR_ARCHIVE) -EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor) namespace swrenderer { @@ -75,7 +75,7 @@ namespace swrenderer { fixedlightlev = player->fixedlightlevel * 256; // [SP] Emulate GZDoom's light-amp goggles. - if (r_fullbrightignoresectorcolor && fixedlightlev >= 0) + if (!level.PreserveSectorColor() && fixedlightlev >= 0) { fixedcolormap = &FullNormalLight; } @@ -194,12 +194,12 @@ namespace swrenderer } else if (cameraLight->fixedlightlev >= 0) { - BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap; + BaseColormap = (!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap; ColormapNum = cameraLight->fixedlightlev >> COLORMAPSHIFT; } else if (fullbright) { - BaseColormap = (r_fullbrightignoresectorcolor) ? &FullNormalLight : basecolormap; + BaseColormap = (!level.PreserveSectorColor()) ? &FullNormalLight : basecolormap; ColormapNum = 0; } else diff --git a/src/swrenderer/scene/r_opaque_pass.cpp b/src/swrenderer/scene/r_opaque_pass.cpp index 2391d0542..2cb5a5993 100644 --- a/src/swrenderer/scene/r_opaque_pass.cpp +++ b/src/swrenderer/scene/r_opaque_pass.cpp @@ -62,7 +62,6 @@ #include "r_data/colormaps.h" #include "g_levellocals.h" -EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor); EXTERN_CVAR(Bool, r_drawvoxels); namespace swrenderer @@ -494,7 +493,7 @@ namespace swrenderer } else { - basecolormap = (r_fullbrightignoresectorcolor && cameraLight->fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap; + basecolormap = (!level.PreserveSectorColor() && cameraLight->fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap; } portal = frontsector->ValidatePortal(sector_t::ceiling); @@ -532,7 +531,7 @@ namespace swrenderer } else { - basecolormap = (r_fullbrightignoresectorcolor && cameraLight->fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap; + basecolormap = (!level.PreserveSectorColor() && cameraLight->fixedlightlev >= 0) ? &FullNormalLight : frontsector->ColorMap; } // killough 3/7/98: Add (x,y) offsets to flats, add deep water check diff --git a/src/swrenderer/scene/r_translucent_pass.cpp b/src/swrenderer/scene/r_translucent_pass.cpp index 67b060095..69444f560 100644 --- a/src/swrenderer/scene/r_translucent_pass.cpp +++ b/src/swrenderer/scene/r_translucent_pass.cpp @@ -43,8 +43,6 @@ EXTERN_CVAR(Int, r_drawfuzz) EXTERN_CVAR(Bool, r_drawvoxels) EXTERN_CVAR(Bool, r_blendmethod) -CVAR(Bool, r_fullbrightignoresectorcolor, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); - namespace swrenderer { RenderTranslucentPass *RenderTranslucentPass::Instance() diff --git a/src/swrenderer/things/r_decal.cpp b/src/swrenderer/things/r_decal.cpp index bf4728315..37c83faa5 100644 --- a/src/swrenderer/things/r_decal.cpp +++ b/src/swrenderer/things/r_decal.cpp @@ -42,8 +42,7 @@ #include "swrenderer/scene/r_light.h" #include "swrenderer/things/r_wallsprite.h" #include "swrenderer/r_memory.h" - -EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor); +#include "g_levellocals.h" namespace swrenderer { @@ -255,11 +254,11 @@ namespace swrenderer light = lightleft + (x1 - savecoord.sx1) * lightstep; cameraLight = CameraLight::Instance(); if (cameraLight->fixedlightlev >= 0) - R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); + R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, FIXEDLIGHT2SHADE(cameraLight->fixedlightlev)); else if (cameraLight->fixedcolormap != NULL) R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0); else if (!foggy && (decal->RenderFlags & RF_FULLBRIGHT)) - R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0); + R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, 0); else calclighting = true; diff --git a/src/swrenderer/things/r_particle.cpp b/src/swrenderer/things/r_particle.cpp index 5d978fd9f..a63028e84 100644 --- a/src/swrenderer/things/r_particle.cpp +++ b/src/swrenderer/things/r_particle.cpp @@ -56,8 +56,6 @@ #include "swrenderer/drawers/r_draw_pal.h" #include "swrenderer/r_memory.h" -EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor); - namespace swrenderer { void RenderParticle::Project(particle_t *particle, const sector_t *sector, int shade, WaterFakeSide fakeside, bool foggy) diff --git a/src/swrenderer/things/r_playersprite.cpp b/src/swrenderer/things/r_playersprite.cpp index 3e7f74564..ac703ab31 100644 --- a/src/swrenderer/things/r_playersprite.cpp +++ b/src/swrenderer/things/r_playersprite.cpp @@ -61,7 +61,6 @@ EXTERN_CVAR(Bool, st_scale) EXTERN_CVAR(Bool, r_drawplayersprites) EXTERN_CVAR(Bool, r_deathcamera) EXTERN_CVAR(Bool, r_shadercolormaps) -EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor) namespace swrenderer { diff --git a/src/swrenderer/things/r_sprite.cpp b/src/swrenderer/things/r_sprite.cpp index ac2cedb2a..531c83b1a 100644 --- a/src/swrenderer/things/r_sprite.cpp +++ b/src/swrenderer/things/r_sprite.cpp @@ -56,8 +56,6 @@ #include "swrenderer/things/r_sprite.h" #include "swrenderer/r_memory.h" -EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor) - namespace swrenderer { void RenderSprite::Project(AActor *thing, const DVector3 &pos, FTexture *tex, const DVector2 &spriteScale, int renderflags, WaterFakeSide fakeside, F3DFloor *fakefloor, F3DFloor *fakeceiling, sector_t *current_sector, int spriteshade, bool foggy, FDynamicColormap *basecolormap) diff --git a/src/swrenderer/things/r_visiblesprite.cpp b/src/swrenderer/things/r_visiblesprite.cpp index b2c0b054a..14406be39 100644 --- a/src/swrenderer/things/r_visiblesprite.cpp +++ b/src/swrenderer/things/r_visiblesprite.cpp @@ -36,8 +36,6 @@ #include "swrenderer/scene/r_viewport.h" #include "swrenderer/r_memory.h" -EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor); - namespace swrenderer { void VisibleSprite::Render() diff --git a/src/swrenderer/things/r_voxel.cpp b/src/swrenderer/things/r_voxel.cpp index aa6b8206e..73509dbac 100644 --- a/src/swrenderer/things/r_voxel.cpp +++ b/src/swrenderer/things/r_voxel.cpp @@ -43,8 +43,6 @@ #include "swrenderer/scene/r_light.h" #include "swrenderer/r_memory.h" -EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor) - namespace swrenderer { void RenderVoxel::Project(AActor *thing, DVector3 pos, FVoxelDef *voxel, const DVector2 &spriteScale, int renderflags, WaterFakeSide fakeside, F3DFloor *fakefloor, F3DFloor *fakeceiling, sector_t *current_sector, int spriteshade, bool foggy, FDynamicColormap *basecolormap) diff --git a/src/swrenderer/things/r_wallsprite.cpp b/src/swrenderer/things/r_wallsprite.cpp index f599098d3..a6a600058 100644 --- a/src/swrenderer/things/r_wallsprite.cpp +++ b/src/swrenderer/things/r_wallsprite.cpp @@ -57,8 +57,7 @@ #include "swrenderer/line/r_wallsetup.h" #include "swrenderer/line/r_walldraw.h" #include "swrenderer/r_memory.h" - -EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor); +#include "g_levellocals.h" namespace swrenderer { @@ -190,7 +189,7 @@ namespace swrenderer else if (cameraLight->fixedcolormap != NULL) R_SetColorMapLight(cameraLight->fixedcolormap, 0, 0); else if (!spr->foggy && (spr->renderflags & RF_FULLBRIGHT)) - R_SetColorMapLight((r_fullbrightignoresectorcolor) ? &FullNormalLight : usecolormap, 0, 0); + R_SetColorMapLight((!level.PreserveSectorColor()) ? &FullNormalLight : usecolormap, 0, 0); else calclighting = true;