- InitSkelSpell

This commit is contained in:
Christoph Oelckers 2022-08-31 22:14:45 +02:00
parent d815d0dfeb
commit 562ac2461d

View file

@ -14192,17 +14192,11 @@ int InitEnemyCrossbow(DSWActor* actor)
int InitSkelSpell(DSWActor* actor)
{
int nx, ny, nz, dist;
PlaySound(DIGI_SPELEC, actor, v3df_none);
// get angle to player and also face player when attacking
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY());
nx = actor->int_pos().X;
ny = actor->int_pos().Y;
nz = actor->int_pos().Z - (int_ActorSizeZ(actor) >> 1);
// Spawn a shot
auto actorNew = SpawnActor(STAT_MISSILE, ELECTRO_ENEMY, s_Electro, actor->sector(),
actor->spr.pos.plusZ(-(ActorSizeZ(actor) * 0.5)), actor->user.targetActor->spr.angle, SKEL_ELECTRO_VELOCITY);
@ -14217,13 +14211,8 @@ int InitSkelSpell(DSWActor* actor)
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
// find the distance to the target (player)
dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos);
if (dist != 0)
actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - nz)) / dist;
SetZVelFromTarget(actorNew, actor, false, ActorSizeZ(actor) * 0.5);
UpdateChange(actorNew);
MissileSetPos(actorNew, DoElectro, 400);
return 0;