Reworks changes to K_CalculateGPRankPoints to account for the 125+10 max for points

and untramples the implementation
fixes gp results screen totals

I really need to refactor lappoints to be named exppoints or something later
This commit is contained in:
Ashnal 2025-04-29 22:12:59 -04:00
parent 8242cb89f0
commit bf6a5babfb
6 changed files with 22 additions and 19 deletions

View file

@ -4716,8 +4716,8 @@ static void G_DoCompleted(void)
if (grandprixinfo.eventmode == GPEVENT_NONE)
{
grandprixinfo.rank.winPoints += K_CalculateGPRankPoints(player, grandprixinfo.rank.totalPlayers);
grandprixinfo.rank.laps += player->lapPoints;
grandprixinfo.rank.winPoints += K_CalculateGPRankPoints(K_GetDisplayEXP(player), grandprixinfo.rank.position, grandprixinfo.rank.totalPlayers);
grandprixinfo.rank.laps += K_GetDisplayEXP(player);
}
else if (grandprixinfo.eventmode == GPEVENT_SPECIAL)
{

View file

@ -51,14 +51,13 @@ UINT8 K_BotStartingDifficulty(SINT8 value)
}
/*--------------------------------------------------
INT16 K_CalculateGPRankPoints(player_t* player, UINT8 numplayers)
INT16 K_CalculateGPRankPoints(UINT16 diplayexp, UINT8 position, UINT8 numplayers)
See header file for description.
--------------------------------------------------*/
INT16 K_CalculateGPRankPoints(player_t* player, UINT8 numplayers)
INT16 K_CalculateGPRankPoints(UINT16 displayexp, UINT8 position, UINT8 numplayers)
{
INT16 points;
UINT8 position = player->position;
if (position >= numplayers || position == 0)
{
@ -66,7 +65,7 @@ INT16 K_CalculateGPRankPoints(player_t* player, UINT8 numplayers)
return 0;
}
points = K_GetDisplayEXP(player);
points = displayexp;
// Give bonus to high-ranking players, depending on player count
// This rounds out the point gain when you get 1st every race,

View file

@ -73,7 +73,7 @@ UINT8 K_BotStartingDifficulty(SINT8 value);
Number of points to give.
--------------------------------------------------*/
INT16 K_CalculateGPRankPoints(player_t* player, UINT8 numplayers);
INT16 K_CalculateGPRankPoints(UINT16 displayexp, UINT8 position, UINT8 numplayers);
/*--------------------------------------------------

View file

@ -136,8 +136,10 @@ void podiumData_s::Init(void)
rank.numLevels = 8;
constexpr INT32 numRaces = 5;
rank.totalPoints += numRaces * TARGETDISPLAYEXP;
for (INT32 i = 0; i < rank.numPlayers; i++)
{
rank.totalPoints += numRaces * K_CalculateGPRankPoints(MAXDISPLAYEXP, i+1, rank.totalPlayers);
}
rank.totalRings = numRaces * rank.numPlayers * 20;
// Randomized winnings
@ -177,7 +179,7 @@ void podiumData_s::Init(void)
}
default:
{
lvl->totalLapPoints = M_RandomRange(2, 5) * 2;
lvl->totalLapPoints = TARGETDISPLAYEXP;
tlaps += lvl->totalLapPoints;
break;
}
@ -196,7 +198,7 @@ void podiumData_s::Init(void)
dta->rings = M_RandomRange(0, 20);
rgs += dta->rings;
dta->lapPoints = M_RandomRange(0, lvl->totalLapPoints);
dta->lapPoints = M_RandomRange(MINDISPLAYEXP, MAXDISPLAYEXP);
plaps = std::max(plaps, dta->lapPoints);
}

View file

@ -322,7 +322,7 @@ void gpRank_t::Init(void)
// (Should this account for all coop players?)
for (i = 0; i < numHumans; i++)
{
totalPoints += grandprixinfo.cup->numlevels * TARGETDISPLAYEXP;
totalPoints += grandprixinfo.cup->numlevels * K_CalculateGPRankPoints(MAXDISPLAYEXP, i+1, totalPlayers);
}
totalRings = grandprixinfo.cup->numlevels * numHumans * 20;
@ -332,12 +332,12 @@ void gpRank_t::Init(void)
const INT32 cupLevelNum = grandprixinfo.cup->cachedlevels[i];
if (cupLevelNum < nummapheaders && mapheaderinfo[cupLevelNum] != NULL)
{
laps += K_RaceLapCount(cupLevelNum);
//laps += K_RaceLapCount(cupLevelNum);
laps += TARGETDISPLAYEXP;
}
}
// +1, since 1st place laps are worth 2 pts.
for (i = 0; i < numHumans+1; i++)
for (i = 0; i < numHumans; i++)
{
totalLaps += laps;
}
@ -371,8 +371,10 @@ void gpRank_t::Rejigger(UINT16 removedmap, UINT16 removedgt, UINT16 addedmap, UI
if ((removedgt == GT_RACE) != (addedgt == GT_RACE))
{
deltaPoints += TARGETDISPLAYEXP;
for (i = 0; i < numPlayers; i++)
{
deltaPoints += K_CalculateGPRankPoints(MAXDISPLAYEXP, i + 1, totalPlayers);
}
if (addedgt == GT_RACE)
totalPoints += deltaPoints;
else if (totalPoints > deltaPoints)

View file

@ -309,7 +309,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
if (data.pos[data.numplayers] < pointgetters
&& !(players[i].pflags & PF_NOCONTEST))
{
data.increase[i] = K_GetDisplayEXP(&players[i]);
data.increase[i] = K_CalculateGPRankPoints(K_GetDisplayEXP(&players[i]), data.pos[data.numplayers], pointgetters);
}
}
@ -2196,7 +2196,7 @@ static UINT32 Y_EstimatePodiumScore(player_t *const player, UINT8 numPlaying)
UINT8 pos = Y_PlayersBestPossiblePosition(player);
UINT32 ourScore = player->score;
ourScore += K_GetDisplayEXP(player);
ourScore += K_CalculateGPRankPoints(K_GetDisplayEXP(player), pos, numPlaying);
return ourScore;
}