|
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_OldRingExplode is an action that makes the actor explode like the old Explosion Ring from version 1.09.4. Var1 sets the Object type used for the debris. The debris is thrown at a fixed speed of 20 fracunits/tic. 34 debris Objects are spawned in total, all fired in different directions – 16 directly sideways in different angles, 8 diagonally upwards, 8 diagonally downwards, one directly upwards, and one directly downwards. All debris objects additionally have their targets set to match the actor's, are colored to match their target if it is a player, are given MF2_DEBRIS
and last only 5 tics each before disappearing.
Code – A_OldRingExplode
|
|
// Function: A_OldRingExplode
//
// Description: An explosion ring exploding, 1.09.4 style
//
// var1 = object # to explode as debris
// var2 = unused
//
void A_OldRingExplode(mobj_t *actor) {
UINT8 i;
mobj_t *mo;
const fixed_t ns = FixedMul(20 * FRACUNIT, actor->scale);
INT32 locvar1 = var1;
//INT32 locvar2 = var2;
boolean changecolor = (actor->target && actor->target->player);
#ifdef HAVE_BLUA
if (LUA_CallAction("A_OldRingExplode", actor))
return;
#endif
for (i = 0; i < 32; i++)
{
const angle_t fa = (i*FINEANGLES/16) & FINEMASK;
mo = P_SpawnMobj(actor->x, actor->y, actor->z, locvar1);
P_SetTarget(&mo->target, actor->target); // Transfer target so player gets the points
mo->momx = FixedMul(FINECOSINE(fa),ns);
mo->momy = FixedMul(FINESINE(fa),ns);
if (i > 15)
{
if (i & 1)
mo->momz = ns;
else
mo->momz = -ns;
}
mo->flags2 |= MF2_DEBRIS;
mo->fuse = TICRATE/5;
if (changecolor)
{
if (gametype != GT_CTF)
mo->color = actor->target->color; //copy color
else if (actor->target->player->ctfteam == 2)
mo->color = skincolor_bluering;
}
}
mo = P_SpawnMobj(actor->x, actor->y, actor->z, locvar1);
P_SetTarget(&mo->target, actor->target);
mo->momz = ns;
mo->flags2 |= MF2_DEBRIS;
mo->fuse = TICRATE/5;
if (changecolor)
{
if (gametype != GT_CTF)
mo->color = actor->target->color; //copy color
else if (actor->target->player->ctfteam == 2)
mo->color = skincolor_bluering;
}
mo = P_SpawnMobj(actor->x, actor->y, actor->z, locvar1);
P_SetTarget(&mo->target, actor->target);
mo->momz = -ns;
mo->flags2 |= MF2_DEBRIS;
mo->fuse = TICRATE/5;
if (changecolor)
{
if (gametype != GT_CTF)
mo->color = actor->target->color; //copy color
else if (actor->target->player->ctfteam == 2)
mo->color = skincolor_bluering;
}
}
|
|