A_FlickyFlounder is an action similar to A_FlickyHop but meant for underwater Flickies which makes them flop about whenever they're on land. Var1 specifies the upward thrust, while Var2 specifies the forward thrust. Unlike the aforementioned action, there is a random factor to both thrust values and the angle the actor will flounder towards.
Code – A_FlickyFlounder
|
|
// Function: A_FlickyFlounder
//
// Description: Flicky floundering function.
//
// var1 = intended vertical thrust
// var2 = intended horizontal thrust
//
void A_FlickyFlounder(mobj_t *actor)
{
INT32 locvar1 = var1;
INT32 locvar2 = var2;
angle_t hopangle;
if (LUA_CallAction(A_FLICKYFLOUNDER, actor))
return;
locvar1 *= (P_RandomKey(2) + 1);
locvar2 *= (P_RandomKey(2) + 1);
hopangle = (actor->angle + (P_RandomKey(9) - 4)*ANG2);
P_InternalFlickyHop(actor, locvar1, locvar2, hopangle);
}
|
|
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));
}
}
|
|