mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-23 03:41:03 +00:00
Colorize opaque decals using the bleeding actor's blood color, if the 'Shaded' keyword is omitted from the DECALDEF.
# Conflicts: # src/g_shared/a_decals.cpp # src/g_shared/a_sharedglobal.h # src/p_map.cpp
This commit is contained in:
parent
1770cead0c
commit
152ae71a4f
3 changed files with 40 additions and 7 deletions
|
@ -185,6 +185,17 @@ void DBaseDecal::SetShade (int r, int g, int b)
|
||||||
AlphaColor = MAKEARGB(ColorMatcher.Pick (r, g, b), r, g, b);
|
AlphaColor = MAKEARGB(ColorMatcher.Pick (r, g, b), r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void DBaseDecal::SetTranslation(uint32_t trans)
|
||||||
|
{
|
||||||
|
Translation = trans;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
// Returns the texture the decal stuck to.
|
// Returns the texture the decal stuck to.
|
||||||
FTextureID DBaseDecal::StickToWall (side_t *wall, double x, double y, F3DFloor *ffloor)
|
FTextureID DBaseDecal::StickToWall (side_t *wall, double x, double y, F3DFloor *ffloor)
|
||||||
{
|
{
|
||||||
|
@ -585,7 +596,7 @@ void DImpactDecal::CheckMax ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DImpactDecal *DImpactDecal::StaticCreate (const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
|
DImpactDecal *DImpactDecal::StaticCreate (const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, uint32_t bloodTranslation)
|
||||||
{
|
{
|
||||||
if (cl_maxdecals > 0)
|
if (cl_maxdecals > 0)
|
||||||
{
|
{
|
||||||
|
@ -593,13 +604,19 @@ DImpactDecal *DImpactDecal::StaticCreate (const char *name, const DVector3 &pos,
|
||||||
|
|
||||||
if (tpl != NULL && (tpl = tpl->GetDecal()) != NULL)
|
if (tpl != NULL && (tpl = tpl->GetDecal()) != NULL)
|
||||||
{
|
{
|
||||||
return StaticCreate (tpl, pos, wall, ffloor, color);
|
return StaticCreate (tpl, pos, wall, ffloor, color, bloodTranslation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, uint32_t bloodTranslation)
|
||||||
{
|
{
|
||||||
DImpactDecal *decal = NULL;
|
DImpactDecal *decal = NULL;
|
||||||
if (tpl != NULL && cl_maxdecals > 0 && !(wall->Flags & WALLF_NOAUTODECALS))
|
if (tpl != NULL && cl_maxdecals > 0 && !(wall->Flags & WALLF_NOAUTODECALS))
|
||||||
|
@ -613,7 +630,10 @@ DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, const DVect
|
||||||
// apply the custom color as well.
|
// apply the custom color as well.
|
||||||
if (tpl->ShadeColor != tpl_low->ShadeColor) lowercolor=0;
|
if (tpl->ShadeColor != tpl_low->ShadeColor) lowercolor=0;
|
||||||
else lowercolor = color;
|
else lowercolor = color;
|
||||||
StaticCreate (tpl_low, pos, wall, ffloor, lowercolor);
|
|
||||||
|
uint32_t lowerTrans = (bloodTranslation != 0 ? bloodTranslation : 0);
|
||||||
|
|
||||||
|
StaticCreate (tpl_low, pos, wall, ffloor, lowercolor, lowerTrans);
|
||||||
}
|
}
|
||||||
DImpactDecal::CheckMax();
|
DImpactDecal::CheckMax();
|
||||||
decal = Create<DImpactDecal>(pos.Z);
|
decal = Create<DImpactDecal>(pos.Z);
|
||||||
|
@ -633,6 +653,12 @@ DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, const DVect
|
||||||
decal->SetShade (color.r, color.g, color.b);
|
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)
|
||||||
|
{
|
||||||
|
decal->SetTranslation(bloodTranslation);
|
||||||
|
}
|
||||||
|
|
||||||
if (!cl_spreaddecals || !decal->PicNum.isValid())
|
if (!cl_spreaddecals || !decal->PicNum.isValid())
|
||||||
{
|
{
|
||||||
return decal;
|
return decal;
|
||||||
|
@ -659,6 +685,10 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl
|
||||||
{
|
{
|
||||||
tpl->ApplyToDecal (decal, wall);
|
tpl->ApplyToDecal (decal, wall);
|
||||||
decal->AlphaColor = AlphaColor;
|
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);
|
||||||
|
|
||||||
decal->RenderFlags = (decal->RenderFlags & RF_DECALMASK) |
|
decal->RenderFlags = (decal->RenderFlags & RF_DECALMASK) |
|
||||||
(this->RenderFlags & ~RF_DECALMASK);
|
(this->RenderFlags & ~RF_DECALMASK);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ public:
|
||||||
double GetRealZ (const side_t *wall) const;
|
double GetRealZ (const side_t *wall) const;
|
||||||
void SetShade (uint32_t rgb);
|
void SetShade (uint32_t rgb);
|
||||||
void SetShade (int r, int g, int b);
|
void SetShade (int r, int g, int b);
|
||||||
|
void SetTranslation(uint32_t trans);
|
||||||
void Spread (const FDecalTemplate *tpl, side_t *wall, double x, double y, double z, F3DFloor * ffloor);
|
void Spread (const FDecalTemplate *tpl, side_t *wall, double x, double y, double z, F3DFloor * ffloor);
|
||||||
void GetXY (side_t *side, double &x, double &y) const;
|
void GetXY (side_t *side, double &x, double &y) const;
|
||||||
|
|
||||||
|
@ -63,8 +64,8 @@ public:
|
||||||
DImpactDecal(double z);
|
DImpactDecal(double z);
|
||||||
DImpactDecal (side_t *wall, const FDecalTemplate *templ);
|
DImpactDecal (side_t *wall, const FDecalTemplate *templ);
|
||||||
|
|
||||||
static DImpactDecal *StaticCreate(const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0);
|
static DImpactDecal *StaticCreate(const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, uint32_t bloodTranslation = 0);
|
||||||
static DImpactDecal *StaticCreate(const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0);
|
static DImpactDecal *StaticCreate(const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, uint32_t bloodTranslation = 0);
|
||||||
|
|
||||||
void BeginPlay ();
|
void BeginPlay ();
|
||||||
void OnDestroy() override;
|
void OnDestroy() override;
|
||||||
|
|
|
@ -4978,8 +4978,10 @@ void P_TraceBleed(int damage, const DVector3 &pos, AActor *actor, DAngle angle,
|
||||||
bloodcolor.a = 1;
|
bloodcolor.a = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t bloodTrans = (bloodcolor != 0 ? actor->BloodTranslation : 0);
|
||||||
|
|
||||||
DImpactDecal::StaticCreate(bloodType, bleedtrace.HitPos,
|
DImpactDecal::StaticCreate(bloodType, bleedtrace.HitPos,
|
||||||
bleedtrace.Line->sidedef[bleedtrace.Side], bleedtrace.ffloor, bloodcolor);
|
bleedtrace.Line->sidedef[bleedtrace.Side], bleedtrace.ffloor, bloodcolor, bloodTrans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue