- Changed MF7_SPRITEFLIP, MF8_ZDOOMTRANS to RenderFlags

- Added RF_ZDOOMADD
- renamed r_canontrans to r_vanillatrans
- this developer's insanity level has increased by 231%.
This commit is contained in:
Rachael Alexanderson 2017-06-01 13:13:30 -04:00
parent eeaf6214f7
commit 00bfee8b1e
8 changed files with 46 additions and 23 deletions

View file

@ -396,13 +396,11 @@ enum ActorFlag7
MF7_FORCEZERORADIUSDMG = 0x10000000, // passes zero radius damage on to P_DamageMobj, this is necessary in some cases where DoSpecialDamage gets overrideen. MF7_FORCEZERORADIUSDMG = 0x10000000, // passes zero radius damage on to P_DamageMobj, this is necessary in some cases where DoSpecialDamage gets overrideen.
MF7_NOINFIGHTSPECIES = 0x20000000, // don't start infights with one's own species. MF7_NOINFIGHTSPECIES = 0x20000000, // don't start infights with one's own species.
MF7_FORCEINFIGHTING = 0x40000000, // overrides a map setting of 'no infighting'. MF7_FORCEINFIGHTING = 0x40000000, // overrides a map setting of 'no infighting'.
MF7_SPRITEFLIP = 0x80000000, // sprite flipped on x-axis
}; };
enum ActorFlag8 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 ---
@ -444,6 +442,10 @@ enum ActorRenderFlag
RF_INTERPOLATEANGLES = 0x01000000, // [MC] Allow interpolation of the actor's angle, pitch and roll. RF_INTERPOLATEANGLES = 0x01000000, // [MC] Allow interpolation of the actor's angle, pitch and roll.
RF_MAYBEINVISIBLE = 0x02000000, RF_MAYBEINVISIBLE = 0x02000000,
RF_DONTINTERPOLATE = 0x04000000, // no render interpolation ever! RF_DONTINTERPOLATE = 0x04000000, // no render interpolation ever!
RF_SPRITEFLIP = 0x08000000, // sprite flipped on x-axis
RF_ZDOOMTRANS = 0x10000000, // is not normally transparent in Vanilla Doom
RF_ZDOOMADD = 0x20000000, // is not normally additive in Vanilla Hexen/Heretic/Strife
}; };
// This translucency value produces the closest match to Heretic's TINTTAB. // This translucency value produces the closest match to Heretic's TINTTAB.

View file

@ -75,7 +75,7 @@ CUSTOM_CVAR(Int, gl_fuzztype, 0, CVAR_ARCHIVE)
} }
EXTERN_CVAR (Float, transsouls) EXTERN_CVAR (Float, transsouls)
EXTERN_CVAR (Bool, r_canontrans) EXTERN_CVAR (Bool, r_vanillatrans)
extern TArray<spritedef_t> sprites; extern TArray<spritedef_t> sprites;
extern TArray<spriteframe_t> SpriteFrames; extern TArray<spriteframe_t> SpriteFrames;
@ -801,7 +801,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
sprangle = 0.; sprangle = 0.;
rot = 0; rot = 0;
} }
patch = sprites[spritenum].GetSpriteFrame(thing->frame, rot, sprangle, &mirror, !!(thing->flags7 & MF7_SPRITEFLIP)); patch = sprites[spritenum].GetSpriteFrame(thing->frame, rot, sprangle, &mirror, !!(thing->renderflags & RF_SPRITEFLIP));
} }
if (!patch.isValid()) return; if (!patch.isValid()) return;
@ -817,7 +817,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
gltexture->GetSpriteRect(&r); gltexture->GetSpriteRect(&r);
// [SP] SpriteFlip // [SP] SpriteFlip
if (thing->flags7 & MF7_SPRITEFLIP) if (thing->renderflags & RF_SPRITEFLIP)
thing->renderflags ^= RF_XFLIP; thing->renderflags ^= RF_XFLIP;
if (mirror ^ !!(thing->renderflags & RF_XFLIP)) if (mirror ^ !!(thing->renderflags & RF_XFLIP))
@ -832,7 +832,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
ur = gltexture->GetSpriteUL(); ur = gltexture->GetSpriteUL();
} }
if (thing->flags7 & MF7_SPRITEFLIP) // [SP] Flip back if (thing->renderflags & RF_SPRITEFLIP) // [SP] Flip back
thing->renderflags ^= RF_XFLIP; thing->renderflags ^= RF_XFLIP;
r.Scale(sprscale.X, sprscale.Y); r.Scale(sprscale.X, sprscale.Y);
@ -993,14 +993,25 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
{ {
trans = 1.f; trans = 1.f;
} }
if ((thing->flags8 & MF8_ZDOOMTRANS) && r_canontrans) if (r_vanillatrans)
{ // [SP] "canonical transparency" - with the flip of a CVar, disable transparency for Doom objects {
trans = 1.f; // [SP] "canonical transparency" - with the flip of a CVar, disable transparency for Doom objects,
RenderStyle.BlendOp = STYLEOP_Add; // and disable 'additive' translucency for certain objects from other games.
RenderStyle.SrcAlpha = STYLEALPHA_One; if (thing->renderflags & RF_ZDOOMTRANS)
RenderStyle.DestAlpha = STYLEALPHA_Zero; {
} trans = 1.f;
RenderStyle.BlendOp = STYLEOP_Add;
RenderStyle.SrcAlpha = STYLEALPHA_One;
RenderStyle.DestAlpha = STYLEALPHA_Zero;
}
if (thing->renderflags & RF_ZDOOMADD)
{
RenderStyle.BlendOp = STYLEOP_Add;
RenderStyle.SrcAlpha = STYLEALPHA_Src;
RenderStyle.DestAlpha = STYLEALPHA_InvSrc;
}
}
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) ||
(RenderStyle.SrcAlpha == STYLEALPHA_Src && RenderStyle.DestAlpha == STYLEALPHA_InvSrc) (RenderStyle.SrcAlpha == STYLEALPHA_Src && RenderStyle.DestAlpha == STYLEALPHA_InvSrc)

View file

@ -31,7 +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) EXTERN_CVAR (Bool, r_vanillatrans)
bool RenderPolySprite::GetLine(AActor *thing, DVector2 &left, DVector2 &right) bool RenderPolySprite::GetLine(AActor *thing, DVector2 &left, DVector2 &right)
{ {
@ -146,8 +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);
if ((thing->flags8 & MF8_ZDOOMTRANS) && r_canontrans) if ((thing->renderflags & RF_ZDOOMTRANS) && r_vanillatrans)
args.SetStyle(LegacyRenderStyles[STYLE_Normal], 1.0f, thing->fillcolor, thing->Translation, tex, fullbrightSprite); args.SetStyle(LegacyRenderStyles[STYLE_Normal], 1.0f, thing->fillcolor, thing->Translation, tex, fullbrightSprite);
else if ((thing->renderflags & RF_ZDOOMADD) && r_vanillatrans)
args.SetStyle(LegacyRenderStyles[STYLE_Translucent], thing->Alpha, thing->fillcolor, thing->Translation, tex, fullbrightSprite);
else else
args.SetStyle(thing->RenderStyle, thing->Alpha, thing->fillcolor, thing->Translation, tex, fullbrightSprite); args.SetStyle(thing->RenderStyle, thing->Alpha, thing->fillcolor, thing->Translation, tex, fullbrightSprite);
args.SetSubsectorDepthTest(true); args.SetSubsectorDepthTest(true);

View file

@ -38,7 +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 (Bool, r_vanillatrans, 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

@ -322,10 +322,8 @@ static FFlagDef ActorFlagDefs[]=
DEFINE_FLAG(MF7, FORCEZERORADIUSDMG, AActor, flags7), DEFINE_FLAG(MF7, FORCEZERORADIUSDMG, AActor, flags7),
DEFINE_FLAG(MF7, NOINFIGHTSPECIES, AActor, flags7), DEFINE_FLAG(MF7, NOINFIGHTSPECIES, AActor, flags7),
DEFINE_FLAG(MF7, FORCEINFIGHTING, AActor, flags7), DEFINE_FLAG(MF7, FORCEINFIGHTING, 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),
@ -347,6 +345,9 @@ static FFlagDef ActorFlagDefs[]=
DEFINE_FLAG(RF, YFLIP, AActor, renderflags), DEFINE_FLAG(RF, YFLIP, AActor, renderflags),
DEFINE_FLAG(RF, INTERPOLATEANGLES, AActor, renderflags), DEFINE_FLAG(RF, INTERPOLATEANGLES, AActor, renderflags),
DEFINE_FLAG(RF, DONTINTERPOLATE, AActor, renderflags), DEFINE_FLAG(RF, DONTINTERPOLATE, AActor, renderflags),
DEFINE_FLAG(RF, SPRITEFLIP, AActor, renderflags),
DEFINE_FLAG(RF, ZDOOMTRANS, AActor, renderflags),
DEFINE_FLAG(RF, ZDOOMADD, AActor, renderflags),
// Bounce flags // Bounce flags
DEFINE_FLAG2(BOUNCE_Walls, BOUNCEONWALLS, AActor, BounceFlags), DEFINE_FLAG2(BOUNCE_Walls, BOUNCEONWALLS, AActor, BounceFlags),

View file

@ -1007,7 +1007,7 @@ namespace swrenderer
DAngle sprangle = thing->GetSpriteAngle((sprite.pos - viewpoint.Pos).Angle(), viewpoint.TicFrac); DAngle sprangle = thing->GetSpriteAngle((sprite.pos - viewpoint.Pos).Angle(), viewpoint.TicFrac);
bool flipX; bool flipX;
FTextureID tex = sprdef->GetSpriteFrame(thing->frame, -1, sprangle, &flipX, !!(thing->flags7 & MF7_SPRITEFLIP)); FTextureID tex = sprdef->GetSpriteFrame(thing->frame, -1, sprangle, &flipX, !!(thing->renderflags & RF_SPRITEFLIP));
if (tex.isValid()) if (tex.isValid())
{ {
if (flipX) if (flipX)

View file

@ -68,7 +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) EXTERN_CVAR (Bool, r_vanillatrans)
namespace swrenderer namespace swrenderer
{ {
@ -147,7 +147,7 @@ namespace swrenderer
renderflags ^= renderportal->MirrorFlags & RF_XFLIP; renderflags ^= renderportal->MirrorFlags & RF_XFLIP;
// [SP] SpriteFlip // [SP] SpriteFlip
if (thing->flags7 & MF7_SPRITEFLIP) if (thing->renderflags & RF_SPRITEFLIP)
renderflags ^= RF_XFLIP; renderflags ^= RF_XFLIP;
// calculate edges of the shape // calculate edges of the shape
@ -213,8 +213,13 @@ 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) if (r_vanillatrans)
vis->RenderStyle = LegacyRenderStyles[STYLE_Normal]; {
if (thing->renderflags & RF_ZDOOMTRANS)
vis->RenderStyle = LegacyRenderStyles[STYLE_Normal];
if (thing->renderflags & RF_ZDOOMADD)
vis->RenderStyle = LegacyRenderStyles[STYLE_Translucent];
}
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

@ -75,6 +75,7 @@ class BeastBall : Actor
-NOBLOCKMAP -NOBLOCKMAP
+WINDTHRUST +WINDTHRUST
+SPAWNSOUNDSOURCE +SPAWNSOUNDSOURCE
+ZDOOMADD
RenderStyle "Add"; RenderStyle "Add";
SeeSound "beast/attack"; SeeSound "beast/attack";
} }
@ -104,6 +105,7 @@ class Puffy : Actor
+MISSILE +MISSILE
+NOTELEPORT +NOTELEPORT
+DONTSPLASH +DONTSPLASH
+ZDOOMADD
RenderStyle "Add"; RenderStyle "Add";
} }
States States