mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Merge branch 'shockwave-action' into 'next'
Add a standalone action for shockwaves See merge request STJr/SRB2!1777
This commit is contained in:
commit
b238a6db50
3 changed files with 54 additions and 0 deletions
|
@ -198,6 +198,7 @@ actionpointer_t actionpointers[] =
|
|||
{{A_Boss3TakeDamage}, "A_BOSS3TAKEDAMAGE"},
|
||||
{{A_Boss3Path}, "A_BOSS3PATH"},
|
||||
{{A_Boss3ShockThink}, "A_BOSS3SHOCKTHINK"},
|
||||
{{A_Shockwave}, "A_SHOCKWAVE"},
|
||||
{{A_LinedefExecute}, "A_LINEDEFEXECUTE"},
|
||||
{{A_LinedefExecuteFromArg}, "A_LINEDEFEXECUTEFROMARG"},
|
||||
{{A_PlaySeeSound}, "A_PLAYSEESOUND"},
|
||||
|
|
|
@ -152,6 +152,7 @@ enum actionnum
|
|||
A_BOSS3TAKEDAMAGE,
|
||||
A_BOSS3PATH,
|
||||
A_BOSS3SHOCKTHINK,
|
||||
A_SHOCKWAVE,
|
||||
A_LINEDEFEXECUTE,
|
||||
A_LINEDEFEXECUTEFROMARG,
|
||||
A_PLAYSEESOUND,
|
||||
|
@ -416,6 +417,7 @@ void A_Boss1Spikeballs();
|
|||
void A_Boss3TakeDamage();
|
||||
void A_Boss3Path();
|
||||
void A_Boss3ShockThink();
|
||||
void A_Shockwave();
|
||||
void A_LinedefExecute();
|
||||
void A_LinedefExecuteFromArg();
|
||||
void A_PlaySeeSound();
|
||||
|
|
|
@ -174,6 +174,7 @@ void A_Boss1Spikeballs(mobj_t *actor);
|
|||
void A_Boss3TakeDamage(mobj_t *actor);
|
||||
void A_Boss3Path(mobj_t *actor);
|
||||
void A_Boss3ShockThink(mobj_t *actor);
|
||||
void A_Shockwave(mobj_t *actor);
|
||||
void A_LinedefExecute(mobj_t *actor);
|
||||
void A_LinedefExecuteFromArg(mobj_t *actor);
|
||||
void A_PlaySeeSound(mobj_t *actor);
|
||||
|
@ -8379,6 +8380,56 @@ void A_Boss3ShockThink(mobj_t *actor)
|
|||
}
|
||||
}
|
||||
|
||||
// Function: A_Shockwave
|
||||
//
|
||||
// Description: Spawns a shockwave of objects. Best used to spawn objects that call A_Boss3ShockThink.
|
||||
//
|
||||
// var1 = object spawned
|
||||
// var2 = amount of objects spawned
|
||||
//
|
||||
void A_Shockwave(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
INT32 i;
|
||||
|
||||
angle_t ang = 0, interval;
|
||||
mobj_t *shock = NULL, *sfirst = NULL, *sprev = NULL;
|
||||
|
||||
if (LUA_CallAction(A_SHOCKWAVE, actor))
|
||||
return;
|
||||
|
||||
if (locvar2 == 0)
|
||||
locvar2 = 24; // a sensible default, just in case
|
||||
|
||||
interval = FixedAngle((360 << FRACBITS) / locvar2);
|
||||
|
||||
for (i = 0; i < locvar2; i++)
|
||||
{
|
||||
shock = P_SpawnMobj(actor->x, actor->y, actor->z, locvar1);
|
||||
P_SetTarget(&shock->target, actor);
|
||||
shock->fuse = shock->info->painchance;
|
||||
|
||||
if (i % 2 == 0)
|
||||
P_SetMobjState(shock, shock->state->nextstate);
|
||||
|
||||
if (!sprev)
|
||||
sfirst = shock;
|
||||
else
|
||||
{
|
||||
if (i == locvar2 - 1)
|
||||
P_SetTarget(&shock->hnext, sfirst);
|
||||
P_SetTarget(&sprev->hnext, shock);
|
||||
}
|
||||
|
||||
P_Thrust(shock, ang, shock->info->speed);
|
||||
ang += interval;
|
||||
sprev = shock;
|
||||
}
|
||||
|
||||
S_StartSound(actor, shock->info->seesound);
|
||||
}
|
||||
|
||||
// Function: A_LinedefExecute
|
||||
//
|
||||
// Description: Object's location is used to set the calling sector. The tag used is var1. Optionally, if var2 is set, the actor's angle (multiplied by var2) is added to the tag number as well.
|
||||
|
|
Loading…
Reference in a new issue