Merge pull request #1010 from BjossiAlfreds/makronjmp

Various fixes to makron jump sequence
This commit is contained in:
Yamagi 2023-06-05 19:15:42 +02:00 committed by GitHub
commit 0f696623f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 19 deletions

View file

@ -218,6 +218,7 @@ ThrowGib(edict_t *self, char *gibname, int damage, int type)
gi.setmodel(gib, gibname); gi.setmodel(gib, gibname);
gib->solid = SOLID_BBOX; gib->solid = SOLID_BBOX;
gib->svflags = SVF_DEADMONSTER;
gib->s.effects |= EF_GIB; gib->s.effects |= EF_GIB;
gib->flags |= FL_NO_KNOCKBACK; gib->flags |= FL_NO_KNOCKBACK;
gib->takedamage = DAMAGE_YES; gib->takedamage = DAMAGE_YES;

View file

@ -788,12 +788,6 @@ makron_pain(edict_t *self, edict_t *other /* unused */,
void void
makron_sight(edict_t *self, edict_t *other /* unused */) makron_sight(edict_t *self, edict_t *other /* unused */)
{ {
if (!self)
{
return;
}
self->monsterinfo.currentmove = &makron_move_sight;
} }
void void
@ -1170,7 +1164,7 @@ SP_monster_makron(edict_t *self)
self->monsterinfo.dodge = NULL; self->monsterinfo.dodge = NULL;
self->monsterinfo.attack = makron_attack; self->monsterinfo.attack = makron_attack;
self->monsterinfo.melee = NULL; self->monsterinfo.melee = NULL;
self->monsterinfo.sight = makron_sight; self->monsterinfo.sight = NULL;
self->monsterinfo.checkattack = Makron_CheckAttack; self->monsterinfo.checkattack = Makron_CheckAttack;
gi.linkentity(self); gi.linkentity(self);
@ -1185,29 +1179,43 @@ void
MakronSpawn(edict_t *self) MakronSpawn(edict_t *self)
{ {
vec3_t vec; vec3_t vec;
edict_t *player; edict_t *enemy;
if (!self) if (!self)
{ {
return; return;
} }
enemy = self->enemy;
SP_monster_makron(self); SP_monster_makron(self);
if (self->think)
self->think(self);
/* jump at player */ if (enemy && enemy->inuse &&
player = level.sight_client; enemy->deadflag != DEAD_DEAD && visible(self, enemy))
if (!player)
{ {
return; self->enemy = enemy;
} FoundTarget(self);
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);
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;
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;
} }
/* /*
@ -1230,4 +1238,8 @@ MakronToss(edict_t *self)
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);
ent->enemy = self->enemy;
ent->oldenemy = self->oldenemy;
} }