mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- Added A_Remove(int pointer, int flags).
- RMVF_MISSILES removes missiles. - RMVF_NOMONSTERS ignores monsters. - RMVF_MISC includes non-monsters and missiles. - RMVF_EVERYTHING disregards all checks and remove it. These flags now apply to the following in addition to the new function: -A_RemoveTarget -A_RemoveMaster -A_RemoveTracer -A_RemoveChildren -A_RemoveSiblings
This commit is contained in:
parent
1fe5082eac
commit
43b86288c7
3 changed files with 133 additions and 68 deletions
|
@ -3671,65 +3671,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFlag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//
|
|
||||||
// A_RemoveMaster
|
|
||||||
//
|
|
||||||
//===========================================================================
|
|
||||||
DEFINE_ACTION_FUNCTION(AActor, A_RemoveMaster)
|
|
||||||
{
|
|
||||||
if (self->master != NULL)
|
|
||||||
{
|
|
||||||
P_RemoveThing(self->master);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//
|
|
||||||
// A_RemoveChildren
|
|
||||||
//
|
|
||||||
//===========================================================================
|
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveChildren)
|
|
||||||
{
|
|
||||||
TThinkerIterator<AActor> it;
|
|
||||||
AActor *mo;
|
|
||||||
ACTION_PARAM_START(1);
|
|
||||||
ACTION_PARAM_BOOL(removeall,0);
|
|
||||||
|
|
||||||
while ((mo = it.Next()) != NULL)
|
|
||||||
{
|
|
||||||
if (mo->master == self && (mo->health <= 0 || removeall))
|
|
||||||
{
|
|
||||||
P_RemoveThing(mo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//
|
|
||||||
// A_RemoveSiblings
|
|
||||||
//
|
|
||||||
//===========================================================================
|
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveSiblings)
|
|
||||||
{
|
|
||||||
TThinkerIterator<AActor> it;
|
|
||||||
AActor *mo;
|
|
||||||
ACTION_PARAM_START(1);
|
|
||||||
ACTION_PARAM_BOOL(removeall,0);
|
|
||||||
|
|
||||||
if (self->master != NULL)
|
|
||||||
{
|
|
||||||
while ((mo = it.Next()) != NULL)
|
|
||||||
{
|
|
||||||
if (mo->master == self->master && mo != self && (mo->health <= 0 || removeall))
|
|
||||||
{
|
|
||||||
P_RemoveThing(mo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// A_RaiseMaster
|
// A_RaiseMaster
|
||||||
|
@ -5063,7 +5004,6 @@ static void DoKill(AActor *killtarget, AActor *self, FName damagetype, int flags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// A_KillTarget(damagetype, int flags)
|
// A_KillTarget(damagetype, int flags)
|
||||||
|
@ -5149,6 +5089,39 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KillSiblings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// DoRemove
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
enum RMVF_flags
|
||||||
|
{
|
||||||
|
RMVF_MISSILES = 1 << 0,
|
||||||
|
RMVF_NOMONSTERS = 1 << 1,
|
||||||
|
RMVF_MISC = 1 << 2,
|
||||||
|
RMVF_EVERYTHING = 1 << 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void DoRemove(AActor *removetarget, int flags)
|
||||||
|
{
|
||||||
|
if ((flags & RMVF_EVERYTHING))
|
||||||
|
{
|
||||||
|
P_RemoveThing(removetarget);
|
||||||
|
}
|
||||||
|
if ((flags & RMVF_MISC) && !((removetarget->flags3 & MF3_ISMONSTER) && (removetarget->flags & MF_MISSILE)))
|
||||||
|
{
|
||||||
|
P_RemoveThing(removetarget);
|
||||||
|
}
|
||||||
|
if ((removetarget->flags3 & MF3_ISMONSTER) && !(flags & RMVF_NOMONSTERS))
|
||||||
|
{
|
||||||
|
P_RemoveThing(removetarget);
|
||||||
|
}
|
||||||
|
if ((removetarget->flags & MF_MISSILE) && (flags & RMVF_MISSILES))
|
||||||
|
{
|
||||||
|
P_RemoveThing(removetarget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
|
@ -5157,7 +5130,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KillSiblings)
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
DEFINE_ACTION_FUNCTION(AActor, A_RemoveTarget)
|
DEFINE_ACTION_FUNCTION(AActor, A_RemoveTarget)
|
||||||
{
|
{
|
||||||
if (self->target != NULL)
|
if ((self->target != NULL) && (self->tracer->flags3 & MF3_ISMONSTER))
|
||||||
{
|
{
|
||||||
P_RemoveThing(self->target);
|
P_RemoveThing(self->target);
|
||||||
}
|
}
|
||||||
|
@ -5170,8 +5143,90 @@ DEFINE_ACTION_FUNCTION(AActor, A_RemoveTarget)
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
DEFINE_ACTION_FUNCTION(AActor, A_RemoveTracer)
|
DEFINE_ACTION_FUNCTION(AActor, A_RemoveTracer)
|
||||||
{
|
{
|
||||||
if (self->tracer != NULL)
|
if ((self->tracer != NULL) && (self->tracer->flags3 & MF3_ISMONSTER))
|
||||||
{
|
{
|
||||||
P_RemoveThing(self->tracer);
|
P_RemoveThing(self->tracer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// A_RemoveMaster
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveMaster)
|
||||||
|
{
|
||||||
|
ACTION_PARAM_START(1);
|
||||||
|
ACTION_PARAM_INT(flags, 0);
|
||||||
|
if (self->master != NULL)
|
||||||
|
{
|
||||||
|
DoRemove(self->master, flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// A_RemoveChildren
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveChildren)
|
||||||
|
{
|
||||||
|
TThinkerIterator<AActor> it;
|
||||||
|
AActor *mo;
|
||||||
|
ACTION_PARAM_START(2);
|
||||||
|
ACTION_PARAM_BOOL(removeall, 0);
|
||||||
|
ACTION_PARAM_INT(flags, 1);
|
||||||
|
|
||||||
|
while ((mo = it.Next()) != NULL)
|
||||||
|
{
|
||||||
|
if (mo->master == self && (mo->health <= 0 || removeall))
|
||||||
|
{
|
||||||
|
DoRemove(mo, flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// A_RemoveSiblings
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveSiblings)
|
||||||
|
{
|
||||||
|
TThinkerIterator<AActor> it;
|
||||||
|
AActor *mo;
|
||||||
|
ACTION_PARAM_START(2);
|
||||||
|
ACTION_PARAM_BOOL(removeall, 0);
|
||||||
|
ACTION_PARAM_INT(flags, 1);
|
||||||
|
|
||||||
|
if (self->master != NULL)
|
||||||
|
{
|
||||||
|
while ((mo = it.Next()) != NULL)
|
||||||
|
{
|
||||||
|
if (mo->master == self->master && mo != self && (mo->health <= 0 || removeall))
|
||||||
|
{
|
||||||
|
DoRemove(mo, flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// A_Remove
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Remove)
|
||||||
|
{
|
||||||
|
ACTION_PARAM_START(2);
|
||||||
|
ACTION_PARAM_INT(removee, 0);
|
||||||
|
ACTION_PARAM_INT(flags, 1);
|
||||||
|
|
||||||
|
AActor *reference = COPY_AAPTR(self, removee);
|
||||||
|
|
||||||
|
if (reference != NULL)
|
||||||
|
{
|
||||||
|
DoRemove(reference, flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -234,9 +234,9 @@ ACTOR Actor native //: Thinker
|
||||||
action native A_ChangeFlag(string flagname, bool value);
|
action native A_ChangeFlag(string flagname, bool value);
|
||||||
action native A_CheckFlag(string flagname, state label, int check_pointer = AAPTR_DEFAULT);
|
action native A_CheckFlag(string flagname, state label, int check_pointer = AAPTR_DEFAULT);
|
||||||
action native A_JumpIf(bool expression, state label);
|
action native A_JumpIf(bool expression, state label);
|
||||||
action native A_RemoveMaster();
|
action native A_RemoveMaster(int flags = 0);
|
||||||
action native A_RemoveChildren(bool removeall = false);
|
action native A_RemoveChildren(bool removeall = false, int flags = 0);
|
||||||
action native A_RemoveSiblings(bool removeall = false);
|
action native A_RemoveSiblings(bool removeall = false, int flags = 0);
|
||||||
action native A_KillMaster(name damagetype = "none", int flags = 0);
|
action native A_KillMaster(name damagetype = "none", int flags = 0);
|
||||||
action native A_KillChildren(name damagetype = "none", int flags = 0);
|
action native A_KillChildren(name damagetype = "none", int flags = 0);
|
||||||
action native A_KillSiblings(name damagetype = "none", int flags = 0);
|
action native A_KillSiblings(name damagetype = "none", int flags = 0);
|
||||||
|
@ -309,8 +309,9 @@ ACTOR Actor native //: Thinker
|
||||||
action native A_DamageTracer(int amount, name damagetype = "none", int flags = 0);
|
action native A_DamageTracer(int amount, name damagetype = "none", int flags = 0);
|
||||||
action native A_KillTarget(name damagetype = "none", int flags = 0);
|
action native A_KillTarget(name damagetype = "none", int flags = 0);
|
||||||
action native A_KillTracer(name damagetype = "none", int flags = 0);
|
action native A_KillTracer(name damagetype = "none", int flags = 0);
|
||||||
action native A_RemoveTarget();
|
action native A_RemoveTarget(int flags = 0);
|
||||||
action native A_RemoveTracer();
|
action native A_RemoveTracer(int flags = 0);
|
||||||
|
action native A_Remove(int removee, int flags = 0);
|
||||||
|
|
||||||
action native A_CheckSightOrRange(float distance, state label);
|
action native A_CheckSightOrRange(float distance, state label);
|
||||||
action native A_CheckRange(float distance, state label);
|
action native A_CheckRange(float distance, state label);
|
||||||
|
|
|
@ -380,6 +380,15 @@ const int AMF_TARGETEMITTER = 1;
|
||||||
const int AMF_TARGETNONPLAYER = 2;
|
const int AMF_TARGETNONPLAYER = 2;
|
||||||
const int AMF_EMITFROMTARGET = 4;
|
const int AMF_EMITFROMTARGET = 4;
|
||||||
|
|
||||||
|
// Flags for A_Remove*
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
RMVF_MISSILES = 1 << 0,
|
||||||
|
RMVF_NOMONSTERS = 1 << 1,
|
||||||
|
RMVF_MISC = 1 << 2,
|
||||||
|
RMVF_EVERYTHING = 1 << 3
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// This is only here to provide one global variable for testing.
|
// This is only here to provide one global variable for testing.
|
||||||
native int testglobalvar;
|
native int testglobalvar;
|
||||||
|
|
Loading…
Reference in a new issue