diff --git a/src/d_main.cpp b/src/d_main.cpp index b4b6947a6..fbc47da4c 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -670,6 +670,8 @@ void D_Display () cycles.Reset(); cycles.Clock(); + r_UseVanillaTransparency = UseVanillaTransparency(); // [SP] Cache UseVanillaTransparency() call + if (players[consoleplayer].camera == NULL) { players[consoleplayer].camera = players[consoleplayer].mo; diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index 0c0513dde..c49845688 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -76,7 +76,6 @@ CUSTOM_CVAR(Int, gl_fuzztype, 0, CVAR_ARCHIVE) } EXTERN_CVAR (Float, transsouls) -EXTERN_CVAR (Bool, r_vanillatrans) extern TArray sprites; extern TArray SpriteFrames; @@ -994,7 +993,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal) { trans = 1.f; } - if (UseVanillaTransparency()) + if (r_UseVanillaTransparency) { // [SP] "canonical transparency" - with the flip of a CVar, disable transparency for Doom objects, // and disable 'additive' translucency for certain objects from other games. diff --git a/src/polyrenderer/scene/poly_sprite.cpp b/src/polyrenderer/scene/poly_sprite.cpp index fc866b4e7..5b4927431 100644 --- a/src/polyrenderer/scene/poly_sprite.cpp +++ b/src/polyrenderer/scene/poly_sprite.cpp @@ -32,7 +32,6 @@ EXTERN_CVAR(Float, transsouls) EXTERN_CVAR(Int, r_drawfuzz) -EXTERN_CVAR (Bool, r_vanillatrans) bool RenderPolySprite::GetLine(AActor *thing, DVector2 &left, DVector2 &right) { @@ -147,7 +146,7 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const PolyClipPlane args.SetStencilTestValue(stencilValue); args.SetWriteStencil(true, stencilValue); args.SetClipPlane(clipPlane); - if ((thing->renderflags & RF_ZDOOMTRANS) && UseVanillaTransparency()) + if ((thing->renderflags & RF_ZDOOMTRANS) && r_UseVanillaTransparency) args.SetStyle(LegacyRenderStyles[STYLE_Normal], 1.0f, thing->fillcolor, thing->Translation, tex, fullbrightSprite); else args.SetStyle(thing->RenderStyle, thing->Alpha, thing->fillcolor, thing->Translation, tex, fullbrightSprite); diff --git a/src/r_data/r_vanillatrans.cpp b/src/r_data/r_vanillatrans.cpp index 01d996d49..6bf897951 100644 --- a/src/r_data/r_vanillatrans.cpp +++ b/src/r_data/r_vanillatrans.cpp @@ -32,7 +32,8 @@ #include "c_dispatch.h" #endif -CVAR (Int, r_vanillatrans, 2, CVAR_ARCHIVE) +bool r_UseVanillaTransparency; +CVAR (Int, r_vanillatrans, 0, CVAR_ARCHIVE) namespace { diff --git a/src/r_data/r_vanillatrans.h b/src/r_data/r_vanillatrans.h index 5bf1892c7..8fc88b5d7 100644 --- a/src/r_data/r_vanillatrans.h +++ b/src/r_data/r_vanillatrans.h @@ -22,4 +22,5 @@ void UpdateVanillaTransparency(); -bool UseVanillaTransparency(); \ No newline at end of file +bool UseVanillaTransparency(); +extern bool r_UseVanillaTransparency; diff --git a/src/swrenderer/things/r_sprite.cpp b/src/swrenderer/things/r_sprite.cpp index 7defbac4a..25cfd58f3 100644 --- a/src/swrenderer/things/r_sprite.cpp +++ b/src/swrenderer/things/r_sprite.cpp @@ -69,7 +69,6 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor) EXTERN_CVAR(Bool, gl_light_sprites) -EXTERN_CVAR (Bool, r_vanillatrans) namespace swrenderer { @@ -214,7 +213,7 @@ namespace swrenderer if (thing->flags5 & MF5_BRIGHT) vis->renderflags |= RF_FULLBRIGHT; // kg3D vis->RenderStyle = thing->RenderStyle; - if (UseVanillaTransparency()) + if (r_UseVanillaTransparency) { if (thing->renderflags & RF_ZDOOMTRANS) vis->RenderStyle = LegacyRenderStyles[STYLE_Normal];