From 864fe1f66fb39e6bc87be1bec6a9803164d7fa1f Mon Sep 17 00:00:00 2001 From: Boondorl Date: Sun, 26 Jan 2025 12:20:11 -0500 Subject: [PATCH] Added translation argument for A_SprayDecal --- src/playsim/a_decals.cpp | 18 +++++++++--------- src/playsim/a_sharedglobal.h | 6 +++--- src/playsim/p_actionfunctions.cpp | 3 ++- wadsrc/static/zscript/actors/actor.zs | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/playsim/a_decals.cpp b/src/playsim/a_decals.cpp index ab40d07068..870886853e 100644 --- a/src/playsim/a_decals.cpp +++ b/src/playsim/a_decals.cpp @@ -697,7 +697,7 @@ void DImpactDecal::Expired() // //---------------------------------------------------------------------------- -DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, FTranslationID bloodTranslation) +DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, FTranslationID translation) { if (cl_maxdecals > 0) { @@ -705,7 +705,7 @@ DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, c if (tpl != NULL && (tpl = tpl->GetDecal()) != NULL) { - return StaticCreate (Level, tpl, pos, wall, ffloor, color, bloodTranslation); + return StaticCreate (Level, tpl, pos, wall, ffloor, color, translation); } } return nullptr; @@ -717,7 +717,7 @@ DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, c // //---------------------------------------------------------------------------- -DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, FTranslationID bloodTranslation, bool permanent) +DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, FTranslationID translation, bool permanent) { DBaseDecal *decal = NULL; if (tpl != NULL && ((cl_maxdecals > 0 && !(wall->Flags & WALLF_NOAUTODECALS)) || permanent)) @@ -732,7 +732,7 @@ DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplat if (tpl->ShadeColor != tpl_low->ShadeColor) lowercolor=0; else lowercolor = color; - StaticCreate (Level, tpl_low, pos, wall, ffloor, lowercolor, bloodTranslation, permanent); + StaticCreate (Level, tpl_low, pos, wall, ffloor, lowercolor, translation, permanent); } if (!permanent) decal = Level->CreateThinker(pos.Z); else decal = Level->CreateThinker(pos.Z); @@ -755,9 +755,9 @@ DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplat } // [Nash] opaque blood - if (bloodTranslation != NO_TRANSLATION && tpl->ShadeColor == 0 && tpl->opaqueBlood) + if (translation != NO_TRANSLATION && tpl->ShadeColor == 0 && tpl->opaqueBlood) { - decal->SetTranslation(bloodTranslation); + decal->SetTranslation(translation); decal->RenderStyle = STYLE_Normal; } @@ -819,7 +819,7 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl // //---------------------------------------------------------------------------- -void SprayDecal(AActor *shooter, const char *name, double distance, DVector3 offset, DVector3 direction, bool useBloodColor, uint32_t decalColor) +void SprayDecal(AActor *shooter, const char *name, double distance, DVector3 offset, DVector3 direction, bool useBloodColor, uint32_t decalColor, FTranslationID translation) { //just in case if (!shooter) @@ -847,14 +847,14 @@ void SprayDecal(AActor *shooter, const char *name, double distance, DVector3 off else dir = direction; - auto bloodTrans = useBloodColor ? shooter->BloodTranslation : NO_TRANSLATION; + auto trans = useBloodColor ? shooter->BloodTranslation : translation; PalEntry entry = !useBloodColor ? (PalEntry)decalColor : shooter->BloodColor; if (Trace(off, shooter->Sector, dir, distance, 0, ML_BLOCKEVERYTHING, shooter, trace, TRACE_NoSky)) { if (trace.HitType == TRACE_HitWall) { - DImpactDecal::StaticCreate(shooter->Level, name, trace.HitPos, trace.Line->sidedef[trace.Side], trace.ffloor, entry, bloodTrans); + DImpactDecal::StaticCreate(shooter->Level, name, trace.HitPos, trace.Line->sidedef[trace.Side], trace.ffloor, entry, trans); } } } diff --git a/src/playsim/a_sharedglobal.h b/src/playsim/a_sharedglobal.h index 4e4a9403e6..1692b9cffe 100644 --- a/src/playsim/a_sharedglobal.h +++ b/src/playsim/a_sharedglobal.h @@ -12,7 +12,7 @@ class DBaseDecal; struct SpreadInfo; DBaseDecal *ShootDecal(FLevelLocals *Level, const FDecalTemplate *tpl, sector_t *sec, double x, double y, double z, DAngle angle, double tracedist, bool permanent); -void SprayDecal(AActor *shooter, const char *name,double distance = 172., DVector3 offset = DVector3(0., 0., 0.), DVector3 direction = DVector3(0., 0., 0.), bool useBloodColor = false, uint32_t decalColor = 0); +void SprayDecal(AActor *shooter, const char *name,double distance = 172., DVector3 offset = DVector3(0., 0., 0.), DVector3 direction = DVector3(0., 0., 0.), bool useBloodColor = false, uint32_t decalColor = 0, FTranslationID translation = NO_TRANSLATION); class DBaseDecal : public DThinker { @@ -73,8 +73,8 @@ public: } void Construct(side_t *wall, const FDecalTemplate *templ); - static DBaseDecal *StaticCreate(FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, FTranslationID bloodTranslation = NO_TRANSLATION); - static DBaseDecal *StaticCreate(FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, FTranslationID bloodTranslation = NO_TRANSLATION, bool permanent = false); + static DBaseDecal *StaticCreate(FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, FTranslationID translation = NO_TRANSLATION); + static DBaseDecal *StaticCreate(FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, FTranslationID translation = NO_TRANSLATION, bool permanent = false); void BeginPlay (); void Expired() override; diff --git a/src/playsim/p_actionfunctions.cpp b/src/playsim/p_actionfunctions.cpp index 1f18209bbc..c0b0adb5f5 100644 --- a/src/playsim/p_actionfunctions.cpp +++ b/src/playsim/p_actionfunctions.cpp @@ -5070,7 +5070,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_SprayDecal) PARAM_FLOAT(direction_z); PARAM_BOOL(useBloodColor); PARAM_COLOR(decalColor); - SprayDecal(self, name.GetChars(), dist, DVector3(offset_x, offset_y, offset_z), DVector3(direction_x, direction_y, direction_z), useBloodColor, decalColor); + PARAM_INT(translation); + SprayDecal(self, name.GetChars(), dist, DVector3(offset_x, offset_y, offset_z), DVector3(direction_x, direction_y, direction_z), useBloodColor, decalColor, FTranslationID::fromInt(translation)); return 0; } diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 2d44000ab5..029855b2cc 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -1300,7 +1300,7 @@ class Actor : Thinker native native bool A_SetVisibleRotation(double anglestart = 0, double angleend = 0, double pitchstart = 0, double pitchend = 0, int flags = 0, int ptr = AAPTR_DEFAULT); native void A_SetTranslation(name transname); native bool A_SetSize(double newradius = -1, double newheight = -1, bool testpos = false); - native void A_SprayDecal(String name, double dist = 172, vector3 offset = (0, 0, 0), vector3 direction = (0, 0, 0), bool useBloodColor = false, color decalColor = 0); + native void A_SprayDecal(String name, double dist = 172, vector3 offset = (0, 0, 0), vector3 direction = (0, 0, 0), bool useBloodColor = false, color decalColor = 0, TranslationID translation = 0); native void A_SetMugshotState(String name); native void CopyBloodColor(Actor other);