mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 12:30:40 +00:00
- floatified VectorMissileSeek
This commit is contained in:
parent
c2064fc5c0
commit
cbf929fc50
1 changed files with 5 additions and 11 deletions
|
@ -7728,9 +7728,6 @@ void SetAngleFromChange(DSWActor* actor)
|
||||||
// completely vector manipulation
|
// completely vector manipulation
|
||||||
int VectorMissileSeek(DSWActor* actor, int16_t delay_tics, int16_t turn_speed, int16_t aware_range1, int16_t aware_range2)
|
int VectorMissileSeek(DSWActor* actor, int16_t delay_tics, int16_t turn_speed, int16_t aware_range1, int16_t aware_range2)
|
||||||
{
|
{
|
||||||
int dist;
|
|
||||||
int zh;
|
|
||||||
|
|
||||||
if (actor->user.WaitTics <= delay_tics)
|
if (actor->user.WaitTics <= delay_tics)
|
||||||
actor->user.WaitTics += MISSILEMOVETICS;
|
actor->user.WaitTics += MISSILEMOVETICS;
|
||||||
|
|
||||||
|
@ -7776,17 +7773,14 @@ int VectorMissileSeek(DSWActor* actor, int16_t delay_tics, int16_t turn_speed, i
|
||||||
DSWActor* goal = actor->user.WpnGoalActor;
|
DSWActor* goal = actor->user.WpnGoalActor;
|
||||||
if (goal != nullptr)
|
if (goal != nullptr)
|
||||||
{
|
{
|
||||||
int ox,oy,oz;
|
auto delta = (goal->spr.pos.XY() - actor->spr.pos.XY());
|
||||||
|
double zdiff = ActorZOfTop(goal) + (ActorSizeZ(goal) * 0.25) - actor->spr.pos.Z;
|
||||||
zh = int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2);
|
double dist = g_sqrt(delta.LengthSquared() + zdiff * zdiff);
|
||||||
|
|
||||||
dist = ksqrt(SQ(actor->int_pos().X - goal->int_pos().X) + SQ(actor->int_pos().Y - goal->int_pos().Y) + (SQ(actor->int_pos().Z - zh)>>8));
|
|
||||||
|
|
||||||
auto oc = actor->user.change;
|
auto oc = actor->user.change;
|
||||||
|
|
||||||
actor->user.set_int_change_x(Scale(actor->spr.xvel, goal->int_pos().X - actor->int_pos().X, dist));
|
auto vel = (actor->spr.xvel * zinttoworld) / dist;
|
||||||
actor->user.set_int_change_y(Scale(actor->spr.xvel, goal->int_pos().Y - actor->int_pos().Y, dist));
|
actor->user.change = DVector3(delta, -zdiff) * vel;
|
||||||
actor->user.set_int_change_z(Scale(actor->spr.xvel, zh - actor->int_pos().Z, dist));
|
|
||||||
|
|
||||||
// the large turn_speed is the slower the turn
|
// the large turn_speed is the slower the turn
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue