diff --git a/src/g_level.cpp b/src/g_level.cpp index 0367e7d917..a8e1677708 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -101,6 +101,7 @@ EXTERN_CVAR (Float, sv_gravity) EXTERN_CVAR (Float, sv_aircontrol) EXTERN_CVAR (Int, disableautosave) EXTERN_CVAR (String, playerclass) +EXTERN_CVAR(Int, r_preservesectorcolor) #define SNAP_ID MAKE_ID('s','n','A','p') #define DSNP_ID MAKE_ID('d','s','N','p') @@ -1488,6 +1489,20 @@ bool FLevelLocals::IsFreelookAllowed() const // //========================================================================== +bool FLevelLocals::PreserveSectorColor() const +{ + if (r_preservesectorcolor == 0) + return false; + if (r_preservesectorcolor == 1) + return true; + return !!(level.flags3 & LEVEL3_PRESERVESECTORCOLOR); +} + +//========================================================================== +// +// +//========================================================================== + FString CalcMapName (int episode, int level) { FString lumpname; diff --git a/src/g_level.h b/src/g_level.h index 1fadcee3a7..270cf54f04 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -223,6 +223,7 @@ enum ELevelFlags : unsigned int // More flags! LEVEL3_FORCEFAKECONTRAST = 0x00000001, // forces fake contrast even with fog enabled + LEVEL3_PRESERVESECTORCOLOR = 0x00000002, }; diff --git a/src/g_levellocals.h b/src/g_levellocals.h index 357e2e1545..0afac37adf 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -79,6 +79,7 @@ struct FLevelLocals bool IsJumpingAllowed() const; bool IsCrouchingAllowed() const; bool IsFreelookAllowed() const; + bool PreserveSectorColor() const; }; extern FLevelLocals level; diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index bb641b23bb..3f8e50027e 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -1282,6 +1282,8 @@ MapFlagHandlers[] = { "unfreezesingleplayerconversations",MITYPE_SETFLAG2, LEVEL2_CONV_SINGLE_UNFREEZE, 0 }, { "spawnwithweaponraised", MITYPE_SETFLAG2, LEVEL2_PRERAISEWEAPON, 0 }, { "forcefakecontrast", MITYPE_SETFLAG3, LEVEL3_FORCEFAKECONTRAST, 0 }, + { "preservesectorcolor", MITYPE_SETFLAG3, LEVEL3_PRESERVESECTORCOLOR, 0 }, + { "nopreservesectorcolor", MITYPE_CLRFLAG3, LEVEL3_PRESERVESECTORCOLOR, 0 }, { "nobotnodes", MITYPE_IGNORE, 0, 0 }, // Skulltag option: nobotnodes { "compat_shorttex", MITYPE_COMPATFLAG, COMPATF_SHORTTEX, 0 }, { "compat_stairs", MITYPE_COMPATFLAG, COMPATF_STAIRINDEX, 0 }, diff --git a/src/gl/renderer/gl_renderstate.cpp b/src/gl/renderer/gl_renderstate.cpp index 429f69c349..04a53d67d6 100644 --- a/src/gl/renderer/gl_renderstate.cpp +++ b/src/gl/renderer/gl_renderstate.cpp @@ -141,9 +141,10 @@ bool FRenderState::ApplyShader() fogset = -gl_fogmode; } } + glVertexAttrib4fv(VATTR_NORMAL, mNormal.vec); glVertexAttrib4fv(VATTR_COLOR, mColor.vec); - glVertexAttrib4fv(VATTR_NORMAL, mNormal.vec); + activeShader->muObjectColor.Set(mObjectColor); activeShader->muDesaturation.Set(mDesaturation / 255.f); activeShader->muFogEnabled.Set(fogset); @@ -152,7 +153,6 @@ bool FRenderState::ApplyShader() activeShader->muCameraPos.Set(mCameraPos.vec); activeShader->muLightParms.Set(mLightParms); activeShader->muFogColor.Set(mFogColor); - activeShader->muObjectColor.Set(mObjectColor); activeShader->muDynLightColor.Set(mDynColor.vec); activeShader->muInterpolationFactor.Set(mInterpolationFactor); activeShader->muClipHeight.Set(mClipHeight); diff --git a/src/r_utility.cpp b/src/r_utility.cpp index c7f09c204a..612e292baf 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -91,6 +91,11 @@ static TArray InterpolationPath; // PUBLIC DATA DEFINITIONS ------------------------------------------------- +CUSTOM_CVAR(Int, r_preservesectorcolor, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +{ + if (self < -1 || self > 1) self = -1; +} + CVAR (Bool, r_deathcamera, false, CVAR_ARCHIVE) CVAR (Int, r_clearbuffer, 0, 0) CVAR (Bool, r_drawvoxels, true, 0) diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index de9bc1adca..2482cfba50 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -1792,7 +1792,7 @@ DSPLYMNU_PALLETEHACK = "DirectDraw palette hack"; // Not used DSPLYMNU_ATTACHEDSURFACES = "Use attached surfaces"; // Not used DSPLYMNU_SKYMODE = "Sky render mode"; DSPLYMNU_LINEARSKY = "Linear skies"; -DSPLYMNU_GZDFULLBRIGHT = "Fullbright overrides sector color"; +DSPLYMNU_GZDFULLBRIGHT = "Fullbright preserves sector color"; DSPLYMNU_DRAWFUZZ = "Use fuzz effect"; DSPLYMNU_TRANSSOUL = "Lost Soul translucency"; DSPLYMNU_FAKECONTRAST = "Use fake contrast"; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index f88b34286d..a8a2b10e8c 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -664,6 +664,13 @@ OptionValue Fuzziness 2.0, "$OPTVAL_SHADOW" } +OptionValue SectorColor +{ + -1.0, "$OPTVAL_MAPSETTING" + 0.0, "$OPTVAL_OFF" + 1.0, "$OPTVAL_ON" +} + OptionMenu "OpenGLOptions" { Title "$GLMNU_TITLE" @@ -717,7 +724,7 @@ OptionMenu "VideoOptions" Option "$DSPLYMNU_SKYMODE", "r_skymode", "SkyModes" Option "$DSPLYMNU_LINEARSKY", "r_linearsky", "OnOff" - Option "$DSPLYMNU_GZDFULLBRIGHT", "r_fullbrightignoresectorcolor", "OnOff" + Option "$DSPLYMNU_GZDFULLBRIGHT", "r_preservesectorcolor", "SectorColor" Option "$DSPLYMNU_DRAWFUZZ", "r_drawfuzz", "Fuzziness" Slider "$DSPLYMNU_TRANSSOUL", "transsouls", 0.25, 1.0, 0.05, 2 Option "$DSPLYMNU_FAKECONTRAST", "r_fakecontrast", "Contrast"