From bc0b0e80b51139352699e68b3b16b0e5cf3578a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= Date: Thu, 7 Feb 2019 18:06:02 +0200 Subject: [PATCH] Heretic: Whirlwind state when spawning missiles The special counters were missing when spawning MT_WHIRLWIND via custom methods. IssueID #2316 --- doomsday/apps/plugins/common/src/common.cpp | 6 ++++- .../apps/plugins/heretic/include/p_enemy.h | 1 + doomsday/apps/plugins/heretic/src/p_enemy.c | 22 +++++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/doomsday/apps/plugins/common/src/common.cpp b/doomsday/apps/plugins/common/src/common.cpp index c9a70d2351..017cf4443d 100644 --- a/doomsday/apps/plugins/common/src/common.cpp +++ b/doomsday/apps/plugins/common/src/common.cpp @@ -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); diff --git a/doomsday/apps/plugins/heretic/include/p_enemy.h b/doomsday/apps/plugins/heretic/include/p_enemy.h index f25d90b70b..76288168d2 100644 --- a/doomsday/apps/plugins/heretic/include/p_enemy.h +++ b/doomsday/apps/plugins/heretic/include/p_enemy.h @@ -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 diff --git a/doomsday/apps/plugins/heretic/src/p_enemy.c b/doomsday/apps/plugins/heretic/src/p_enemy.c index 9ebfa51af0..7edb6c3d99 100644 --- a/doomsday/apps/plugins/heretic/src/p_enemy.c +++ b/doomsday/apps/plugins/heretic/src/p_enemy.c @@ -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; } @@ -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 }; @@ -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); } }