A_FlickyHop is an action used for ground Flickies that checks if the actor hit the ground, and if so, makes the actor jump up and forward. Var1 specifies the upward thrust, while Var2 specifies the forward thrust. The strength of the jump will be accordingly adjusted if the actor is underwater.
Code – A_FlickyHop
|
|
// Function: A_FlickyHop
//
// Description: Flicky hopping function.
//
// var1 = vertical thrust
// var2 = horizontal thrust
//
void A_FlickyHop(mobj_t *actor)
{
INT32 locvar1 = var1;
INT32 locvar2 = var2;
if (LUA_CallAction(A_FLICKYHOP, actor))
return;
P_InternalFlickyHop(actor, locvar1, locvar2, actor->angle);
}
|
|
Code – P_InternalFlickyHop
|
|
// Internal Flicky hopping function.
void P_InternalFlickyHop(mobj_t *actor, fixed_t momz, fixed_t momh, angle_t angle)
{
if (((!(actor->eflags & MFE_VERTICALFLIP) && actor->z <= actor->floorz)
|| ((actor->eflags & MFE_VERTICALFLIP) && actor->z + actor->height >= actor->ceilingz)))
{
if (momz)
{
if (actor->eflags & MFE_UNDERWATER)
momz = FixedDiv(momz, FixedSqrt(3*FRACUNIT));
P_SetObjectMomZ(actor, momz, false);
}
P_InstaThrust(actor, angle, FixedMul(momh, actor->scale));
}
}
|
|