- eliminated the last wrapper call for track points

This commit is contained in:
Christoph Oelckers 2022-08-21 23:13:53 +02:00
parent 23a0433b95
commit 0767ffe41b
2 changed files with 5 additions and 8 deletions

View file

@ -1403,9 +1403,6 @@ struct TRACK_POINT
DVector3 pos;
DAngle angle;
int16_t tag_low, tag_high;
int int_tx() const { return pos.X * worldtoint; }
int int_ty() const { return pos.Y * worldtoint; }
};
struct TRACK
@ -1484,6 +1481,7 @@ struct SECTOR_OBJECT
* morph_wall_point; // actual wall point to drag
double
target_dist, // distance to next point
zdelta; // z delta from original
@ -1498,7 +1496,6 @@ struct SECTOR_OBJECT
update, // Distance from player at which you continue updating
// only works for single player.
bob_diff, // bobbing difference for the frame
target_dist, // distance to next point
floor_loz, // floor low z
floor_hiz, // floor hi z
morph_z, // morphing point z

View file

@ -2222,7 +2222,7 @@ void DoTrack(SECTOR_OBJECT* sop, short locktics, int *nx, int *ny)
// NOTE: Jittery ride - try new value out here
// NOTE: Put a loop around this (locktics) to make it more acuruate
const int TRACK_POINT_SIZE = 200;
if (sop->target_dist < 100)
if (sop->target_dist < 100 * maptoworld)
{
switch (tpoint->tag_low)
{
@ -2472,8 +2472,8 @@ void DoTrack(SECTOR_OBJECT* sop, short locktics, int *nx, int *ny)
NextTrackPoint(sop);
tpoint = Track[sop->track].TrackPoint + sop->point;
// calculate distance to target poing
sop->target_dist = Distance(sop->int_pmid().X, sop->int_pmid().Y, tpoint->int_tx(), tpoint->int_ty());
// calculate distance to target point
sop->target_dist = (sop->pmid.XY() - tpoint->pos.XY()).Length();
// calculate a new angle to the target
sop->ang_moving = sop->ang_tgt = getangle(tpoint->pos - sop->pmid);
@ -2534,7 +2534,7 @@ void DoTrack(SECTOR_OBJECT* sop, short locktics, int *nx, int *ny)
*nx = ((sop->vel) >> 8) * locktics * bcos(sop->ang_moving) >> 14;
*ny = ((sop->vel) >> 8) * locktics * bsin(sop->ang_moving) >> 14;
auto dist = Distance(0, 0, *nx, *ny);
auto dist = Distance(0, 0, *nx, *ny) * inttoworld;
sop->target_dist -= dist;
}
}