- float_vel wraps

This commit is contained in:
Christoph Oelckers 2022-09-01 16:51:27 +02:00
parent 0aad018796
commit cf90970121
5 changed files with 10 additions and 10 deletions

View file

@ -278,8 +278,8 @@ void lotsofstuff(DDukeActor* actor, int n, int spawntype)
void ms(DDukeActor* const actor) void ms(DDukeActor* const actor)
{ {
//T1,T2 and T3 are used for all the sector moving stuff!!! //T1,T2 and T3 are used for all the sector moving stuff!!!
actor->spr.pos.X += actor->spr.xvel * actor->spr.angle.Cos() * inttoworld; actor->spr.pos.X += actor->float_xvel() * actor->spr.angle.Cos();
actor->spr.pos.Y += actor->spr.xvel * actor->spr.angle.Sin() * inttoworld; actor->spr.pos.Y += actor->float_xvel() * actor->spr.angle.Sin();
int j = actor->temp_data[1]; int j = actor->temp_data[1];
int k = actor->temp_data[2]; int k = actor->temp_data[2];

View file

@ -524,7 +524,7 @@ int DoEelDeath(DSWActor* actor)
DoActorSlide(actor); DoActorSlide(actor);
// slide while falling // slide while falling
auto vec = actor->spr.angle.ToVector() * actor->spr.xvel * inttoworld; auto vec = actor->spr.angle.ToVector() * actor->float_xvel();
actor->user.coll = move_sprite(actor, DVector3(vec, 0), actor->user.ceiling_dist, actor->user.floor_dist, CLIPMASK_MISSILE, ACTORMOVETICS); actor->user.coll = move_sprite(actor, DVector3(vec, 0), actor->user.ceiling_dist, actor->user.floor_dist, CLIPMASK_MISSILE, ACTORMOVETICS);
DoFindGroundPoint(actor); DoFindGroundPoint(actor);

View file

@ -504,7 +504,7 @@ int DoHornetDeath(DSWActor* actor)
DoActorSlide(actor); DoActorSlide(actor);
// slide while falling // slide while falling
auto vec = actor->spr.angle.ToVector() * actor->spr.xvel * inttoworld; auto vec = actor->spr.angle.ToVector() * actor->float_xvel();
actor->user.coll = move_sprite(actor, DVector3(vec, 0), actor->user.ceiling_dist, actor->user.floor_dist, 1, ACTORMOVETICS); actor->user.coll = move_sprite(actor, DVector3(vec, 0), actor->user.ceiling_dist, actor->user.floor_dist, 1, ACTORMOVETICS);

View file

@ -1448,7 +1448,7 @@ void PlaceActorsOnTracks(void)
actor->user.track_dir = 1; actor->user.track_dir = 1;
} }
actor->user.track_vel = actor->spr.xvel * 256; actor->user.track_vel = actor->int_xvel() * 256;
actor->user.vel_tgt = actor->user.track_vel; actor->user.vel_tgt = actor->user.track_vel;
actor->user.vel_rate = 6; actor->user.vel_rate = 6;
@ -3433,7 +3433,7 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
// (velocity * difference between the target and the object) / // (velocity * difference between the target and the object) /
// distance // distance
actor->set_int_zvel((int) -((actor->spr.xvel * (actor->spr.pos.Z - tpoint->pos.Z)) / dist)); actor->set_int_zvel((int) -((actor->int_xvel() * (actor->spr.pos.Z - tpoint->pos.Z)) / dist));
} }
} }
else else
@ -3487,7 +3487,7 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
else else
{ {
// calculate a new x and y // calculate a new x and y
vec.XY() = actor->spr.angle.ToVector() * actor->spr.xvel * inttoworld; vec.XY() = actor->spr.angle.ToVector() * actor->float_xvel();
} }
if (actor->float_zvel() != 0) if (actor->float_zvel() != 0)

View file

@ -7715,7 +7715,7 @@ int ComboMissileSeek(DSWActor* actor, int16_t delay_tics, int16_t aware_range/*,
double zdiff = actor->spr.pos.Z - ActorZOfTop(goal) - (ActorSizeZ(goal) * 0.25); double zdiff = actor->spr.pos.Z - ActorZOfTop(goal) - (ActorSizeZ(goal) * 0.25);
double dist = g_sqrt((actor->spr.pos.XY() - goal->spr.pos.XY()).LengthSquared() + zdiff * zdiff); double dist = g_sqrt((actor->spr.pos.XY() - goal->spr.pos.XY()).LengthSquared() + zdiff * zdiff);
actor->user.change.Z = (actor->spr.xvel * zinttoworld) * zdiff / dist + actor->user.change.Z * (15 / 16.); actor->user.change.Z = (actor->float_xvel()) * zdiff / dist + actor->user.change.Z * (15 / 16.);
} }
return 0; return 0;
} }
@ -7779,7 +7779,7 @@ int VectorMissileSeek(DSWActor* actor, int16_t delay_tics, int16_t turn_speed, i
auto oc = actor->user.change; auto oc = actor->user.change;
auto vel = (actor->spr.xvel * zinttoworld) / dist; auto vel = (actor->int_xvel() * zinttoworld) / dist;
actor->user.change = DVector3(delta, -zdiff) * vel; actor->user.change = DVector3(delta, -zdiff) * vel;
// the large turn_speed is the slower the turn // the large turn_speed is the slower the turn
@ -7827,7 +7827,7 @@ int VectorWormSeek(DSWActor* actor, int16_t delay_tics, int16_t aware_range1, in
auto oc = actor->user.change; auto oc = actor->user.change;
auto vel = (actor->spr.xvel * zinttoworld) / dist; auto vel = (actor->int_xvel() * zinttoworld) / dist;
actor->user.change = DVector3(delta, zdiff) * vel + oc * (7. / 8); actor->user.change = DVector3(delta, zdiff) * vel + oc * (7. / 8);
SetAngleFromChange(actor); SetAngleFromChange(actor);