Universal scale for cluster distancing
Should hopefully make gradienting less punishing on maps like Green Cave
This commit is contained in:
parent
fd65151d50
commit
b6c34067bb
1 changed files with 30 additions and 4 deletions
34
src/k_kart.c
34
src/k_kart.c
|
|
@ -9364,6 +9364,30 @@ void K_KartLegacyUpdatePosition(player_t *player)
|
||||||
player->position = position;
|
player->position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------
|
||||||
|
UINT32 K_UndoMapScaling(UINT32 distance)
|
||||||
|
|
||||||
|
Takes a raw map distance and adjusts it to
|
||||||
|
be in x1 scale.
|
||||||
|
|
||||||
|
Input Arguments:-
|
||||||
|
distance - Original distance.
|
||||||
|
|
||||||
|
Return:-
|
||||||
|
Distance unscaled by mapobjectscale.
|
||||||
|
--------------------------------------------------*/
|
||||||
|
static UINT32 K_UndoMapScaling(UINT32 distance)
|
||||||
|
{
|
||||||
|
if (mapobjectscale != FRACUNIT)
|
||||||
|
{
|
||||||
|
// Bring back to normal scale.
|
||||||
|
return FixedDiv(distance, mapobjectscale);
|
||||||
|
}
|
||||||
|
|
||||||
|
return distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Brute-force finds the area on the course with the highest player density in a given radius.
|
// Brute-force finds the area on the course with the highest player density in a given radius.
|
||||||
// Based on DBSCAN, so it "chain-scans" neighboring players as well for a more accurate result.
|
// Based on DBSCAN, so it "chain-scans" neighboring players as well for a more accurate result.
|
||||||
UINT32 clusterid = 0;
|
UINT32 clusterid = 0;
|
||||||
|
|
@ -9462,8 +9486,9 @@ void K_UpdateAllPlayerPositions(void)
|
||||||
// First loop: Ensure all players' distance to the finish line are all accurate
|
// First loop: Ensure all players' distance to the finish line are all accurate
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
player_t *player = &players[i];
|
player_t* player = &players[i];
|
||||||
if (!playeringame[i] || player->spectator || !player->mo || P_MobjWasRemoved(player->mo))
|
if (!playeringame[i] || player->spectator || !player->mo ||
|
||||||
|
P_MobjWasRemoved(player->mo))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -9482,8 +9507,9 @@ void K_UpdateAllPlayerPositions(void)
|
||||||
else
|
else
|
||||||
K_KartUpdatePosition(&players[i]);
|
K_KartUpdatePosition(&players[i]);
|
||||||
|
|
||||||
// Get the cluster distance.
|
// Get the cluster distance.
|
||||||
players[i].distancefromcluster = K_UpdateDistanceFromCluster(&players[i]);
|
players[i].distancefromcluster =
|
||||||
|
K_UndoMapScaling(K_UpdateDistanceFromCluster(&players[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue