Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZScript monster AI exports #659

Merged
merged 2 commits into from
Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 60 additions & 0 deletions src/scripting/vmthunks_actors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,35 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, LookForPlayers, P_LookForPlayers)
ACTION_RETURN_BOOL(P_LookForPlayers(self, allaround, params));
}

static int CheckMonsterUseSpecials(AActor *self)
{
spechit_t spec;
int good = 0;

if (!(self->flags6 & MF6_NOTRIGGER))
{
while (spechit.Pop (spec))
{
// [RH] let monsters push lines, as well as use them
if (((self->flags4 & MF4_CANUSEWALLS) && P_ActivateLine (spec.line, self, 0, SPAC_Use)) ||
((self->flags2 & MF2_PUSHWALL) && P_ActivateLine (spec.line, self, 0, SPAC_Push)))
{
good |= spec.line == self->BlockingLine ? 1 : 2;
}
}
}
else spechit.Clear();

return good;
}

DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckMonsterUseSpecials, CheckMonsterUseSpecials)
{
PARAM_SELF_PROLOGUE(AActor);

ACTION_RETURN_INT(CheckMonsterUseSpecials(self));
}

DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_Wander, A_Wander)
{
PARAM_SELF_PROLOGUE(AActor);
Expand Down Expand Up @@ -1582,6 +1611,37 @@ DEFINE_ACTION_FUNCTION_NATIVE(AKey, GetKeyType, P_GetKeyType)
ACTION_RETURN_POINTER(P_GetKeyType(num));
}

//=====================================================================================
//
// 3D Floor exports
//
//=====================================================================================
int CheckFor3DFloorHit(AActor *self, double z, bool trigger)
{
return P_CheckFor3DFloorHit(self, z, trigger);
}
DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckFor3DFloorHit, CheckFor3DFloorHit)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT(z);
PARAM_BOOL(trigger);

ACTION_RETURN_BOOL(P_CheckFor3DFloorHit(self, z, trigger));
}

int CheckFor3DCeilingHit(AActor *self, double z, bool trigger)
{
return P_CheckFor3DCeilingHit(self, z, trigger);
}
DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckFor3DCeilingHit, CheckFor3DCeilingHit)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT(z);
PARAM_BOOL(trigger);

ACTION_RETURN_BOOL(P_CheckFor3DCeilingHit(self, z, trigger));
}



DEFINE_FIELD(AActor, snext)
Expand Down
3 changes: 3 additions & 0 deletions wadsrc/static/zscript/actor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,9 @@ class Actor : Thinker native
native clearscope Actor GetPointer(int aaptr);
native double BulletSlope(out FTranslatedLineTarget pLineTarget = null, int aimflags = 0);
native void CheckFakeFloorTriggers (double oldz, bool oldz_has_viewheight = false);
native bool CheckFor3DFloorHit(double z, bool trigger);
native bool CheckFor3DCeilingHit(double z, bool trigger);
native int CheckMonsterUseSpecials();

native bool CheckMissileSpawn(double maxdist);
native bool CheckPosition(Vector2 pos, bool actorsonly = false, FCheckPosition tm = null);
Expand Down