From 640d01364c25661f7006086c26ab94c61027cac7 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Fri, 5 Nov 2021 07:12:05 +0100 Subject: [PATCH] Fix soldiers never showing their pain skins as long as they're alive. Since `self->helth` is set after calling `master_start()` `self->max_health is always 0. Found by @drakonorodny and analyzed by @BjossiAlfreds. --- src/monster/soldier/soldier.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/monster/soldier/soldier.c b/src/monster/soldier/soldier.c index b247e00..5533369 100644 --- a/src/monster/soldier/soldier.c +++ b/src/monster/soldier/soldier.c @@ -1547,6 +1547,9 @@ SP_monster_soldier_light(edict_t *self) return; } + self->health = 20; + self->gib_health = -30; + SP_monster_soldier_x(self); sound_pain_light = gi.soundindex("soldier/solpain2.wav"); @@ -1556,8 +1559,6 @@ SP_monster_soldier_light(edict_t *self) gi.soundindex("soldier/solatck2.wav"); self->s.skinnum = 0; - self->health = 20; - self->gib_health = -30; } /* @@ -1577,6 +1578,9 @@ SP_monster_soldier(edict_t *self) return; } + self->health = 30; + self->gib_health = -30; + SP_monster_soldier_x(self); sound_pain = gi.soundindex("soldier/solpain1.wav"); @@ -1584,8 +1588,6 @@ SP_monster_soldier(edict_t *self) gi.soundindex("soldier/solatck1.wav"); self->s.skinnum = 2; - self->health = 30; - self->gib_health = -30; } /* @@ -1605,6 +1607,9 @@ SP_monster_soldier_ss(edict_t *self) return; } + self->health = 40; + self->gib_health = -30; + SP_monster_soldier_x(self); sound_pain_ss = gi.soundindex("soldier/solpain3.wav"); @@ -1612,8 +1617,6 @@ SP_monster_soldier_ss(edict_t *self) gi.soundindex("soldier/solatck3.wav"); self->s.skinnum = 4; - self->health = 40; - self->gib_health = -30; } void @@ -3279,6 +3282,9 @@ SP_monster_soldier_ripper(edict_t *self) return; } + self->health = 50; + self->gib_health = -30; + SP_monster_soldier_h(self); sound_pain_light = gi.soundindex("soldier/solpain2.wav"); @@ -3289,8 +3295,6 @@ SP_monster_soldier_ripper(edict_t *self) gi.soundindex("soldier/solatck2.wav"); self->s.skinnum = 0; - self->health = 50; - self->gib_health = -30; } /* @@ -3310,6 +3314,9 @@ SP_monster_soldier_hypergun(edict_t *self) return; } + self->health = 60; + self->gib_health = -30; + SP_monster_soldier_h(self); gi.modelindex("models/objects/blaser/tris.md2"); @@ -3318,8 +3325,6 @@ SP_monster_soldier_hypergun(edict_t *self) gi.soundindex("soldier/solatck1.wav"); self->s.skinnum = 2; - self->health = 60; - self->gib_health = -30; } /* @@ -3339,6 +3344,9 @@ SP_monster_soldier_lasergun(edict_t *self) return; } + self->health = 70; + self->gib_health = -30; + SP_monster_soldier_h(self); sound_pain_ss = gi.soundindex("soldier/solpain3.wav"); @@ -3346,6 +3354,4 @@ SP_monster_soldier_lasergun(edict_t *self) gi.soundindex("soldier/solatck3.wav"); self->s.skinnum = 4; - self->health = 70; - self->gib_health = -30; }