mirror of
https://github.com/yquake2/xatrix.git
synced 2024-11-10 06:42:22 +00:00
Fixes to makron jump sequence
This commit is contained in:
parent
94284938f4
commit
951fdb4f97
2 changed files with 73 additions and 18 deletions
|
@ -203,6 +203,7 @@ ThrowGib(edict_t *self, char *gibname, int damage, int type)
|
|||
|
||||
gi.setmodel(gib, gibname);
|
||||
gib->solid = SOLID_BBOX;
|
||||
gib->svflags = SVF_DEADMONSTER;
|
||||
gib->s.effects |= EF_GIB;
|
||||
gib->flags |= FL_NO_KNOCKBACK;
|
||||
gib->takedamage = DAMAGE_YES;
|
||||
|
|
|
@ -759,12 +759,6 @@ makron_pain(edict_t *self, edict_t *other /* unused */,
|
|||
void
|
||||
makron_sight(edict_t *self, edict_t *other /* unused */)
|
||||
{
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self->monsterinfo.currentmove = &makron_move_sight;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1161,24 +1155,74 @@ void
|
|||
MakronSpawn(edict_t *self)
|
||||
{
|
||||
vec3_t vec;
|
||||
edict_t *player;
|
||||
edict_t *enemy;
|
||||
edict_t *oldenemy;
|
||||
|
||||
SP_monster_makron(self);
|
||||
|
||||
/* jump at player */
|
||||
player = level.sight_client;
|
||||
|
||||
if (!player)
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VectorSubtract(player->s.origin, self->s.origin, vec);
|
||||
self->s.angles[YAW] = vectoyaw(vec);
|
||||
VectorNormalize(vec);
|
||||
VectorMA(vec3_origin, 400, vec, self->velocity);
|
||||
self->velocity[2] = 200;
|
||||
/* spawning can mess with enemy state so clear it temporarily */
|
||||
enemy = self->enemy;
|
||||
self->enemy = NULL;
|
||||
|
||||
oldenemy = self->oldenemy;
|
||||
self->oldenemy = NULL;
|
||||
|
||||
SP_monster_makron(self);
|
||||
if (self->think)
|
||||
{
|
||||
self->think(self);
|
||||
}
|
||||
|
||||
/* and re-link enemy state now that he's spawned */
|
||||
if (enemy && enemy->inuse && enemy->deadflag != DEAD_DEAD)
|
||||
{
|
||||
self->enemy = enemy;
|
||||
}
|
||||
|
||||
if (oldenemy && oldenemy->inuse && oldenemy->deadflag != DEAD_DEAD)
|
||||
{
|
||||
self->oldenemy = oldenemy;
|
||||
}
|
||||
|
||||
if (!self->enemy)
|
||||
{
|
||||
self->enemy = self->oldenemy;
|
||||
self->oldenemy = NULL;
|
||||
}
|
||||
|
||||
enemy = self->enemy;
|
||||
|
||||
if (enemy)
|
||||
{
|
||||
FoundTarget(self);
|
||||
VectorCopy(self->pos1, self->monsterinfo.last_sighting);
|
||||
}
|
||||
|
||||
if (enemy && visible(self, enemy))
|
||||
{
|
||||
VectorSubtract(enemy->s.origin, self->s.origin, vec);
|
||||
self->s.angles[YAW] = vectoyaw(vec);
|
||||
VectorNormalize(vec);
|
||||
}
|
||||
else
|
||||
{
|
||||
AngleVectors(self->s.angles, vec, NULL, NULL);
|
||||
}
|
||||
|
||||
VectorScale(vec, 400, self->velocity);
|
||||
/* the jump frames are fixed length so best to normalize the up speed */
|
||||
self->velocity[2] = 200.0f * (sv_gravity->value / 800.0f);
|
||||
|
||||
self->groundentity = NULL;
|
||||
self->s.origin[2] += 1;
|
||||
gi.linkentity(self);
|
||||
|
||||
self->pain_debounce_time = level.time + 1;
|
||||
|
||||
self->monsterinfo.currentmove = &makron_move_sight;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1189,10 +1233,20 @@ MakronToss(edict_t *self)
|
|||
{
|
||||
edict_t *ent;
|
||||
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ent = G_Spawn();
|
||||
ent->classname = "monster_makron";
|
||||
ent->nextthink = level.time + 0.8;
|
||||
ent->think = MakronSpawn;
|
||||
ent->target = self->target;
|
||||
VectorCopy(self->s.origin, ent->s.origin);
|
||||
VectorCopy(self->s.angles, ent->s.angles);
|
||||
VectorCopy(self->monsterinfo.last_sighting, ent->pos1);
|
||||
|
||||
ent->enemy = self->enemy;
|
||||
ent->oldenemy = self->oldenemy;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue