Skip to content

Commit

Permalink
Improve player's path in automap
Browse files Browse the repository at this point in the history
Sometimes P_ApproxDistance() could return 0 and a breadcrumb wouldn't be dropped.
  • Loading branch information
bradharding committed Oct 18, 2024
1 parent af74ff0 commit aa94898
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/p_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,17 +1108,14 @@ bool P_TryMove(mobj_t *thing, const fixed_t x, const fixed_t y, const int dropof

P_SetThingPosition(thing);

if (thing->player && thing->player->mo == thing)
if (thing->player && thing->player->mo == thing && (x != oldx || y != oldy))
{
const int dist = P_ApproxDistance(x - oldx, y - oldy) >> FRACBITS;

if (dist)
{
stat_distancetraveled = SafeAdd(stat_distancetraveled, dist);
viewplayer->distancetraveled += dist;
stat_distancetraveled = SafeAdd(stat_distancetraveled, dist);
viewplayer->distancetraveled += dist;

AM_DropBreadCrumb();
}
AM_DropBreadCrumb();
}

// [BH] check if new sector is liquid and clip/unclip feet as necessary
Expand Down

0 comments on commit aa94898

Please sign in to comment.