mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
K_UpdateGPRank
- The previous location for updating grandprixinfo.rank.position and grandprixinfo.rank.skin was too early.
- K_GetPodiumPosition checks player->score
- Y_StartIntermission calls Y_CalculateMatchData
- Y_CalculateMatchData checks K_CalculateGPGrade... which uses invalid position info to determine grade!
- Y_CalculateMatchData updates player score
- To this end, rearrange Y_CalculateMatchData to accomodate.
- Calls K_UpdateGPRank.
- Then, calls K_CalculateGPGrade.
- Also called after G_UpdateVisited if no intermission occours, for general consistency.
- In addition, adjust so earlier players have port priority for skin saved to gamedata.
This commit is contained in:
parent
117a45422a
commit
3c505e2676
4 changed files with 89 additions and 50 deletions
17
src/g_game.c
17
src/g_game.c
|
|
@ -4464,15 +4464,11 @@ static void G_DoCompleted(void)
|
|||
G_SetGamestate(GS_NULL);
|
||||
wipegamestate = GS_NULL;
|
||||
|
||||
grandprixinfo.rank.prisons += numtargets;
|
||||
grandprixinfo.rank.position = MAXPLAYERS;
|
||||
grandprixinfo.rank.skin = MAXSKINS;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
{
|
||||
// SRB2Kart: exitlevel shouldn't get you the points
|
||||
// Exitlevel shouldn't get you the points
|
||||
if (!players[i].exiting && !(players[i].pflags & PF_NOCONTEST))
|
||||
{
|
||||
clientPowerAdd[i] = 0;
|
||||
|
|
@ -4493,16 +4489,6 @@ static void G_DoCompleted(void)
|
|||
}
|
||||
|
||||
G_PlayerFinishLevel(i); // take away cards and stuff
|
||||
|
||||
if (players[i].bot == false)
|
||||
{
|
||||
UINT8 podiumposition = K_GetPodiumPosition(&players[i]);
|
||||
if (podiumposition <= grandprixinfo.rank.position)
|
||||
{
|
||||
grandprixinfo.rank.position = podiumposition;
|
||||
grandprixinfo.rank.skin = players[i].skin;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4525,6 +4511,7 @@ static void G_DoCompleted(void)
|
|||
|| (intertype == int_none))
|
||||
{
|
||||
G_UpdateVisited();
|
||||
K_UpdateGPRank();
|
||||
G_AfterIntermission();
|
||||
}
|
||||
else
|
||||
|
|
|
|||
34
src/k_rank.c
34
src/k_rank.c
|
|
@ -18,6 +18,8 @@
|
|||
#include "g_game.h"
|
||||
#include "k_bot.h"
|
||||
#include "k_kart.h"
|
||||
#include "k_battle.h"
|
||||
#include "k_podium.h"
|
||||
#include "m_random.h"
|
||||
#include "r_things.h"
|
||||
#include "fastcmp.h"
|
||||
|
|
@ -342,6 +344,38 @@ void K_InitGrandPrixRank(gpRank_t *rankData)
|
|||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_UpdateGPRank(void)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
void K_UpdateGPRank(void)
|
||||
{
|
||||
if (grandprixinfo.gp != true)
|
||||
return;
|
||||
|
||||
UINT8 i;
|
||||
|
||||
grandprixinfo.rank.prisons += numtargets;
|
||||
grandprixinfo.rank.position = MAXPLAYERS;
|
||||
grandprixinfo.rank.skin = MAXSKINS;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i]
|
||||
|| players[i].spectator == true
|
||||
|| players[i].bot == true)
|
||||
continue;
|
||||
|
||||
UINT8 podiumposition = K_GetPodiumPosition(&players[i]);
|
||||
if (podiumposition >= grandprixinfo.rank.position) // port priority
|
||||
continue;
|
||||
|
||||
grandprixinfo.rank.position = podiumposition;
|
||||
grandprixinfo.rank.skin = players[i].skin;
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
gp_rank_e K_CalculateGPGrade(gpRank_t *rankData)
|
||||
|
||||
|
|
|
|||
15
src/k_rank.h
15
src/k_rank.h
|
|
@ -66,6 +66,21 @@ struct gpRank_t
|
|||
void K_InitGrandPrixRank(gpRank_t *rankData);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void K_UpdateGPRank(void)
|
||||
|
||||
Updates the best ranking across all human
|
||||
players.
|
||||
|
||||
Input Arguments:-
|
||||
N/A
|
||||
|
||||
Return:-
|
||||
N/A
|
||||
--------------------------------------------------*/
|
||||
void K_UpdateGPRank(void);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
gp_rank_e K_CalculateGPGrade(gpRank_t *rankData);
|
||||
|
||||
|
|
|
|||
|
|
@ -151,41 +151,6 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
|
|||
{
|
||||
getmainplayer = true;
|
||||
|
||||
{
|
||||
// See also G_GetNextMap, M_DrawPause
|
||||
data.showrank = false;
|
||||
if (grandprixinfo.gp == true
|
||||
&& netgame == false // TODO netgame Special Mode support
|
||||
&& grandprixinfo.gamespeed >= KARTSPEED_NORMAL
|
||||
&& roundqueue.size > 1
|
||||
&& roundqueue.entries[roundqueue.size - 1].rankrestricted == true
|
||||
)
|
||||
{
|
||||
if (roundqueue.position == roundqueue.size-1)
|
||||
{
|
||||
// On A rank pace? Then you get a chance for S rank!
|
||||
gp_rank_e rankforline = K_CalculateGPGrade(&grandprixinfo.rank);
|
||||
|
||||
data.showrank = (rankforline >= GRADE_A);
|
||||
|
||||
data.linemeter =
|
||||
(min(rankforline, GRADE_A)
|
||||
* (2 * TICRATE)
|
||||
) / GRADE_A;
|
||||
|
||||
// A little extra time to take it all in
|
||||
timer += TICRATE;
|
||||
}
|
||||
|
||||
if (gamedata->everseenspecial == true
|
||||
|| roundqueue.position == roundqueue.size)
|
||||
{
|
||||
// Additional cases in which it should always be shown.
|
||||
data.showrank = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.encore = encoremode;
|
||||
|
||||
memset(data.jitter, 0, sizeof (data.jitter));
|
||||
|
|
@ -302,6 +267,44 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
|
|||
|
||||
if (getmainplayer == true)
|
||||
{
|
||||
// Okay, player scores have been set now - we can calculate GP-relevant material.
|
||||
{
|
||||
K_UpdateGPRank();
|
||||
|
||||
// See also G_GetNextMap, M_DrawPause
|
||||
data.showrank = false;
|
||||
if (grandprixinfo.gp == true
|
||||
&& netgame == false // TODO netgame Special Mode support
|
||||
&& grandprixinfo.gamespeed >= KARTSPEED_NORMAL
|
||||
&& roundqueue.size > 1
|
||||
&& roundqueue.entries[roundqueue.size - 1].rankrestricted == true
|
||||
)
|
||||
{
|
||||
if (roundqueue.position == roundqueue.size-1)
|
||||
{
|
||||
// On A rank pace? Then you get a chance for S rank!
|
||||
gp_rank_e rankforline = K_CalculateGPGrade(&grandprixinfo.rank);
|
||||
|
||||
data.showrank = (rankforline >= GRADE_A);
|
||||
|
||||
data.linemeter =
|
||||
(min(rankforline, GRADE_A)
|
||||
* (2 * TICRATE)
|
||||
) / GRADE_A;
|
||||
|
||||
// A little extra time to take it all in
|
||||
timer += TICRATE;
|
||||
}
|
||||
|
||||
if (gamedata->everseenspecial == true
|
||||
|| roundqueue.position == roundqueue.size)
|
||||
{
|
||||
// Additional cases in which it should always be shown.
|
||||
data.showrank = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i = MAXPLAYERS;
|
||||
|
||||
for (j = 0; j < data.numplayers; j++)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue