Use RingRacers line fudge for setting starpost values with new waypoitns

This commit is contained in:
NepDisk 2025-01-06 12:45:49 -05:00
parent ff0dcd94a2
commit 03478b6458

View file

@ -7777,6 +7777,21 @@ static UINT32 u32_delta(UINT32 x, UINT32 y)
return x > y ? x - y : y - x;
}
/*--------------------------------------------------
* static void K_FudgeRespawn(player_t *player, const waypoint_t *const waypoint)
*
* Fudges respawn coordinates to slightly before the waypoint if it would
* be exactly on a line. See K_GetWaypointIsOnLine.
- *-------------------------------------------------*/
static void K_FudgeRespawn(player_t *player, const waypoint_t *const waypoint)
{
const angle_t from = R_PointToAngle2(waypoint->mobj->x, waypoint->mobj->y,
player->mo->x, player->mo->y) >> ANGLETOFINESHIFT;
player->starpostx += FixedMul(16, FINECOSINE(from));
player->starposty += FixedMul(16, FINESINE(from));
}
/*--------------------------------------------------
static void K_UpdatePlayerWaypoints(player_t *const player)
@ -7833,6 +7848,11 @@ static void K_UpdatePlayerWaypoints(player_t *const player)
// Then do x and y
player->starpostx = player->mo->x >> FRACBITS;
player->starposty = player->mo->y >> FRACBITS;
if (player->nextwaypoint->onaline)
{
K_FudgeRespawn(player, player->nextwaypoint);
}
}
}