small hud performance improvement

now that we have spots on the player struct for both gradingfactor and exp, store exp in the exp field after adjusting gradingfactor, and just reference it instead of recalculating every time
This commit is contained in:
Ashnal 2025-05-17 15:37:15 -04:00
parent 144e2be262
commit 50fd04bdb1
5 changed files with 8 additions and 7 deletions

View file

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

View file

@ -3246,7 +3246,7 @@ static boolean K_drawKartLaps(void)
INT32 bump = 0;
boolean drewsticker = false;
UINT16 displayEXP = K_GetEXP(stplyr);
UINT16 displayEXP = stplyr->exp;
// Jesus Christ.
// I do not understand the way this system of offsets is laid out at all,

View file

@ -4235,6 +4235,7 @@ void K_CheckpointCrossAward(player_t *player)
return;
player->gradingfactor += K_GetGradingMultAdjustment(player);
player->exp = K_GetEXP(player);
if (!player->cangrabitems)
player->cangrabitems = 1;

View file

@ -343,12 +343,12 @@ void level_tally_t::Init(player_t *player)
if ((gametypes[gt]->rules & GTR_CIRCUIT) == GTR_CIRCUIT)
{
UINT16 displayEXP = K_GetEXP(player);
UINT16 displayEXP = player->exp;
if (displayEXP != UINT16_MAX)
{
exp = displayEXP;
totalExp = 100;
totalExp = TARGETEXP;
}
}

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_CalculateGPRankPoints(K_GetEXP(&players[i]), data.pos[data.numplayers], pointgetters);
data.increase[i] = K_CalculateGPRankPoints((&players[i])->exp, 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_CalculateGPRankPoints(K_GetEXP(player), pos, numPlaying);
ourScore += K_CalculateGPRankPoints(player->exp, pos, numPlaying);
return ourScore;
}