|
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_MultiShot is an action that shoots multiple Objects horizontally that spread evenly in all directions around the actor. The number of missiles is specified by the lower 16 bits of Var1 (it cannot exceed 90), the missile type is defined by the upper 16 bits. Var2 determines height offset.
After firing, the actor's reaction time is set to a new value determined by the actor's ReactionTime
. Normally, the reaction time is set to a value of ReactionTime*TICRATE*2
(or 2×ReactionTime
seconds). In Ultimate mode, it is set to ReactionTime*TICRATE
(or ReactionTime
seconds) instead. However, if the actor has MF_BOSS
, the actor's reaction time will not be changed.
This action originates from the v2.0 modification SRB2Morphed and was added to SRB2 itself in v2.1.
Code – A_MultiShot
|
|
// Function: A_MultiShot
//
// Description: Shoots objects horizontally that spread evenly in all directions.
//
// var1:
// lower 16 bits = number of missiles
// upper 16 bits = missile type #
// var2 = height offset
//
void A_MultiShot(mobj_t *actor)
{
fixed_t z, xr, yr;
INT32 locvar1 = var1;
INT32 locvar2 = var2;
const UINT16 loc1lw = (UINT16)(locvar1 & 65535);
const UINT16 loc1up = (UINT16)(locvar1 >> 16);
INT32 count = 0;
fixed_t ad;
#ifdef HAVE_BLUA
if (LUA_CallAction("A_MultiShot", actor))
return;
#endif
if (actor->target)
A_FaceTarget(actor);
if(loc1lw > 90)
ad = FixedMul(90*FRACUNIT, actor->scale);
else
ad = FixedMul(loc1lw*FRACUNIT, actor->scale);
if (actor->eflags & MFE_VERTICALFLIP)
z = actor->z + actor->height - FixedMul(48*FRACUNIT + locvar2*FRACUNIT, actor->scale);
else
z = actor->z + FixedMul(48*FRACUNIT + locvar2*FRACUNIT, actor->scale);
xr = FixedMul((P_SignedRandom()/3)<<FRACBITS, actor->scale); // please note p_mobj.c's P_Rand() abuse
yr = FixedMul((P_SignedRandom()/3)<<FRACBITS, actor->scale); // of rand(), RAND_MAX and signness mess
while(count <= loc1lw && loc1lw >= 1)
{
const angle_t fa = FixedAngleC(count*FRACUNIT*360, ad)>>ANGLETOFINESHIFT;
const fixed_t rc = FINECOSINE(fa);
const fixed_t rs = FINESINE(fa);
const fixed_t xrc = FixedMul(xr, rc);
const fixed_t yrs = FixedMul(yr, rs);
const fixed_t xrs = FixedMul(xr, rs);
const fixed_t yrc = FixedMul(yr, rc);
P_SpawnPointMissile(actor, xrc-yrs+actor->x, xrs+yrc+actor->y, z, loc1up, actor->x, actor->y, z);
count++;
}
if (!(actor->flags & MF_BOSS))
{
if (ultimatemode)
actor->reactiontime = actor->info->reactiontime*TICRATE;
else
actor->reactiontime = actor->info->reactiontime*TICRATE*2;
}
}
|
|