|
This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.
|
A_SparkFollow is an action that alters the location and angle of the actor relative to its target. In general, this action is similar to A_RotateSpikeBall
; however, if the target is not a player who is currently in Super form, the actor will be removed from the map. Also unlike A_RotateSpikeBall
, Speed
determines just the distance to the target while Damage
handles the angle increment/revolution speed. In SRB2, this was originally used for Hyper Sonic's sparks which circled around the character; however, Hyper Sonic was removed from the game in v2.0, and so this action is currently unused.
Property
|
Measurement
|
Calculation
|
Angle increment
|
Degrees
|
Damage
|
Duration of a full revolution
|
Tics
|
360 ÷ Damage or 360 ÷ Angle increment
|
Displacement/Radius from target
|
Fracunits
|
Speed ÷ FRACUNIT
|
Code – A_SparkFollow
|
|
// Function: A_SparkFollow
//
// Description: Used by the hyper sparks to rotate around their target.
//
// var1 = unused
// var2 = unused
//
void A_SparkFollow(mobj_t *actor)
{
#ifdef HAVE_BLUA
if (LUA_CallAction("A_SparkFollow", actor))
return;
#endif
if ((!actor->target || (actor->target->health <= 0))
|| (actor->target->player && !actor->target->player->powers[pw_super]))
{
P_RemoveMobj(actor);
return;
}
actor->angle += FixedAngle(actor->info->damage*FRACUNIT);
P_UnsetThingPosition(actor);
{
const angle_t fa = actor->angle>>ANGLETOFINESHIFT;
actor->x = actor->target->x + FixedMul(FINECOSINE(fa),FixedMul(actor->info->speed, actor->scale));
actor->y = actor->target->y + FixedMul(FINESINE(fa),FixedMul(actor->info->speed, actor->scale));
if (actor->target->eflags & MFE_VERTICALFLIP)
actor->z = actor->target->z + actor->target->height - FixedDiv(actor->target->height,3*FRACUNIT);
else
actor->z = actor->target->z + FixedDiv(actor->target->height,3*FRACUNIT) - actor->height;
}
P_SetThingPosition(actor);
}
|
|