From 452ad99821dcf6385e0042632dd1a47562b3a10c Mon Sep 17 00:00:00 2001 From: BjossiAlfreds Date: Mon, 24 Jul 2023 21:42:18 +0000 Subject: [PATCH] Fixed gunner grenade duck code running twice --- src/monster/gunner/gunner.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/monster/gunner/gunner.c b/src/monster/gunner/gunner.c index 8b8da24..394e687 100644 --- a/src/monster/gunner/gunner.c +++ b/src/monster/gunner/gunner.c @@ -509,14 +509,6 @@ gunner_duck_down(edict_t *self) self->monsterinfo.aiflags |= AI_DUCKED; - if (skill->value >= SKILL_HARD) - { - if (random() > 0.5) - { - GunnerGrenade(self); - } - } - self->maxs[2] = self->monsterinfo.base_height - 32; self->takedamage = DAMAGE_YES; @@ -528,8 +520,23 @@ gunner_duck_down(edict_t *self) gi.linkentity(self); } +static void +gunner_duck_down_think(edict_t *self) +{ + gunner_duck_down(self); + + /* rogue code calls duck_down twice, so move this here */ + if (skill->value >= SKILL_HARD) + { + if (random() > 0.5) + { + GunnerGrenade(self); + } + } +} + mframe_t gunner_frames_duck[] = { - {ai_move, 1, gunner_duck_down}, + {ai_move, 1, gunner_duck_down_think}, {ai_move, 1, NULL}, {ai_move, 1, monster_duck_hold}, {ai_move, 0, NULL},