- Added 'canonical transparency' cvar r_canontrans - this simply turns off transparency for Doom objects that were marked as transparent sometime in ZDoom's development cycle

This commit is contained in:
Rachael Alexanderson 2017-06-01 10:41:52 -04:00 committed by Christoph Oelckers
parent 7acb492852
commit 01f88cfb16
19 changed files with 33 additions and 3 deletions

View file

@ -402,6 +402,7 @@ enum ActorFlag8
{ {
MF8_FRIGHTENING = 0x00000001, // for those moments when halloween just won't do MF8_FRIGHTENING = 0x00000001, // for those moments when halloween just won't do
MF8_INSCROLLSEC = 0x00000002, // actor is partially inside a scrolling sector MF8_INSCROLLSEC = 0x00000002, // actor is partially inside a scrolling sector
MF8_ZDOOMTRANS = 0x00000004, // is not normally transparent in Vanilla Doom
}; };
// --- mobj.renderflags --- // --- mobj.renderflags ---

View file

@ -75,6 +75,7 @@ CUSTOM_CVAR(Int, gl_fuzztype, 0, CVAR_ARCHIVE)
} }
EXTERN_CVAR (Float, transsouls) EXTERN_CVAR (Float, transsouls)
EXTERN_CVAR (Bool, r_canontrans)
extern TArray<spritedef_t> sprites; extern TArray<spritedef_t> sprites;
extern TArray<spriteframe_t> SpriteFrames; extern TArray<spriteframe_t> SpriteFrames;
@ -992,6 +993,13 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
{ {
trans = 1.f; trans = 1.f;
} }
if ((thing->flags8 & MF8_ZDOOMTRANS) && r_canontrans)
{ // [SP] "canonical transparency" - with the flip of a CVar, disable transparency for Doom objects
trans = 1.f;
RenderStyle.BlendOp = STYLEOP_Add;
RenderStyle.SrcAlpha = STYLEALPHA_One;
RenderStyle.DestAlpha = STYLEALPHA_Zero;
}
if (trans >= 1.f - FLT_EPSILON && RenderStyle.BlendOp != STYLEOP_Shadow && ( if (trans >= 1.f - FLT_EPSILON && RenderStyle.BlendOp != STYLEOP_Shadow && (
(RenderStyle.SrcAlpha == STYLEALPHA_One && RenderStyle.DestAlpha == STYLEALPHA_Zero) || (RenderStyle.SrcAlpha == STYLEALPHA_One && RenderStyle.DestAlpha == STYLEALPHA_Zero) ||

View file

@ -31,6 +31,7 @@
EXTERN_CVAR(Float, transsouls) EXTERN_CVAR(Float, transsouls)
EXTERN_CVAR(Int, r_drawfuzz) EXTERN_CVAR(Int, r_drawfuzz)
EXTERN_CVAR (Bool, r_canontrans)
bool RenderPolySprite::GetLine(AActor *thing, DVector2 &left, DVector2 &right) bool RenderPolySprite::GetLine(AActor *thing, DVector2 &left, DVector2 &right)
{ {
@ -145,7 +146,10 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const PolyClipPlane
args.SetStencilTestValue(stencilValue); args.SetStencilTestValue(stencilValue);
args.SetWriteStencil(true, stencilValue); args.SetWriteStencil(true, stencilValue);
args.SetClipPlane(clipPlane); args.SetClipPlane(clipPlane);
args.SetStyle(thing->RenderStyle, thing->Alpha, thing->fillcolor, thing->Translation, tex, fullbrightSprite); if ((thing->flags8 & MF8_ZDOOMTRANS) && r_canontrans)
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);
args.SetSubsectorDepthTest(true); args.SetSubsectorDepthTest(true);
args.SetWriteSubsectorDepth(false); args.SetWriteSubsectorDepth(false);
args.SetWriteStencil(false); args.SetWriteStencil(false);

View file

@ -38,6 +38,7 @@
#include "serializer.h" #include "serializer.h"
CVAR (Bool, r_drawtrans, true, 0) CVAR (Bool, r_drawtrans, true, 0)
CVAR (Bool, r_canontrans, false, CVAR_ARCHIVE)
CVAR (Int, r_drawfuzz, 1, CVAR_ARCHIVE) CVAR (Int, r_drawfuzz, 1, CVAR_ARCHIVE)
// Convert legacy render styles to flexible render styles. // Convert legacy render styles to flexible render styles.

View file

@ -325,6 +325,7 @@ static FFlagDef ActorFlagDefs[]=
DEFINE_FLAG(MF7, SPRITEFLIP, AActor, flags7), DEFINE_FLAG(MF7, SPRITEFLIP, AActor, flags7),
DEFINE_FLAG(MF8, FRIGHTENING, AActor, flags8), DEFINE_FLAG(MF8, FRIGHTENING, AActor, flags8),
DEFINE_FLAG(MF8, ZDOOMTRANS, AActor, flags8),
// Effect flags // Effect flags
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects), DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),

View file

@ -68,6 +68,7 @@
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor) EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
EXTERN_CVAR(Bool, gl_light_sprites) EXTERN_CVAR(Bool, gl_light_sprites)
EXTERN_CVAR (Bool, r_canontrans)
namespace swrenderer namespace swrenderer
{ {
@ -212,6 +213,8 @@ namespace swrenderer
if (thing->flags5 & MF5_BRIGHT) if (thing->flags5 & MF5_BRIGHT)
vis->renderflags |= RF_FULLBRIGHT; // kg3D vis->renderflags |= RF_FULLBRIGHT; // kg3D
vis->RenderStyle = thing->RenderStyle; vis->RenderStyle = thing->RenderStyle;
if ((thing->flags8 & MF8_ZDOOMTRANS) && r_canontrans)
vis->RenderStyle = LegacyRenderStyles[STYLE_Normal];
vis->FillColor = thing->fillcolor; vis->FillColor = thing->fillcolor;
vis->Translation = thing->Translation; // [RH] thing translation table vis->Translation = thing->Translation; // [RH] thing translation table
vis->FakeFlatStat = fakeside; vis->FakeFlatStat = fakeside;

View file

@ -72,6 +72,7 @@ class ArachnotronPlasma : Actor
Damage 5; Damage 5;
Projectile; Projectile;
+RANDOMIZE +RANDOMIZE
+ZDOOMTRANS
RenderStyle "Add"; RenderStyle "Add";
Alpha 0.75; Alpha 0.75;
SeeSound "baby/attack"; SeeSound "baby/attack";

View file

@ -70,7 +70,7 @@ class ArchvileFire : Actor
{ {
Default Default
{ {
+NOBLOCKMAP +NOGRAVITY +NOBLOCKMAP +NOGRAVITY +ZDOOMTRANS
RenderStyle "Add"; RenderStyle "Add";
Alpha 1; Alpha 1;
} }

View file

@ -120,6 +120,7 @@ class SpawnFire : Actor
Height 78; Height 78;
+NOBLOCKMAP +NOBLOCKMAP
+NOGRAVITY +NOGRAVITY
+ZDOOMTRANS
RenderStyle "Add"; RenderStyle "Add";
} }
States States

View file

@ -121,6 +121,7 @@ class BaronBall : Actor
Damage 8; Damage 8;
Projectile ; Projectile ;
+RANDOMIZE +RANDOMIZE
+ZDOOMTRANS
RenderStyle "Add"; RenderStyle "Add";
Alpha 1; Alpha 1;
SeeSound "baron/attack"; SeeSound "baron/attack";

View file

@ -71,6 +71,7 @@ class CacodemonBall : Actor
Damage 5; Damage 5;
Projectile; Projectile;
+RANDOMIZE +RANDOMIZE
+ZDOOMTRANS
RenderStyle "Add"; RenderStyle "Add";
Alpha 1; Alpha 1;
SeeSound "caco/attack"; SeeSound "caco/attack";

View file

@ -97,6 +97,7 @@ class BlurSphere : PowerupGiver
{ {
+COUNTITEM +COUNTITEM
+VISIBILITYPULSE +VISIBILITYPULSE
+ZDOOMTRANS
+INVENTORY.AUTOACTIVATE +INVENTORY.AUTOACTIVATE
+INVENTORY.ALWAYSPICKUP +INVENTORY.ALWAYSPICKUP
+INVENTORY.BIGPOWERUP +INVENTORY.BIGPOWERUP

View file

@ -77,6 +77,7 @@ class DoomImpBall : Actor
Damage 3; Damage 3;
Projectile; Projectile;
+RANDOMIZE +RANDOMIZE
+ZDOOMTRANS
RenderStyle "Add"; RenderStyle "Add";
Alpha 1; Alpha 1;
SeeSound "imp/attack"; SeeSound "imp/attack";

View file

@ -61,6 +61,7 @@ class BulletPuff : Actor
+NOGRAVITY +NOGRAVITY
+ALLOWPARTICLES +ALLOWPARTICLES
+RANDOMIZE +RANDOMIZE
+ZDOOMTRANS
RenderStyle "Translucent"; RenderStyle "Translucent";
Alpha 0.5; Alpha 0.5;
VSpeed 1; VSpeed 1;

View file

@ -74,6 +74,7 @@ class FatShot : Actor
Damage 8; Damage 8;
Projectile; Projectile;
+RANDOMIZE +RANDOMIZE
+ZDOOMTRANS
RenderStyle "Add"; RenderStyle "Add";
Alpha 1; Alpha 1;
SeeSound "fatso/attack"; SeeSound "fatso/attack";

View file

@ -15,7 +15,7 @@ class LostSoul : Actor
Damage 3; Damage 3;
PainChance 256; PainChance 256;
Monster; Monster;
+FLOAT +NOGRAVITY +MISSILEMORE +DONTFALL +NOICEDEATH; +FLOAT +NOGRAVITY +MISSILEMORE +DONTFALL +NOICEDEATH +ZDOOMTRANS;
AttackSound "skull/melee"; AttackSound "skull/melee";
PainSound "skull/pain"; PainSound "skull/pain";
DeathSound "skull/death"; DeathSound "skull/death";

View file

@ -80,6 +80,7 @@ class RevenantTracer : Actor
Projectile; Projectile;
+SEEKERMISSILE +SEEKERMISSILE
+RANDOMIZE +RANDOMIZE
+ZDOOMTRANS
SeeSound "skeleton/attack"; SeeSound "skeleton/attack";
DeathSound "skeleton/tracex"; DeathSound "skeleton/tracex";
RenderStyle "Add"; RenderStyle "Add";
@ -110,6 +111,7 @@ class RevenantTracerSmoke : Actor
+NOBLOCKMAP +NOBLOCKMAP
+NOGRAVITY +NOGRAVITY
+NOTELEPORT +NOTELEPORT
+ZDOOMTRANS
RenderStyle "Translucent"; RenderStyle "Translucent";
Alpha 0.5; Alpha 0.5;
} }

View file

@ -142,6 +142,7 @@ class BFGBall : Actor
Damage 100; Damage 100;
Projectile; Projectile;
+RANDOMIZE +RANDOMIZE
+ZDOOMTRANS
RenderStyle "Add"; RenderStyle "Add";
Alpha 0.75; Alpha 0.75;
DeathSound "weapons/bfgx"; DeathSound "weapons/bfgx";

View file

@ -51,6 +51,7 @@ class PlasmaBall : Actor
Damage 5; Damage 5;
Projectile; Projectile;
+RANDOMIZE +RANDOMIZE
+ZDOOMTRANS
RenderStyle "Add"; RenderStyle "Add";
Alpha 0.75; Alpha 0.75;
SeeSound "weapons/plasmaf"; SeeSound "weapons/plasmaf";