Battle: scale Overtime Barrier to minimap size

This commit is contained in:
James R 2023-06-30 19:26:23 -07:00 committed by VelocitOni
parent 8931c7f570
commit 4d24eb71b6

View file

@ -830,6 +830,8 @@ void P_CheckTimeLimit(void)
thinker_t *th;
mobj_t *center = NULL;
fixed_t rx, ry;
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
{
mobj_t *thismo;
@ -861,7 +863,24 @@ void P_CheckTimeLimit(void)
battleovertime.z = center->z;
}
battleovertime.initial_radius = 4096 * mapobjectscale;
// Get largest radius from center point to minimap edges
rx = max(
abs(battleovertime.x - (minimapinfo.min_x * FRACUNIT)),
abs(battleovertime.x - (minimapinfo.max_x * FRACUNIT))
);
ry = max(
abs(battleovertime.y - (minimapinfo.min_y * FRACUNIT)),
abs(battleovertime.y - (minimapinfo.max_y * FRACUNIT))
);
battleovertime.initial_radius = min(
max(max(rx, ry), 4096 * mapobjectscale),
// Prevent overflow in K_RunBattleOvertime
FixedDiv(INT32_MAX, M_PI_FIXED) / 2
);
battleovertime.radius = battleovertime.initial_radius;
battleovertime.enabled = 1;