Fixed ungibbable makron parts

This commit is contained in:
BjossiAlfreds 2023-05-03 13:51:48 +00:00
parent 22617d8812
commit e720bc819d
5 changed files with 83 additions and 28 deletions

View File

@ -127,11 +127,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))

View File

@ -847,24 +847,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);
}
void
@ -875,8 +935,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;
@ -887,7 +947,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)
@ -927,12 +986,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;
}

View File

@ -422,7 +422,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)

View File

@ -542,6 +542,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 ) ;

View File

@ -542,6 +542,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},