Merge branch 'overtime-corners' into 'master'

Battle: measure overtime barrier radius by minimap corners, instead of edges

Closes #982

See merge request KartKrew/Kart!2047
This commit is contained in:
Oni 2024-03-09 05:08:38 +00:00
commit 3f28fb005d

View file

@ -1362,8 +1362,6 @@ void P_CheckTimeLimit(void)
thinker_t *th; thinker_t *th;
mobj_t *center = NULL; mobj_t *center = NULL;
fixed_t rx, ry;
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{ {
mobj_t *thismo; mobj_t *thismo;
@ -1397,18 +1395,17 @@ void P_CheckTimeLimit(void)
// Get largest radius from center point to minimap edges // Get largest radius from center point to minimap edges
rx = max( fixed_t r = 0;
abs(battleovertime.x - (minimapinfo.min_x * FRACUNIT)), fixed_t n;
abs(battleovertime.x - (minimapinfo.max_x * FRACUNIT)) #define corner(px, py) ((n = FixedHypot(battleovertime.x - (px), battleovertime.y - (py))), r = max(r, n))
); corner(minimapinfo.min_x * FRACUNIT, minimapinfo.min_y * FRACUNIT);
corner(minimapinfo.min_x * FRACUNIT, minimapinfo.max_y * FRACUNIT);
ry = max( corner(minimapinfo.max_x * FRACUNIT, minimapinfo.min_y * FRACUNIT);
abs(battleovertime.y - (minimapinfo.min_y * FRACUNIT)), corner(minimapinfo.max_x * FRACUNIT, minimapinfo.max_y * FRACUNIT);
abs(battleovertime.y - (minimapinfo.max_y * FRACUNIT)) #undef corner
);
battleovertime.initial_radius = min( battleovertime.initial_radius = min(
max(max(rx, ry), 4096 * mapobjectscale), max(r, 4096 * mapobjectscale),
// Prevent overflow in K_RunBattleOvertime // Prevent overflow in K_RunBattleOvertime
FixedDiv(INT32_MAX, M_PI_FIXED) / 2 FixedDiv(INT32_MAX, M_PI_FIXED) / 2
); );