|
This article or section is outdated and has not been fully updated to reflect the current version of SRB2.
Please help the Wiki by correcting or removing any misinformation, as well as adding any new information to the page.
|
|
To do Update for 2.2.0:
- Var1 has a new option that can be combined with either of the old ones
|
A_BossScream is an action that spawns explosions (Object type of the explosions is set by Var2, default is MT_SONIC3KBOSSEXPLODE
) around the actor and plays its DeathSound
. This action needs to be called over multiple states for many explosions to be spawned, it only spawns one explosion each time. If Var1 is set to 0, the angle each explosion is spawned at is spread evenly across multiple uses of the action, each explosion being separated by 64 degrees each time A_BossScream
is used. If Var1 is set to 1, the explosions are instead positioned at a randomized angle around the actor. The explosions are always spawned away from the actor at a distance of its radius, but their vertical offsets can range from 8 fracunits below the bottom of the actor to ~56 fracunits above it, decided randomly.
Object property |
Use
|
DeathSound |
Explosion sound
|
Code – A_BossScream
|
|
// Function: A_BossScream
//
// Description: Spawns explosions and plays appropriate sounds around the defeated boss.
//
// var1:
// & 1 - Use P_Random to spawn explosions at complete random
// & 2 - Use entire vertical range of object to spawn
// var2 = Object to spawn. Default is MT_SONIC3KBOSSEXPLODE.
//
void A_BossScream(mobj_t *actor)
{
mobj_t *mo;
fixed_t x, y, z;
angle_t fa;
INT32 locvar1 = var1;
INT32 locvar2 = var2;
mobjtype_t explodetype;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_BossScream", actor))
return;
#endif
if (locvar1 & 1)
fa = (FixedAngle(P_RandomKey(360)*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK;
else
{
actor->movecount += 4*16;
actor->movecount %= 360;
fa = (FixedAngle(actor->movecount*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK;
}
x = actor->x + FixedMul(FINECOSINE(fa),actor->radius);
y = actor->y + FixedMul(FINESINE(fa),actor->radius);
// Determine what mobj to spawn. If undefined or invalid, use MT_BOSSEXPLODE as default.
if (locvar2 <= 0 || locvar2 >= NUMMOBJTYPES)
explodetype = MT_SONIC3KBOSSEXPLODE; //MT_BOSSEXPLODE; -- piss to you, sonic 2
else
explodetype = (mobjtype_t)locvar2;
if (locvar1 & 2)
z = actor->z + (P_RandomKey((actor->height - mobjinfo[explodetype].height)>>FRACBITS)<<FRACBITS);
else if (actor->eflags & MFE_VERTICALFLIP)
z = actor->z + actor->height - mobjinfo[explodetype].height - FixedMul((P_RandomByte()<<(FRACBITS-2)) - 8*FRACUNIT, actor->scale);
else
z = actor->z + FixedMul((P_RandomByte()<<(FRACBITS-2)) - 8*FRACUNIT, actor->scale);
mo = P_SpawnMobj(x, y, z, explodetype);
if (actor->eflags & MFE_VERTICALFLIP)
mo->flags2 |= MF2_OBJECTFLIP;
mo->destscale = actor->scale;
P_SetScale(mo, mo->destscale);
if (actor->info->deathsound)
S_StartSound(mo, actor->info->deathsound);
}
|
|