From c79de3adfa3e36e2f1a4ba046f8e899412d6efba Mon Sep 17 00:00:00 2001 From: BjossiAlfreds Date: Sun, 15 Sep 2019 13:52:26 +0000 Subject: [PATCH] Fix for insane marines pain sounds --- src/monster/insane/insane.c | 45 +++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/src/monster/insane/insane.c b/src/monster/insane/insane.c index 1297cd1..b7b785a 100644 --- a/src/monster/insane/insane.c +++ b/src/monster/insane/insane.c @@ -8,6 +8,8 @@ #include "../../header/local.h" #include "insane.h" +#define SPAWNFLAG_CRUSIFIED 8 + static int sound_fist; static int sound_shake; static int sound_moan; @@ -25,24 +27,56 @@ void insane_onground(edict_t *self); void insane_fist(edict_t *self) { + if (!self) + { + return; + } + gi.sound(self, CHAN_VOICE, sound_fist, 1, ATTN_IDLE, 0); } void insane_shake(edict_t *self) { + if (!self) + { + return; + } + gi.sound(self, CHAN_VOICE, sound_shake, 1, ATTN_IDLE, 0); } void insane_moan(edict_t *self) { + if (!self) + { + return; + } + + /* suppress screaming so pain sounds can play */ + if (self->delay > level.time) + { + return; + } + gi.sound(self, CHAN_VOICE, sound_moan, 1, ATTN_IDLE, 0); } void insane_scream(edict_t *self) { + if (!self) + { + return; + } + + /* suppress screaming so pain sounds can play */ + if (self->delay > level.time) + { + return; + } + gi.sound(self, CHAN_VOICE, sound_scream[rand() % 8], 1, ATTN_IDLE, 0); } @@ -623,6 +657,9 @@ insane_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage) gi.sound(self, CHAN_VOICE, gi.soundindex(va("player/male/pain%i_%i.wav", l, r)), 1, ATTN_IDLE, 0); + /* suppress screaming and moaning for 1 second so pain sound plays */ + self->delay = level.time + 1; + if (skill->value == 3) { return; /* no pain anims in nightmare */ @@ -713,7 +750,7 @@ insane_stand(edict_t *self) return; } - if (self->spawnflags & 8) /* If crucified */ + if (self->spawnflags & SPAWNFLAG_CRUSIFIED) /* If crucified */ { self->monsterinfo.currentmove = &insane_move_cross; self->monsterinfo.aiflags |= AI_STAND_GROUND; @@ -742,7 +779,7 @@ insane_dead(edict_t *self) return; } - if (self->spawnflags & 8) + if (self->spawnflags & SPAWNFLAG_CRUSIFIED) { self->flags |= FL_FLY; } @@ -799,7 +836,7 @@ insane_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; - if (self->spawnflags & 8) + if (self->spawnflags & SPAWNFLAG_CRUSIFIED) { insane_dead(self); } @@ -882,7 +919,7 @@ SP_misc_insane(edict_t *self) self->monsterinfo.scale = MODEL_SCALE; - if (self->spawnflags & 8) /* Crucified ? */ + if (self->spawnflags & SPAWNFLAG_CRUSIFIED) /* Crucified ? */ { VectorSet(self->mins, -16, 0, 0); VectorSet(self->maxs, 16, 8, 32);