From b749cc117d1b6afdaa2fdb7aebb0d58505c41dc8 Mon Sep 17 00:00:00 2001 From: Anonimus Date: Sat, 27 Sep 2025 16:54:59 -0400 Subject: [PATCH] Attempt to remedy odds issues --- src/k_odds.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/k_odds.c b/src/k_odds.c index 540e8ead0..4a9697bac 100644 --- a/src/k_odds.c +++ b/src/k_odds.c @@ -966,13 +966,23 @@ UINT32 K_CalculateInitalPDIS(const player_t *player, UINT8 pingame) secondPlayer = &players[secondIndex]; // Add the distance to the player behind you. - pdis += P_AproxDistance(P_AproxDistance( + // Distances are divided by 4, then further divided by a fracunit + // to prevent overflow issues. + pdis += (P_AproxDistance(P_AproxDistance( firstPlayer->mo->x/4 - secondPlayer->mo->x/4, firstPlayer->mo->y/4 - secondPlayer->mo->y/4), - firstPlayer->mo->z/4 - secondPlayer->mo->z/4); + firstPlayer->mo->z/4 - secondPlayer->mo->z/4) + / FRACUNIT); - // Scale it to prevent overflow issues. - pdis = (pdis / FRACUNIT)*2; + // Scale it to mostly return to normalcy. + pdis = (pdis * 2); + + // 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; // Advance to next index. firstIndex = secondIndex;