- floatified USER::targetDist and distCheck.

This commit is contained in:
Christoph Oelckers 2022-09-04 12:53:35 +02:00
parent 7c7eb038d8
commit 872833d6be
4 changed files with 12 additions and 12 deletions

View file

@ -817,7 +817,7 @@ int DoActorMoveCloser(DSWActor* actor)
DoActorNoise(ChooseAction(actor->user.Personality->Broadcast), actor); DoActorNoise(ChooseAction(actor->user.Personality->Broadcast), actor);
// after moving a ways check to see if player is still in sight // after moving a ways check to see if player is still in sight
if (actor->user.DistCheck > 550) if (actor->user.DistCheck > 34.375)
{ {
actor->user.DistCheck = 0; actor->user.DistCheck = 0;
@ -1362,7 +1362,8 @@ int FindNewAngle(DSWActor* actor, int dir, int DistToMove)
int new_ang, oang; int new_ang, oang;
int save_ang = -1; int save_ang = -1;
int set; int set;
int save_dist = 500; // start out with mininum distance that will be accepted as a move
double save_dist = 31.25;
// if on fire, run shorter distances // if on fire, run shorter distances
if (ActorFlaming(actor)) if (ActorFlaming(actor))
@ -1413,11 +1414,10 @@ int FindNewAngle(DSWActor* actor, int dir, int DistToMove)
#endif #endif
DVector3 stop; DVector3 stop;
// start out with mininum distance that will be accepted as a move
// check to see how far we can move // check to see how far we can move
auto ret = move_scan(actor, new_ang, DistToMove, stop); auto ret = move_scan(actor, new_ang, DistToMove, stop);
int dist = (actor->spr.pos.XY() - stop.XY()).Length() * worldtoint; double dist = (actor->spr.pos.XY() - stop.XY()).Length();
if (ret.type == kHitNone) if (ret.type == kHitNone)
{ {
@ -1447,8 +1447,8 @@ int FindNewAngle(DSWActor* actor, int dir, int DistToMove)
// To keep this from happening make the TargetDist is less than the // To keep this from happening make the TargetDist is less than the
// point you would hit something // point you would hit something
if (actor->user.TargetDist > 4000) if (actor->user.TargetDist > 250)
actor->user.TargetDist -= 3500; actor->user.TargetDist -= 218.75;
actor->set_int_ang(save_ang); actor->set_int_ang(save_ang);
return save_ang; return save_ang;
@ -1586,7 +1586,7 @@ int DoActorReposition(DSWActor* actor)
} }
// if close to target distance do a Decision again // if close to target distance do a Decision again
if (actor->user.TargetDist < 50) if (actor->user.TargetDist < 3.125)
{ {
InitActorDecide(actor); InitActorDecide(actor);
} }

View file

@ -1027,10 +1027,10 @@ struct USER
int16_t scale_tgt; int16_t scale_tgt;
// zig zagging // zig zagging
int16_t DistCheck; double DistCheck;
int16_t Dist; int16_t Dist;
int16_t TargetDist; double TargetDist;
int16_t WaitTics; int16_t WaitTics;
// track // track

View file

@ -4640,9 +4640,9 @@ int move_actor(DSWActor* actor, const DVector3& change)
{ {
// Keep track of how far sprite has moved // Keep track of how far sprite has moved
dist = DistanceI(apos, actor->spr.pos); dist = DistanceI(apos, actor->spr.pos);
actor->user.TargetDist -= dist; actor->user.TargetDist -= dist * inttoworld;
actor->user.Dist += dist; actor->user.Dist += dist;
actor->user.DistCheck += dist; actor->user.DistCheck += dist * inttoworld;
return true; return true;
} }
else else

View file

@ -11115,7 +11115,7 @@ int DoSerpRing(DSWActor* actor)
{ {
actor->user.Dist += 8 * RINGMOVETICS; actor->user.Dist += 8 * RINGMOVETICS;
if (actor->user.Dist > actor->user.TargetDist) if (actor->user.Dist * inttoworld > actor->user.TargetDist)
actor->user.Counter2 = true; actor->user.Counter2 = true;
} }