mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 13:01:47 +00:00
- scriptified P_CheckMeleeRange2.
This commit is contained in:
parent
e4e86dd4f8
commit
2e7e6cba9d
4 changed files with 45 additions and 51 deletions
|
@ -317,56 +317,6 @@ DEFINE_ACTION_FUNCTION(AActor, CheckMeleeRange)
|
|||
ACTION_RETURN_INT(self->CheckMeleeRange());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// FUNC P_CheckMeleeRange2
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
bool P_CheckMeleeRange2 (AActor *actor)
|
||||
{
|
||||
AActor *mo;
|
||||
double dist;
|
||||
|
||||
|
||||
if (!actor->target || (actor->Sector->Flags & SECF_NOATTACK))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
mo = actor->target;
|
||||
dist = mo->Distance2D (actor);
|
||||
if (dist >= 128 || dist < actor->meleerange + mo->radius)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (mo->Z() > actor->Top())
|
||||
{ // Target is higher than the attacker
|
||||
return false;
|
||||
}
|
||||
else if (actor->Z() > mo->Top())
|
||||
{ // Attacker is higher
|
||||
return false;
|
||||
}
|
||||
else if (actor->IsFriend(mo))
|
||||
{
|
||||
// killough 7/18/98: friendly monsters don't attack other friends
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!P_CheckSight(actor, mo))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, CheckMeleeRange2)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
ACTION_RETURN_INT(P_CheckMeleeRange2(self));
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// P_CheckMissileRange
|
||||
|
|
|
@ -663,7 +663,6 @@ class Actor : Thinker native
|
|||
|
||||
native void SetIdle(bool nofunction = false);
|
||||
native bool CheckMeleeRange();
|
||||
native bool CheckMeleeRange2();
|
||||
native virtual int DamageMobj(Actor inflictor, Actor source, int damage, Name mod, int flags = 0, double angle = 0);
|
||||
native void PoisonMobj (Actor inflictor, Actor source, int damage, int duration, int period, Name type);
|
||||
native double AimLineAttack(double angle, double distance, out FTranslatedLineTarget pLineTarget = null, double vrange = 0., int flags = 0, Actor target = null, Actor friender = null);
|
||||
|
|
|
@ -290,6 +290,50 @@ class Serpent : Actor
|
|||
}
|
||||
}
|
||||
|
||||
extend class Actor
|
||||
{
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// FUNC P_CheckMeleeRange2
|
||||
//
|
||||
// This belongs to the Serpent but was initially exported on Actor
|
||||
// so it needs to remain there.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
bool CheckMeleeRange2 ()
|
||||
{
|
||||
Actor mo;
|
||||
double dist;
|
||||
|
||||
|
||||
if (!target || (CurSector.Flags & Sector.SECF_NOATTACK))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
mo = target;
|
||||
dist = mo.Distance2D (self);
|
||||
if (dist >= 128 || dist < meleerange + mo.radius)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (mo.pos.Z > pos.Z + height)
|
||||
{ // Target is higher than the attacker
|
||||
return false;
|
||||
}
|
||||
else if (pos.Z > mo.pos.Z + mo.height)
|
||||
{ // Attacker is higher
|
||||
return false;
|
||||
}
|
||||
else if (IsFriend(mo))
|
||||
{
|
||||
// killough 7/18/98: friendly monsters don't attack other friends
|
||||
return false;
|
||||
}
|
||||
return CheckSight(mo);
|
||||
}
|
||||
}
|
||||
|
||||
// Serpent Leader -----------------------------------------------------------
|
||||
|
||||
class SerpentLeader : Serpent
|
||||
|
|
|
@ -334,6 +334,7 @@ struct Sector native play
|
|||
SECF_ENDGODMODE = 256, // getting damaged by this sector ends god mode
|
||||
SECF_ENDLEVEL = 512, // ends level when health goes below 10
|
||||
SECF_HAZARD = 1024, // Change to Strife's delayed damage handling.
|
||||
SECF_NOATTACK = 2048, // monsters cannot start attacks in this sector.
|
||||
|
||||
SECF_WASSECRET = 1 << 30, // a secret that was discovered
|
||||
SECF_SECRET = 1 << 31, // a secret sector
|
||||
|
|
Loading…
Reference in a new issue