From 5bcbe1718b61b81d1db23d4cc502eb7fa9f5f161 Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Thu, 30 Jan 2025 20:23:54 +0800 Subject: [PATCH] New "Translatable" property in DECALDEF which is just an alias for "OpaqueBlood" to reflect its general use, and also to support the new translation parameter of A_SprayDecal. "OpaqueBlood" should be considered deprecated. Note that specifying a translation directly in the DECALDEF will be added in future, in another commit. --- src/gamedata/decallib.cpp | 7 +++++-- src/gamedata/decallib.h | 2 +- src/playsim/a_decals.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/gamedata/decallib.cpp b/src/gamedata/decallib.cpp index 0f6e656b5f..609a876873 100644 --- a/src/gamedata/decallib.cpp +++ b/src/gamedata/decallib.cpp @@ -175,7 +175,8 @@ static const char *DecalKeywords[] = "colors", "animator", "lowerdecal", - "opaqueblood", + "opaqueblood", // Deprecated - use translatable instead! + "translatable", NULL }; @@ -198,6 +199,7 @@ enum DECAL_ANIMATOR, DECAL_LOWERDECAL, DECAL_OPAQUEBLOOD, + DECAL_TRANSLATABLE, }; const FDecalTemplate *FDecalBase::GetDecal () const @@ -483,8 +485,9 @@ void FDecalLib::ParseDecal (FScanner &sc) break; case DECAL_OPAQUEBLOOD: + case DECAL_TRANSLATABLE: newdecal.RenderStyle = STYLE_Normal; - newdecal.opaqueBlood = true; + newdecal.translatable = true; break; } } diff --git a/src/gamedata/decallib.h b/src/gamedata/decallib.h index ac07b252f1..9bb3b9ce57 100644 --- a/src/gamedata/decallib.h +++ b/src/gamedata/decallib.h @@ -81,7 +81,7 @@ public: FRenderStyle RenderStyle; FTextureID PicNum; uint16_t RenderFlags; - bool opaqueBlood; + bool translatable; double Alpha; // same as actor->alpha const FDecalAnimator *Animator; const FDecalBase *LowerDecal; diff --git a/src/playsim/a_decals.cpp b/src/playsim/a_decals.cpp index 870886853e..0729c49885 100644 --- a/src/playsim/a_decals.cpp +++ b/src/playsim/a_decals.cpp @@ -754,8 +754,8 @@ DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplat decal->SetShade (color.r, color.g, color.b); } - // [Nash] opaque blood - if (translation != NO_TRANSLATION && tpl->ShadeColor == 0 && tpl->opaqueBlood) + // [Nash] Translatable opaque decal. Note that the decal must be unshaded for this to work. + if (translation != NO_TRANSLATION && tpl->ShadeColor == 0 && tpl->translatable) { decal->SetTranslation(translation); decal->RenderStyle = STYLE_Normal; @@ -794,8 +794,8 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl tpl->ApplyToDecal (decal, wall); decal->AlphaColor = AlphaColor; - // [Nash] opaque blood - if (tpl->ShadeColor == 0 && tpl->opaqueBlood) + // [Nash] Translatable opaque decal + if (tpl->ShadeColor == 0 && tpl->translatable) { decal->SetTranslation(Translation); decal->RenderStyle = STYLE_Normal;