mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'fix-shortcut-duel-scoring' into 'master'
Fix split-path shortcut Duel scoring Closes #1637 See merge request kart-krew-dev/ring-racers-internal!2754
This commit is contained in:
commit
0e58b9ea91
1 changed files with 41 additions and 1 deletions
42
src/k_kart.c
42
src/k_kart.c
|
|
@ -4492,6 +4492,45 @@ void K_AwardPlayerRings(player_t *player, UINT16 rings, boolean overload)
|
|||
}
|
||||
}
|
||||
|
||||
// WARNING: Can return NULL if players are tied for the checkpoint lead
|
||||
static player_t* K_CheckpointLeader(void)
|
||||
{
|
||||
player_t *leader = NULL;
|
||||
|
||||
for (UINT8 i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
player_t *check = &players[i];
|
||||
|
||||
if (check->spectator)
|
||||
continue;
|
||||
|
||||
if (leader == NULL || leader->gradingpointnum < check->gradingpointnum)
|
||||
leader = check;
|
||||
}
|
||||
|
||||
// No unambiguous leader? Return NULL.
|
||||
for (UINT8 i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
player_t *check = &players[i];
|
||||
|
||||
if (check->spectator)
|
||||
continue;
|
||||
if (check == leader)
|
||||
continue;
|
||||
|
||||
if (leader->gradingpointnum == check->gradingpointnum)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return leader;
|
||||
}
|
||||
|
||||
static void K_SetupSplitForPlayer(player_t *us, player_t *them, tic_t ourtime, tic_t theirtime)
|
||||
{
|
||||
us->karthud[khud_splittimer] = 3*TICRATE;
|
||||
|
|
@ -4598,7 +4637,8 @@ void K_CheckpointCrossAward(player_t *player)
|
|||
K_AwardPlayerRings(player, (player->bot ? 20 : 10), true);
|
||||
|
||||
// Update Duel scoring.
|
||||
if (K_InRaceDuel() && player->position == 1)
|
||||
player_t *leader = K_CheckpointLeader();
|
||||
if (K_InRaceDuel() && player == leader)
|
||||
{
|
||||
player->duelscore += 1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue