- started refactoring p_map.cpp
- added AActor::Top function to replace the frequent occurences of actor->z + actor->height.
This commit is contained in:
parent
b735138332
commit
43314f0c0d
7 changed files with 51 additions and 50 deletions
|
|
@ -243,9 +243,9 @@ bool AActor::CheckMeleeRange ()
|
|||
// [RH] Don't melee things too far above or below actor.
|
||||
if (!(flags5 & MF5_NOVERTICALMELEERANGE))
|
||||
{
|
||||
if (pl->Z() > Z() + height)
|
||||
if (pl->Z() > Top())
|
||||
return false;
|
||||
if (pl->Z() + pl->height < Z())
|
||||
if (pl->Top() < Z())
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -280,11 +280,11 @@ bool P_CheckMeleeRange2 (AActor *actor)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
if (mo->Z() > actor->Z()+actor->height)
|
||||
if (mo->Z() > actor->Top())
|
||||
{ // Target is higher than the attacker
|
||||
return false;
|
||||
}
|
||||
else if (actor->Z() > mo->Z()+mo->height)
|
||||
else if (actor->Z() > mo->Top())
|
||||
{ // Attacker is higher
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2787,7 +2787,7 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
|
|||
|
||||
// If the target z is above the target's head, reposition to the middle of
|
||||
// its body.
|
||||
if (target_z >= other->Z() + other->height)
|
||||
if (target_z >= other->Top())
|
||||
{
|
||||
target_z = other->Z() + (other->height / 2);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue