From d75402b37ef63cf7d5324de0d8cd11cf509b2d6c Mon Sep 17 00:00:00 2001 From: Anonimus Date: Sat, 27 Sep 2025 22:02:08 -0400 Subject: [PATCH] Attempt to remedy fixed-point math problems by using a 64-bit integer --- src/k_odds.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/k_odds.c b/src/k_odds.c index 799580a04..159facd5b 100644 --- a/src/k_odds.c +++ b/src/k_odds.c @@ -983,9 +983,11 @@ UINT32 K_CalculateInitalPDIS(const player_t *player, UINT8 pingame) // Again, but this time base it on playercount, same form as // the following vanilla adjustment, but much weaker since it // stacks with it + // MAXODDS should always match the number of players the game is designed // around, so there shouldn't be any issues with basing this calc around that. - pdis = ((100 + MAXODDS - min(pingame, 16)) * pdis) / 100; + // Hacky solution to the overflow problem: use 64-bit integers! + pdis = (UINT32)(((UINT64)(100 + MAXODDS - min(pingame, 16)) * pdis) / 100); // Advance to next index. firstIndex = secondIndex;