mirror of
https://github.com/yquake2/xatrix.git
synced 2024-11-10 06:42:22 +00:00
Merge pull request #86 from BjossiAlfreds/makrondeath
Fixed ungibbable makron parts
This commit is contained in:
commit
94284938f4
5 changed files with 91 additions and 29 deletions
|
@ -108,11 +108,6 @@ Killed(edict_t *targ, edict_t *inflictor, edict_t *attacker,
|
|||
return;
|
||||
}
|
||||
|
||||
if (targ->health < -999)
|
||||
{
|
||||
targ->health = -999;
|
||||
}
|
||||
|
||||
targ->enemy = attacker;
|
||||
|
||||
if ((targ->svflags & SVF_MONSTER) && (targ->deadflag != DEAD_DEAD))
|
||||
|
|
|
@ -803,7 +803,14 @@ makron_torso_think(edict_t *self)
|
|||
return;
|
||||
}
|
||||
|
||||
if (self->owner && self->owner->inuse && self->owner->deadflag != DEAD_DEAD)
|
||||
/* detach from the makron if the legs are gone completely */
|
||||
if (self->owner && (!self->owner->inuse || (self->owner->health <= self->owner->gib_health)))
|
||||
{
|
||||
self->owner = NULL;
|
||||
}
|
||||
|
||||
/* if the makron is revived the torso was put back on him */
|
||||
if (self->owner && self->owner->deadflag != DEAD_DEAD)
|
||||
{
|
||||
G_FreeEdict(self);
|
||||
return;
|
||||
|
@ -817,24 +824,84 @@ makron_torso_think(edict_t *self)
|
|||
self->nextthink = level.time + FRAMETIME;
|
||||
}
|
||||
|
||||
void
|
||||
makron_torso(edict_t *ent)
|
||||
static void
|
||||
makron_torso_origin(edict_t *self, edict_t *torso)
|
||||
{
|
||||
if (!ent)
|
||||
vec3_t v;
|
||||
trace_t tr;
|
||||
|
||||
AngleVectors(self->s.angles, v, NULL, NULL);
|
||||
VectorMA(self->s.origin, -84.0f, v, v);
|
||||
|
||||
tr = gi.trace(self->s.origin, torso->mins, torso->maxs, v, self, MASK_SOLID);
|
||||
|
||||
VectorCopy (tr.endpos, torso->s.origin);
|
||||
}
|
||||
|
||||
void
|
||||
makron_torso_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */,
|
||||
int damage /* unused */, vec3_t point /* unused */)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (self->health > self->gib_health)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ent->movetype = MOVETYPE_NONE;
|
||||
ent->solid = SOLID_NOT;
|
||||
VectorSet(ent->mins, -8, -8, 0);
|
||||
VectorSet(ent->maxs, 8, 8, 8);
|
||||
ent->s.frame = FRAME_death301;
|
||||
ent->s.modelindex = gi.modelindex("models/monsters/boss3/rider/tris.md2");
|
||||
ent->think = makron_torso_think;
|
||||
ent->nextthink = level.time + 2 * FRAMETIME;
|
||||
ent->s.sound = gi.soundindex("makron/spine.wav");
|
||||
gi.linkentity(ent);
|
||||
gi.sound(self, CHAN_VOICE, gi.soundindex( "misc/udeath.wav"), 1, ATTN_NORM, 0);
|
||||
|
||||
ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2",
|
||||
damage, GIB_ORGANIC);
|
||||
|
||||
for (n = 0; n < 4; n++)
|
||||
{
|
||||
ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2",
|
||||
damage, GIB_METALLIC);
|
||||
}
|
||||
|
||||
G_FreeEdict(self);
|
||||
}
|
||||
|
||||
void
|
||||
makron_torso(edict_t *self)
|
||||
{
|
||||
edict_t *torso;
|
||||
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
torso = G_SpawnOptional();
|
||||
|
||||
if (!torso)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VectorCopy(self->s.angles, torso->s.angles);
|
||||
VectorSet(torso->mins, -24, -24, 0);
|
||||
VectorSet(torso->maxs, 24, 24, 16);
|
||||
makron_torso_origin(self, torso);
|
||||
|
||||
torso->gib_health = -800;
|
||||
torso->takedamage = DAMAGE_YES;
|
||||
torso->die = makron_torso_die;
|
||||
torso->deadflag = DEAD_DEAD;
|
||||
|
||||
torso->owner = self;
|
||||
torso->movetype = MOVETYPE_TOSS;
|
||||
torso->solid = SOLID_BBOX;
|
||||
torso->svflags = SVF_MONSTER|SVF_DEADMONSTER;
|
||||
torso->clipmask = MASK_MONSTERSOLID;
|
||||
torso->s.frame = FRAME_death301;
|
||||
torso->s.modelindex = gi.modelindex("models/monsters/boss3/rider/tris.md2");
|
||||
torso->think = makron_torso_think;
|
||||
torso->nextthink = level.time + 2 * FRAMETIME;
|
||||
torso->s.sound = gi.soundindex("makron/spine.wav");
|
||||
|
||||
gi.linkentity(torso);
|
||||
}
|
||||
|
||||
/* death */
|
||||
|
@ -846,8 +913,8 @@ makron_dead(edict_t *self)
|
|||
return;
|
||||
}
|
||||
|
||||
VectorSet(self->mins, -60, -60, 0);
|
||||
VectorSet(self->maxs, 60, 60, 72);
|
||||
VectorSet(self->mins, -48, -48, 0);
|
||||
VectorSet(self->maxs, 48, 48, 24);
|
||||
self->movetype = MOVETYPE_TOSS;
|
||||
self->svflags |= SVF_DEADMONSTER;
|
||||
self->nextthink = 0;
|
||||
|
@ -858,7 +925,6 @@ void
|
|||
makron_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */,
|
||||
int damage /* unused */, vec3_t point /* unused */)
|
||||
{
|
||||
edict_t *tempent;
|
||||
int n;
|
||||
|
||||
if (!self)
|
||||
|
@ -901,12 +967,11 @@ makron_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /*
|
|||
self->deadflag = DEAD_DEAD;
|
||||
self->takedamage = DAMAGE_YES;
|
||||
|
||||
tempent = G_Spawn();
|
||||
VectorCopy(self->s.origin, tempent->s.origin);
|
||||
VectorCopy(self->s.angles, tempent->s.angles);
|
||||
tempent->s.origin[1] -= 84;
|
||||
tempent->owner = self;
|
||||
makron_torso(tempent);
|
||||
makron_torso(self);
|
||||
|
||||
/* lower bbox since the torso is gone */
|
||||
self->maxs[2] = 64;
|
||||
gi.linkentity (self);
|
||||
|
||||
self->monsterinfo.currentmove = &makron_move_death2;
|
||||
}
|
||||
|
|
|
@ -383,7 +383,7 @@ G_SetStats(edict_t *ent)
|
|||
|
||||
/* health */
|
||||
ent->client->ps.stats[STAT_HEALTH_ICON] = level.pic_health;
|
||||
ent->client->ps.stats[STAT_HEALTH] = ent->health;
|
||||
ent->client->ps.stats[STAT_HEALTH] = (ent->health < -99) ? -99 : ent->health;
|
||||
|
||||
/* ammo */
|
||||
if (!ent->client->ammo_index)
|
||||
|
|
|
@ -671,6 +671,7 @@ extern void SP_monster_makron ( edict_t * self ) ;
|
|||
extern void MakronPrecache ( void ) ;
|
||||
extern qboolean Makron_CheckAttack ( edict_t * self ) ;
|
||||
extern void makron_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ;
|
||||
extern void makron_torso_die ( edict_t * self , edict_t * inflictor , edict_t * attacker , int damage , vec3_t point ) ;
|
||||
extern void makron_dead ( edict_t * self ) ;
|
||||
extern void makron_torso ( edict_t * ent ) ;
|
||||
extern void makron_torso_think ( edict_t * self ) ;
|
||||
|
|
|
@ -671,6 +671,7 @@
|
|||
{"MakronPrecache", (byte *)MakronPrecache},
|
||||
{"Makron_CheckAttack", (byte *)Makron_CheckAttack},
|
||||
{"makron_die", (byte *)makron_die},
|
||||
{"makron_torso_die", (byte *)makron_torso_die},
|
||||
{"makron_dead", (byte *)makron_dead},
|
||||
{"makron_torso", (byte *)makron_torso},
|
||||
{"makron_torso_think", (byte *)makron_torso_think},
|
||||
|
|
Loading…
Reference in a new issue