Hardcoded A_LookForBetter

This commit is contained in:
Monster Iestyn 2019-05-03 19:14:17 +01:00
parent a0220454fd
commit 6cd2b73273
3 changed files with 29 additions and 0 deletions

View file

@ -2231,6 +2231,7 @@ static actionpointer_t actionpointers[] =
{{A_Boss5Calm}, "A_BOSS5CALM"},
{{A_Boss5CheckOnGround}, "A_BOSS5CHECKONGROUND"},
{{A_Boss5CheckFalling}, "A_BOSS5CHECKFALLING"},
{{A_LookForBetter}, "A_LOOKFORBETTER"},
{{NULL}, "NONE"},

View file

@ -245,6 +245,7 @@ void A_Boss5ExtraRepeat();
void A_Boss5Calm();
void A_Boss5CheckOnGround();
void A_Boss5CheckFalling();
void A_LookForBetter();
// ratio of states to sprites to mobj types is roughly 6 : 1 : 1
#define NUMMOBJFREESLOTS 256

View file

@ -272,6 +272,7 @@ void A_Boss5ExtraRepeat(mobj_t *actor);
void A_Boss5Calm(mobj_t *actor);
void A_Boss5CheckOnGround(mobj_t *actor);
void A_Boss5CheckFalling(mobj_t *actor);
void A_LookForBetter(mobj_t *actor);
//for p_enemy.c
//
@ -12050,3 +12051,29 @@ void A_Boss5CheckFalling(mobj_t *actor)
if (P_MobjFlip(actor)*actor->momz <= 0)
P_SetMobjState(actor, locvar2);
}
// Function: A_LookForBetter
//
// Description: A_Look, except it finds a better target in multiplayer, and doesn't lose the target in singleplayer.
//
// var1 lower 16 bits = 0 - looks only in front, 1 - looks all around
// var1 upper 16 bits = distance limit
// var2 = unused
//
void A_LookForBetter(mobj_t *actor)
{
INT32 locvar1 = var1;
//INT32 locvar2 = var2;
mobj_t *oldtarget = NULL;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_LookForBetter", actor))
return;
#endif
P_SetTarget(&oldtarget, actor->target);
if (!P_LookForPlayers(actor, (locvar1 & 65535), false, FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale)))
P_SetTarget(&actor->target, oldtarget);
A_FaceTarget(actor);
}