From 6c4afed10068e0924bcbb3d594e8ce9de9ce05a1 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Wed, 23 Apr 2025 12:12:06 -0500 Subject: [PATCH] SpawnBlood now returns an actor spawned by the function. --- src/playsim/p_local.h | 2 +- src/playsim/p_mobj.cpp | 9 +++++---- wadsrc/static/zscript/actors/actor.zs | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/playsim/p_local.h b/src/playsim/p_local.h index 584cfc43f..6575ad3e5 100644 --- a/src/playsim/p_local.h +++ b/src/playsim/p_local.h @@ -106,7 +106,7 @@ enum EPuffFlags }; AActor *P_SpawnPuff(AActor *source, PClassActor *pufftype, const DVector3 &pos, DAngle hitdir, DAngle particledir, int updown, int flags = 0, AActor *vict = NULL); -void P_SpawnBlood (const DVector3 &pos, DAngle angle, int damage, AActor *originator); +AActor *P_SpawnBlood (const DVector3 &pos, DAngle angle, int damage, AActor *originator); void P_BloodSplatter (const DVector3 &pos, AActor *originator, DAngle hitangle); void P_BloodSplatter2 (const DVector3 &pos, AActor *originator, DAngle hitangle); void P_RipperBlood (AActor *mo, AActor *bleeder); diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 161230a25..f858a3205 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -6771,9 +6771,9 @@ DEFINE_ACTION_FUNCTION(AActor, SpawnPuff) // //--------------------------------------------------------------------------- -void P_SpawnBlood (const DVector3 &pos1, DAngle dir, int damage, AActor *originator) +AActor *P_SpawnBlood (const DVector3 &pos1, DAngle dir, int damage, AActor *originator) { - AActor *th; + AActor *th = nullptr; PClassActor *bloodcls = originator->GetBloodType(); DVector3 pos = pos1; pos.Z += pr_spawnblood.Random2() / 64.; @@ -6858,6 +6858,8 @@ void P_SpawnBlood (const DVector3 &pos1, DAngle dir, int damage, AActor *origina if (bloodtype >= 1) P_DrawSplash2 (originator->Level, 40, pos, dir, 2, originator->BloodColor); + + return th; } DEFINE_ACTION_FUNCTION(AActor, SpawnBlood) @@ -6868,8 +6870,7 @@ DEFINE_ACTION_FUNCTION(AActor, SpawnBlood) PARAM_FLOAT(z); PARAM_ANGLE(dir); PARAM_INT(damage); - P_SpawnBlood(DVector3(x, y, z), dir, damage, self); - return 0; + ACTION_RETURN_OBJECT(P_SpawnBlood(DVector3(x, y, z), dir, damage, self)); } diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 31b44fa1d..1668b3a8c 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -809,7 +809,7 @@ class Actor : Thinker native native Actor OldSpawnMissile(Actor dest, class type, Actor owner = null); native Actor SpawnPuff(class pufftype, vector3 pos, double hitdir, double particledir, int updown, int flags = 0, Actor victim = null); - native void SpawnBlood (Vector3 pos1, double dir, int damage); + native Actor SpawnBlood (Vector3 pos1, double dir, int damage); native void BloodSplatter (Vector3 pos, double hitangle, bool axe = false); native bool HitWater (sector sec, Vector3 pos, bool checkabove = false, bool alert = true, bool force = false, int flags = 0); native void PlaySpawnSound(Actor missile);