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..04c0ea0e6 100644 --- a/src/gamedata/decallib.h +++ b/src/gamedata/decallib.h @@ -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; diff --git a/src/playsim/a_decals.cpp b/src/playsim/a_decals.cpp index 97a9ce5c3..8eb4af153 100644 --- a/src/playsim/a_decals.cpp +++ b/src/playsim/a_decals.cpp @@ -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(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); } diff --git a/src/playsim/a_sharedglobal.h b/src/playsim/a_sharedglobal.h index 77d30acbb..9396b10a8 100644 --- a/src/playsim/a_sharedglobal.h +++ b/src/playsim/a_sharedglobal.h @@ -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; diff --git a/src/playsim/p_map.cpp b/src/playsim/p_map.cpp index 00d47aa37..ae0eecef0 100644 --- a/src/playsim/p_map.cpp +++ b/src/playsim/p_map.cpp @@ -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); } } } diff --git a/src/rendering/2d/v_draw.cpp b/src/rendering/2d/v_draw.cpp index 473db44a8..13589073f 100644 --- a/src/rendering/2d/v_draw.cpp +++ b/src/rendering/2d/v_draw.cpp @@ -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; diff --git a/src/utility/tarray.h b/src/utility/tarray.h index ca4d86bc7..32ccc50ce 100644 --- a/src/utility/tarray.h +++ b/src/utility/tarray.h @@ -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; }