Skip to content

Commit

Permalink
Heretic: Whirlwind state when spawning missiles
Browse files Browse the repository at this point in the history
The special counters were missing when spawning MT_WHIRLWIND via custom methods.

IssueID #2316
  • Loading branch information
skyjake committed Feb 7, 2019
1 parent 4093875 commit bc0b0e8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
6 changes: 5 additions & 1 deletion doomsday/apps/plugins/common/src/common.cpp
Expand Up @@ -158,11 +158,15 @@ static de::Value *Function_Thing_SpawnMissile(de::Context &ctx, const de::Functi
#if defined(__JHERETIC__)
if (mobj_t *mis = P_SpawnMissile(missileId, src, src->target, true))
{
if (missileId == MT_MUMMYFX1 || missileId == MT_WHIRLWIND)
if (missileId == MT_MUMMYFX1)
{
// Tracer is used to keep track of where the missile is homing.
mis->tracer = src->target;
}
else if (missileId == MT_WHIRLWIND)
{
P_InitWhirlwind(mis, src->target);
}
}
#else
P_SpawnMissile(missileId, src, src->target);
Expand Down
1 change: 1 addition & 0 deletions doomsday/apps/plugins/heretic/include/p_enemy.h
Expand Up @@ -40,6 +40,7 @@ void P_ClearBodyQueue(void);
int P_Massacre(void);
void P_NoiseAlert(mobj_t* target, mobj_t* emitter);
int P_Attack(mobj_t *actor, int meleeDamage, mobjtype_t missileType);
void P_InitWhirlwind(mobj_t *whirlwind, mobj_t *target);
void P_DSparilTeleport(mobj_t* actor);

#ifdef __cplusplus
Expand Down
22 changes: 15 additions & 7 deletions doomsday/apps/plugins/heretic/src/p_enemy.c
Expand Up @@ -1590,11 +1590,15 @@ int P_Attack(mobj_t *actor, int meleeDamage, mobjtype_t missileType)
mobj_t *mis;
if ((mis = P_SpawnMissile(missileType, actor, actor->target, true)) != NULL)
{
if (missileType == MT_MUMMYFX1 || missileType == MT_WHIRLWIND)
if (missileType == MT_MUMMYFX1)
{
// Tracer is used to keep track of where the missile is homing.
mis->tracer = actor->target;
}
else if (missileType == MT_WHIRLWIND)
{
P_InitWhirlwind(mis, actor->target);
}
}
return 2;
}
Expand All @@ -1618,6 +1622,15 @@ void C_DECL A_BeastAttack(mobj_t* actor)
P_SpawnMissile(MT_BEASTBALL, actor, actor->target, true);
}

void P_InitWhirlwind(mobj_t *whirlwind, mobj_t *target)
{
whirlwind->origin[VZ] -= 32;
whirlwind->special1 = 60;
whirlwind->special2 = 50; // Timer for active sound.
whirlwind->special3 = 20 * TICSPERSEC; // Duration.
whirlwind->tracer = target;
}

void C_DECL A_HeadAttack(mobj_t* actor)
{
static int atkResolve1[] = { 50, 150 };
Expand Down Expand Up @@ -1686,12 +1699,7 @@ void C_DECL A_HeadAttack(mobj_t* actor)
// Whirlwind.
if((mo = P_SpawnMissile(MT_WHIRLWIND, actor, target, true)))
{
mo->origin[VZ] -= 32;
mo->tracer = target;
mo->special1 = 60;
mo->special2 = 50; // Timer for active sound.
mo->special3 = 20 * TICSPERSEC; // Duration.

P_InitWhirlwind(mo, target);
S_StartSound(SFX_HEDAT3, actor);
}
}
Expand Down

0 comments on commit bc0b0e8

Please sign in to comment.