A_ChickenCheck is an action that was formerly used to reset the chicken flicky once it hit the floor. When it does so, its horizontal momentum will be slowed down. When the actor stops moving completely while on the floor, if the actor's current state has an ID number greater than that of its SeeState
, the actor will use A_Chase
and return to its SeeState
.
Code – A_ChickenCheck
|
|
// Function: A_ChickenCheck
//
// Description: Resets the chicken once it hits the floor again.
//
// var1 = unused
// var2 = unused
//
void A_ChickenCheck(mobj_t *actor)
{
#ifdef HAVE_BLUA
if (LUA_CallAction("A_ChickenCheck", actor))
return;
#endif
if ((!(actor->eflags & MFE_VERTICALFLIP) && actor->z <= actor->floorz)
|| (actor->eflags & MFE_VERTICALFLIP && actor->z + actor->height >= actor->ceilingz))
{
if (!(actor->momx || actor->momy || actor->momz)
&& actor->state > &states[actor->info->seestate])
{
A_Chase(actor);
P_SetMobjState(actor, actor->info->seestate);
}
actor->momx >>= 2;
actor->momy >>= 2;
}
}
|
|