From dd0769de80df8c6a5f2db9b895e48ad7f62d18fd Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Mon, 16 Mar 2020 22:31:58 +0800 Subject: [PATCH] Opaque blood decals must be defined with 'OpaqueBlood' keyword in DECALDEF --- src/gamedata/decallib.cpp | 9 ++++++++- src/gamedata/decallib.h | 2 ++ src/playsim/a_decals.cpp | 13 +++++++++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/gamedata/decallib.cpp b/src/gamedata/decallib.cpp index 6b471492a..6cfffb367 100644 --- a/src/gamedata/decallib.cpp +++ b/src/gamedata/decallib.cpp @@ -174,6 +174,7 @@ static const char *DecalKeywords[] = "colors", "animator", "lowerdecal", + "opaqueblood", NULL }; @@ -194,7 +195,8 @@ enum DECAL_SHADE, DECAL_COLORS, DECAL_ANIMATOR, - DECAL_LOWERDECAL + DECAL_LOWERDECAL, + DECAL_OPAQUEBLOOD, }; const FDecalTemplate *FDecalBase::GetDecal () const @@ -473,6 +475,11 @@ void FDecalLib::ParseDecal (FScanner &sc) sc.MustGetString (); newdecal.LowerDecal = GetDecalByName (sc.String); break; + + case DECAL_OPAQUEBLOOD: + newdecal.RenderStyle = STYLE_Normal; + newdecal.opaqueBlood = true; + break; } } } diff --git a/src/gamedata/decallib.h b/src/gamedata/decallib.h index 75df4ae42..6ffda460b 100644 --- a/src/gamedata/decallib.h +++ b/src/gamedata/decallib.h @@ -84,6 +84,8 @@ public: const FDecalBase *LowerDecal; enum { DECAL_RandomFlipX = 0x100, DECAL_RandomFlipY = 0x200 }; + + bool opaqueBlood; }; class FDecalLib diff --git a/src/playsim/a_decals.cpp b/src/playsim/a_decals.cpp index a7d9afcc1..8eb4af153 100644 --- a/src/playsim/a_decals.cpp +++ b/src/playsim/a_decals.cpp @@ -764,10 +764,11 @@ DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTempl decal->SetShade (color.r, color.g, color.b); } - // [Nash] For compatibility reasons, only do this if the 'Shaded' keyword is omitted from the base decal. - if (bloodTranslation != 0 && tpl->ShadeColor == 0) + // [Nash] opaque blood + if (bloodTranslation != 0 && tpl->ShadeColor == 0 && tpl->opaqueBlood) { decal->SetTranslation(bloodTranslation); + decal->RenderStyle = STYLE_Normal; } if (!cl_spreaddecals || !decal->PicNum.isValid()) @@ -803,8 +804,12 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl tpl->ApplyToDecal (decal, wall); decal->AlphaColor = AlphaColor; - // [Nash] For compatibility reasons, only do this if the 'Shaded' keyword is omitted from the base decal. - if (tpl->ShadeColor == 0) decal->SetTranslation(Translation); + // [Nash] opaque blood + if (tpl->ShadeColor == 0 && tpl->opaqueBlood) + { + decal->SetTranslation(Translation); + decal->RenderStyle = STYLE_Normal; + } decal->RenderFlags = (decal->RenderFlags & RF_DECALMASK) | (this->RenderFlags & ~RF_DECALMASK);