diff --git a/src/g_weapon.c b/src/g_weapon.c index 555f107..086659b 100644 --- a/src/g_weapon.c +++ b/src/g_weapon.c @@ -1341,16 +1341,14 @@ heat_think(edict_t *self) edict_t *target = NULL; edict_t *aquire = NULL; vec3_t vec; - int len; - int oldlen = 0; + float len; + float oldlen = 0; if (!self) { return; } - VectorClear(vec); - /* aquire new target */ while ((target = findradius(target, self->s.origin, 1024)) != NULL) { @@ -1359,11 +1357,6 @@ heat_think(edict_t *self) continue; } - if ((!target->svflags) & SVF_MONSTER) - { - continue; - } - if (!target->client) { continue; @@ -1374,12 +1367,12 @@ heat_think(edict_t *self) continue; } - if (!visible(self, target)) + if (!infront(self, target)) { continue; } - if (!infront(self, target)) + if (!visible(self, target)) { continue; } @@ -1387,20 +1380,18 @@ heat_think(edict_t *self) VectorSubtract(self->s.origin, target->s.origin, vec); len = VectorLength(vec); - if ((aquire == NULL) || (len < oldlen)) + if ((!aquire) || (len < oldlen)) { aquire = target; - self->target_ent = aquire; oldlen = len; } } - if (aquire != NULL) + if (aquire) { VectorSubtract(aquire->s.origin, self->s.origin, vec); vectoangles(vec, self->s.angles); VectorNormalize(vec); - VectorCopy(vec, self->movedir); VectorScale(vec, 500, self->velocity); } diff --git a/src/monster/chick/chick.c b/src/monster/chick/chick.c index ea6dc99..60a2bad 100644 --- a/src/monster/chick/chick.c +++ b/src/monster/chick/chick.c @@ -631,7 +631,7 @@ ChickRocket(edict_t *self) VectorSubtract(vec, start, dir); VectorNormalize(dir); - if (self->s.skinnum > 1) + if (!strcmp(self->classname, "monster_chick_heat")) { monster_fire_heat(self, start, dir, 50, 500, MZ2_CHICK_ROCKET_1); } @@ -949,5 +949,10 @@ SP_monster_chick_heat(edict_t *self) } SP_monster_chick(self); - self->s.skinnum = 3; + + /* have to check this since the regular spawn function can free the entity */ + if (self->inuse) + { + self->s.skinnum = 3; + } } diff --git a/src/monster/insane/insane.c b/src/monster/insane/insane.c index d5fcf24..844f4c6 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; @@ -52,12 +54,29 @@ insane_moan(edict_t *self) return; } + /* suppress screaming so pain sound 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 sound can play */ + if (self->delay > level.time) + { + return; + } + gi.sound(self, CHAN_VOICE, sound_scream[rand() % 8], 1, ATTN_IDLE, 0); } @@ -640,13 +659,16 @@ insane_pain(edict_t *self, edict_t *other /* unused */, 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 */ } /* Don't go into pain frames if crucified. */ - if (self->spawnflags & 8) + if (self->spawnflags & SPAWNFLAG_CRUSIFIED) { self->monsterinfo.currentmove = &insane_move_struggle_cross; return; @@ -728,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; @@ -756,7 +778,7 @@ insane_dead(edict_t *self) return; } - if (self->spawnflags & 8) + if (self->spawnflags & SPAWNFLAG_CRUSIFIED) { self->flags |= FL_FLY; } @@ -814,7 +836,7 @@ insane_die(edict_t *self, edict_t *inflictor /* unused */, self->deadflag = DEAD_DEAD; self->takedamage = DAMAGE_YES; - if (self->spawnflags & 8) + if (self->spawnflags & SPAWNFLAG_CRUSIFIED) { insane_dead(self); } @@ -897,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);