From 0642b6aa18e298bbc24cd84aedf81c8aa7eea0ad Mon Sep 17 00:00:00 2001 From: BjossiAlfreds Date: Fri, 10 Jan 2020 17:04:19 +0000 Subject: [PATCH] Fix mguard freeze bug and improvements to frame handling --- src/g_monster.c | 10 +++++++++- src/monster/soldier/soldier.c | 5 ----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/g_monster.c b/src/g_monster.c index badaec3..274b3f1 100644 --- a/src/g_monster.c +++ b/src/g_monster.c @@ -608,11 +608,19 @@ M_MoveFrame(edict_t *self) (self->monsterinfo.nextframe >= move->firstframe) && (self->monsterinfo.nextframe <= move->lastframe)) { - self->s.frame = self->monsterinfo.nextframe; + if (self->s.frame != self->monsterinfo.nextframe) + { + self->s.frame = self->monsterinfo.nextframe; + self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; + } + self->monsterinfo.nextframe = 0; } else { + /* prevent nextframe from leaking into a future move */ + self->monsterinfo.nextframe = 0; + if (self->s.frame == move->lastframe) { if (move->endfunc) diff --git a/src/monster/soldier/soldier.c b/src/monster/soldier/soldier.c index 594b9b9..47a5432 100644 --- a/src/monster/soldier/soldier.c +++ b/src/monster/soldier/soldier.c @@ -1668,7 +1668,6 @@ soldier_duck(edict_t *self, float eta) if (skill->value == 0) { - self->monsterinfo.nextframe = FRAME_duck01; self->monsterinfo.currentmove = &soldier_move_duck; self->monsterinfo.duck_wait_time = level.time + eta + 1; return; @@ -1678,18 +1677,14 @@ soldier_duck(edict_t *self, float eta) if (r > (skill->value * 0.3)) { - self->monsterinfo.nextframe = FRAME_duck01; self->monsterinfo.currentmove = &soldier_move_duck; self->monsterinfo.duck_wait_time = level.time + eta + (0.1 * (3 - skill->value)); } else { - self->monsterinfo.nextframe = FRAME_attak301; self->monsterinfo.currentmove = &soldier_move_attack3; self->monsterinfo.duck_wait_time = level.time + eta + 1; } - - return; } mframe_t soldier_frames_blind[] = {