Export A_DoChase to zscript and make A_Chase a direct native function

This commit is contained in:
Ricardo Luís Vaz Silva 2024-03-12 19:17:20 -03:00 committed by Christoph Oelckers
parent 7f8ce13d24
commit caa4728bd4
2 changed files with 33 additions and 7 deletions

View file

@ -2899,13 +2899,8 @@ void A_Chase(AActor *self)
A_DoChase(self, false, self->MeleeState, self->MissileState, true, gameinfo.nightmarefast, false, 0); A_DoChase(self, false, self->MeleeState, self->MissileState, true, gameinfo.nightmarefast, false, 0);
} }
DEFINE_ACTION_FUNCTION(AActor, A_Chase) void A_ChaseNative(AActor * self, int meleelabel, int missilelabel, int flags)
{ {
PARAM_SELF_PROLOGUE(AActor);
PARAM_STATELABEL(meleelabel);
PARAM_STATELABEL(missilelabel);
PARAM_INT(flags);
FName meleename = ENamedName(meleelabel - 0x10000000); FName meleename = ENamedName(meleelabel - 0x10000000);
FName missilename = ENamedName(missilelabel - 0x10000000); FName missilename = ENamedName(missilelabel - 0x10000000);
if (meleename != NAME__a_chase_default || missilename != NAME__a_chase_default) if (meleename != NAME__a_chase_default || missilename != NAME__a_chase_default)
@ -2913,7 +2908,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Chase)
FState *melee = StateLabels.GetState(meleelabel, self->GetClass()); FState *melee = StateLabels.GetState(meleelabel, self->GetClass());
FState *missile = StateLabels.GetState(missilelabel, self->GetClass()); FState *missile = StateLabels.GetState(missilelabel, self->GetClass());
if ((flags & CHF_RESURRECT) && P_CheckForResurrection(self, false)) if ((flags & CHF_RESURRECT) && P_CheckForResurrection(self, false))
return 0; return;
A_DoChase(self, !!(flags&CHF_FASTCHASE), melee, missile, !(flags&CHF_NOPLAYACTIVE), A_DoChase(self, !!(flags&CHF_FASTCHASE), melee, missile, !(flags&CHF_NOPLAYACTIVE),
!!(flags&CHF_NIGHTMAREFAST), !!(flags&CHF_DONTMOVE), flags & 0x3fffffff); !!(flags&CHF_NIGHTMAREFAST), !!(flags&CHF_DONTMOVE), flags & 0x3fffffff);
@ -2922,6 +2917,36 @@ DEFINE_ACTION_FUNCTION(AActor, A_Chase)
{ {
A_DoChase(self, false, self->MeleeState, self->MissileState, true, gameinfo.nightmarefast, false, 0); A_DoChase(self, false, self->MeleeState, self->MissileState, true, gameinfo.nightmarefast, false, 0);
} }
}
DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_Chase, A_ChaseNative)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_STATELABEL(meleelabel);
PARAM_STATELABEL(missilelabel);
PARAM_INT(flags);
A_ChaseNative(self, meleelabel, missilelabel, flags);
return 0;
}
void A_DoChaseNative(AActor * self, FState *melee, FState *missile, int flags)
{
if ((flags & CHF_RESURRECT) && P_CheckForResurrection(self, false))
return;
A_DoChase(self, !!(flags&CHF_FASTCHASE), melee, missile, !(flags&CHF_NOPLAYACTIVE), !!(flags&CHF_NIGHTMAREFAST), !!(flags&CHF_DONTMOVE), flags & 0x3fffffff);
}
DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_DoChase, A_DoChaseNative)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_STATE(melee);
PARAM_STATE(missile);
PARAM_INT(flags);
A_DoChaseNative(self, melee, missile, flags);
return 0; return 0;
} }

View file

@ -1145,6 +1145,7 @@ class Actor : Thinker native
void A_Fall() { A_NoBlocking(); } void A_Fall() { A_NoBlocking(); }
native void A_Look(); native void A_Look();
native void A_Chase(statelabel melee = '_a_chase_default', statelabel missile = '_a_chase_default', int flags = 0); native void A_Chase(statelabel melee = '_a_chase_default', statelabel missile = '_a_chase_default', int flags = 0);
native void A_DoChase(State melee, State missile, int flags = 0);
native void A_VileChase(); native void A_VileChase();
native bool A_CheckForResurrection(State state = null, Sound snd = 0); native bool A_CheckForResurrection(State state = null, Sound snd = 0);
native void A_BossDeath(); native void A_BossDeath();