Fixes for makron jump sequence

This commit is contained in:
BjossiAlfreds 2023-06-07 13:38:22 +00:00
parent 81f809bea3
commit cf01efd347

View file

@ -664,12 +664,6 @@ void makron_pain (edict_t *self, edict_t *other, float kick, int damage)
void makron_sight(edict_t *self, edict_t *other) void makron_sight(edict_t *self, edict_t *other)
{ {
if (!self)
{
return;
}
self->monsterinfo.currentmove = &makron_move_sight;
} }
void makron_attack(edict_t *self) void makron_attack(edict_t *self)
@ -1031,36 +1025,81 @@ MakronSpawn
void MakronSpawn (edict_t *self) void MakronSpawn (edict_t *self)
{ {
vec3_t vec; vec3_t vec;
edict_t *player; edict_t *enemy;
edict_t *oldenemy;
if (!self) if (!self)
{ {
return; return;
} }
SP_monster_makron (self); /* spawning can mess with enemy state so clear it temporarily */
enemy = self->enemy;
self->enemy = NULL;
// jump at player oldenemy = self->oldenemy;
player = level.sight_client; self->oldenemy = NULL;
if (!player)
return;
VectorSubtract (player->s.origin, self->s.origin, vec); 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); self->s.angles[YAW] = vectoyaw(vec);
VectorNormalize (vec); VectorNormalize(vec);
VectorMA (vec3_origin, 400, vec, self->velocity); }
self->velocity[2] = 200; 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->groundentity = NULL;
self->s.origin[2] += 1;
gi.linkentity(self);
self->pain_debounce_time = level.time + 1;
self->monsterinfo.currentmove = &makron_move_sight;
} }
/* /*
================= * Jorg is just about dead, so set up to launch Makron out
MakronToss */
void
Jorg is just about dead, so set up to launch Makron out MakronToss(edict_t *self)
=================
*/
void MakronToss (edict_t *self)
{ {
edict_t *ent; edict_t *ent;
@ -1069,11 +1108,15 @@ void MakronToss (edict_t *self)
return; return;
} }
ent = G_Spawn (); ent = G_Spawn();
ent->classname = "monster_makron"; ent->classname = "monster_makron";
ent->nextthink = level.time + 0.8; ent->nextthink = level.time + 0.8;
ent->think = MakronSpawn; ent->think = MakronSpawn;
ent->target = self->target; ent->target = self->target;
VectorCopy (self->s.origin, ent->s.origin); 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;
}