diff --git a/src/namedef.h b/src/namedef.h index efef8af6d2..af8028a952 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -1070,3 +1070,4 @@ xx(SpotOuterAngle) xx(lightflags) xx(lighttype) xx(InternalDynamicLight) +xx(_a_chase_default) \ No newline at end of file diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 823d803d58..54a383073c 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2769,12 +2769,16 @@ void A_Chase(AActor *self) DEFINE_ACTION_FUNCTION(AActor, A_Chase) { PARAM_SELF_PROLOGUE(AActor); - PARAM_STATE(melee); - PARAM_STATE(missile); + PARAM_STATELABEL(meleelabel); + PARAM_STATELABEL(missilelabel); PARAM_INT(flags); - if (melee != nullptr || missile != nullptr || flags != 0x40000000) + FName meleename = ENamedName(meleelabel - 0x10000000); + FName missilename = ENamedName(missilelabel - 0x10000000); + if (meleename != NAME__a_chase_default || missilename != NAME__a_chase_default) { + FState *melee = StateLabels.GetState(meleelabel, self->GetClass()); + FState *missile = StateLabels.GetState(missilelabel, self->GetClass()); if ((flags & CHF_RESURRECT) && P_CheckForResurrection(self, false)) return 0; diff --git a/src/scripting/vm/vm.h b/src/scripting/vm/vm.h index 6a80ed4345..f65440f6f0 100644 --- a/src/scripting/vm/vm.h +++ b/src/scripting/vm/vm.h @@ -509,6 +509,7 @@ bool AssertObject(void * ob); #define PARAM_ANGLE_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_FLOAT); DAngle x = param[p].f; #define PARAM_STRING_VAL_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_STRING); FString x = param[p].s(); #define PARAM_STRING_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_STRING); const FString &x = param[p].s(); +#define PARAM_STATELABEL_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); int x = param[p].i; #define PARAM_STATE_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); FState *x = (FState *)StateLabels.GetState(param[p].i, self->GetClass()); #define PARAM_STATE_ACTION_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); FState *x = (FState *)StateLabels.GetState(param[p].i, stateowner->GetClass()); #define PARAM_POINTER_AT(p,x,type) assert((p) < numparam); assert(reginfo[p] == REGT_POINTER); type *x = (type *)param[p].a; @@ -534,6 +535,7 @@ bool AssertObject(void * ob); #define PARAM_ANGLE(x) ++paramnum; PARAM_ANGLE_AT(paramnum,x) #define PARAM_STRING(x) ++paramnum; PARAM_STRING_AT(paramnum,x) #define PARAM_STRING_VAL(x) ++paramnum; PARAM_STRING_VAL_AT(paramnum,x) +#define PARAM_STATELABEL(x) ++paramnum; PARAM_STATELABEL_AT(paramnum,x) #define PARAM_STATE(x) ++paramnum; PARAM_STATE_AT(paramnum,x) #define PARAM_STATE_ACTION(x) ++paramnum; PARAM_STATE_ACTION_AT(paramnum,x) #define PARAM_POINTER(x,type) ++paramnum; PARAM_POINTER_AT(paramnum,x,type) diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index e9058c67a0..b113d12776 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -1021,7 +1021,7 @@ class Actor : Thinker native native void A_NoBlocking(bool drop = true); void A_Fall() { A_NoBlocking(); } native void A_Look(); - native void A_Chase(statelabel melee = null, statelabel missile = null, int flags = 0x40000000); + native void A_Chase(statelabel melee = '_a_chase_default', statelabel missile = '_a_chase_default', int flags = 0); native void A_VileChase(); native bool A_CheckForResurrection(); native void A_BossDeath();