From 91a89cd0f58f489598f43ae564e2eb356b75a82f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 31 Aug 2022 21:03:03 +0200 Subject: [PATCH] - more SetZVelFromTarget. --- source/games/sw/src/weapon.cpp | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index b26ffaf42..f4116fdfb 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -14001,10 +14001,7 @@ int InitEnemyRocket(DSWActor* actor) MissileSetPos(actorNew, DoBoltThinMan, 400); // find the distance to the target (player) - dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); - - if (dist != 0) - actorNew->user.set_int_change_z(actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist); + SetZVelFromTarget(actorNew, actor, true); return 0; } @@ -14076,10 +14073,7 @@ int InitEnemyRail(DSWActor* actor) } // find the distance to the target (player) - dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); - - if (dist != 0) - actorNew->user.set_int_change_z(actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist); + SetZVelFromTarget(actorNew, actor, true); return 0; } @@ -14145,10 +14139,7 @@ int InitZillaRocket(DSWActor* actor) MissileSetPos(actorNew, DoBoltThinMan, mp[i].dist_out); // find the distance to the target (player) - dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); - - if (dist != 0) - actorNew->user.set_int_change_z(actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist); + SetZVelFromTarget(actorNew, actor, true); } return 0; @@ -14178,10 +14169,7 @@ int InitEnemyStar(DSWActor* actor) MissileSetPos(actorNew, DoStar, 400); // find the distance to the target (player) - dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); - - if (dist != 0) - actorNew->user.set_int_change_z(actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist); + SetZVelFromTarget(actorNew, actor, true); PlaySound(DIGI_STAR, actor, v3df_none); return 0; @@ -14216,10 +14204,7 @@ int InitEnemyCrossbow(DSWActor* actor) MissileSetPos(actorNew, DoStar, 400); // find the distance to the target (player) - dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); - - if (dist != 0) - actorNew->user.set_int_change_z(actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist); + SetZVelFromTarget(actorNew, actor, true); PlaySound(DIGI_STAR, actor, v3df_none);