Skip to content

Commit

Permalink
Opaque blood decals must be defined with 'OpaqueBlood' keyword in DEC…
Browse files Browse the repository at this point in the history
…ALDEF
  • Loading branch information
nashmuhandes authored and coelckers committed Mar 23, 2020
1 parent 8facd5f commit dd0769d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/gamedata/decallib.cpp
Expand Up @@ -174,6 +174,7 @@ static const char *DecalKeywords[] =
"colors",
"animator",
"lowerdecal",
"opaqueblood",
NULL
};

Expand All @@ -194,7 +195,8 @@ enum
DECAL_SHADE,
DECAL_COLORS,
DECAL_ANIMATOR,
DECAL_LOWERDECAL
DECAL_LOWERDECAL,
DECAL_OPAQUEBLOOD,
};

const FDecalTemplate *FDecalBase::GetDecal () const
Expand Down Expand Up @@ -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;
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/gamedata/decallib.h
Expand Up @@ -84,6 +84,8 @@ class FDecalTemplate : public FDecalBase
const FDecalBase *LowerDecal;

enum { DECAL_RandomFlipX = 0x100, DECAL_RandomFlipY = 0x200 };

bool opaqueBlood;
};

class FDecalLib
Expand Down
13 changes: 9 additions & 4 deletions src/playsim/a_decals.cpp
Expand Up @@ -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())
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit dd0769d

Please sign in to comment.