Merge remote-tracking branch 'gzdoom/master' into newmaster

This commit is contained in:
Major Cooke 2020-03-23 13:23:20 -05:00
commit 1c886e8ec3
7 changed files with 52 additions and 14 deletions

View file

@ -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;
}
}
}

View file

@ -79,6 +79,7 @@ public:
FRenderStyle RenderStyle;
FTextureID PicNum;
uint16_t RenderFlags;
bool opaqueBlood;
double Alpha; // same as actor->alpha
const FDecalAnimator *Animator;
const FDecalBase *LowerDecal;

View file

@ -242,6 +242,17 @@ void DBaseDecal::SetShade (int r, int g, int 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.
@ -696,7 +707,7 @@ void DImpactDecal::Expired()
//
//----------------------------------------------------------------------------
DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, uint32_t bloodTranslation)
{
if (cl_maxdecals > 0)
{
@ -704,7 +715,7 @@ DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name,
if (tpl != NULL && (tpl = tpl->GetDecal()) != NULL)
{
return StaticCreate (Level, tpl, pos, wall, ffloor, color);
return StaticCreate (Level, tpl, pos, wall, ffloor, color, bloodTranslation);
}
}
return NULL;
@ -716,7 +727,7 @@ DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name,
//
//----------------------------------------------------------------------------
DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, uint32_t bloodTranslation)
{
DImpactDecal *decal = NULL;
if (tpl != NULL && cl_maxdecals > 0 && !(wall->Flags & WALLF_NOAUTODECALS))
@ -730,7 +741,10 @@ DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTempl
// apply the custom color as well.
if (tpl->ShadeColor != tpl_low->ShadeColor) lowercolor=0;
else lowercolor = color;
StaticCreate (Level, tpl_low, pos, wall, ffloor, lowercolor);
uint32_t lowerTrans = (bloodTranslation != 0 ? bloodTranslation : 0);
StaticCreate (Level, tpl_low, pos, wall, ffloor, lowercolor, lowerTrans);
}
decal = Level->CreateThinker<DImpactDecal>(pos.Z);
if (decal == NULL)
@ -750,6 +764,13 @@ DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTempl
decal->SetShade (color.r, color.g, color.b);
}
// [Nash] opaque blood
if (bloodTranslation != 0 && tpl->ShadeColor == 0 && tpl->opaqueBlood)
{
decal->SetTranslation(bloodTranslation);
decal->RenderStyle = STYLE_Normal;
}
if (!cl_spreaddecals || !decal->PicNum.isValid())
{
return decal;
@ -782,6 +803,14 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl
decal->CheckMax();
tpl->ApplyToDecal (decal, wall);
decal->AlphaColor = AlphaColor;
// [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);
}

View file

@ -31,6 +31,7 @@ public:
double GetRealZ (const side_t *wall) const;
void SetShade (uint32_t rgb);
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 GetXY (side_t *side, double &x, double &y) const;
@ -68,8 +69,8 @@ public:
}
void Construct(side_t *wall, const FDecalTemplate *templ);
static DImpactDecal *StaticCreate(FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0);
static DImpactDecal *StaticCreate(FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0);
static DImpactDecal *StaticCreate(FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, uint32_t bloodTranslation = 0);
static DImpactDecal *StaticCreate(FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, uint32_t bloodTranslation = 0);
void BeginPlay ();
void Expired() override;

View file

@ -4967,8 +4967,10 @@ void P_TraceBleed(int damage, const DVector3 &pos, AActor *actor, DAngle angle,
bloodcolor.a = 1;
}
uint32_t bloodTrans = (bloodcolor != 0 ? actor->BloodTranslation : 0);
DImpactDecal::StaticCreate(actor->Level, bloodType, bleedtrace.HitPos,
bleedtrace.Line->sidedef[bleedtrace.Side], bleedtrace.ffloor, bloodcolor);
bleedtrace.Line->sidedef[bleedtrace.Side], bleedtrace.ffloor, bloodcolor, bloodTrans);
}
}
}

View file

@ -1120,12 +1120,6 @@ void DFrameBuffer::FillBorder (FTexture *img)
{
float myratio = ActiveRatio (Width, Height);
// if 21:9 AR, fill borders akin to 16:9, since all fullscreen
// images are being drawn to that scale.
if (myratio > 1.7f) {
myratio = 16 / 9.0f;
}
if (myratio >= 1.3f && myratio <= 1.4f)
{ // This is a 4:3 display, so no border to show
return;

View file

@ -94,6 +94,10 @@ public:
TIterator operator-(difference_type offset) const { return TIterator(m_ptr - offset); }
difference_type operator-(const TIterator &other) const { return m_ptr - other.m_ptr; }
// Random access operators
T& operator[](difference_type i) { return m_ptr[i]; }
const T& operator[](difference_type i) const { return m_ptr[i]; }
T &operator*() { return *m_ptr; }
const T &operator*() const { return *m_ptr; }
T* operator->() { return m_ptr; }