From 5a42c99d0a75b8264012aa74c12db570d74e5338 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Sat, 17 May 2025 10:11:58 -0400 Subject: [PATCH] Rname stuff better --- src/d_player.h | 4 ++-- src/g_game.c | 16 ++++++++-------- src/k_hud.cpp | 10 +++++----- src/k_kart.c | 25 +++++++++++++------------ src/k_kart.h | 4 ++-- src/k_podium.cpp | 16 ++++++++-------- src/k_rank.cpp | 10 +++++----- src/k_rank.h | 4 ++-- src/k_roulette.c | 6 +++--- src/k_tally.cpp | 2 +- src/objects/checkpoint.cpp | 4 ++-- src/p_saveg.cpp | 16 ++++++++-------- src/p_spec.c | 4 ++-- src/y_inter.cpp | 4 ++-- 14 files changed, 63 insertions(+), 62 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index f19dec65d..a1bb12ab4 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -949,8 +949,8 @@ struct player_t tic_t laptime[LAP__MAX]; UINT8 laps; // Number of laps (optional) UINT8 latestlap; - UINT32 lapPoints; // Points given from laps - INT32 exp; + UINT32 exp; // Points given from laps and checkpoints + INT32 gradingfactor; UINT16 gradingpointnum; // how many grading points, checkpoint and finishline, you've passed INT32 cheatchecknum; // The number of the last cheatcheck you hit INT32 checkpointId; // Players respawn here, objects/checkpoint.cpp diff --git a/src/g_game.c b/src/g_game.c index 3bfd4b8a7..faaa98f0e 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2211,8 +2211,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) INT16 totalring; UINT8 laps; UINT8 latestlap; - UINT32 lapPoints; - INT32 exp; + UINT32 exp; + INT32 gradingfactor; UINT16 gradingpointnum; UINT16 skincolor; @@ -2417,8 +2417,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) khudfault = 0; laps = 0; latestlap = 0; - lapPoints = 0; - exp = FRACUNIT; + exp = 0; + gradingfactor = FRACUNIT; gradingpointnum = 0; roundscore = 0; exiting = 0; @@ -2463,8 +2463,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) laps = players[player].laps; latestlap = players[player].latestlap; - lapPoints = players[player].lapPoints; exp = players[player].exp; + gradingfactor = players[player].gradingfactor; gradingpointnum = players[player].gradingpointnum; roundscore = players[player].roundscore; @@ -2589,8 +2589,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) p->laps = laps; p->latestlap = latestlap; - p->lapPoints = lapPoints; p->exp = exp; + p->gradingfactor = gradingfactor; p->gradingpointnum = gradingpointnum; p->totalring = totalring; @@ -4716,8 +4716,8 @@ static void G_DoCompleted(void) if (grandprixinfo.eventmode == GPEVENT_NONE) { - grandprixinfo.rank.winPoints += K_CalculateGPRankPoints(K_GetDisplayEXP(player), grandprixinfo.rank.position, grandprixinfo.rank.totalPlayers); - grandprixinfo.rank.laps += K_GetDisplayEXP(player); + grandprixinfo.rank.winPoints += K_CalculateGPRankPoints(K_GetEXP(player), grandprixinfo.rank.position, grandprixinfo.rank.totalPlayers); + grandprixinfo.rank.laps += K_GetEXP(player); } else if (grandprixinfo.eventmode == GPEVENT_SPECIAL) { diff --git a/src/k_hud.cpp b/src/k_hud.cpp index 6e592dfe1..be37fba77 100644 --- a/src/k_hud.cpp +++ b/src/k_hud.cpp @@ -3246,7 +3246,7 @@ static boolean K_drawKartLaps(void) INT32 bump = 0; boolean drewsticker = false; - UINT16 displayEXP = K_GetDisplayEXP(stplyr); + UINT16 displayEXP = K_GetEXP(stplyr); // Jesus Christ. // I do not understand the way this system of offsets is laid out at all, @@ -3365,8 +3365,8 @@ static boolean K_drawKartLaps(void) // WHAT IS THIS? // WHAT ARE YOU FUCKING TALKING ABOUT? V_DrawMappedPatch(fr, fy, V_HUDTRANS|V_SLIDEIN|splitflags, kp_exp[1], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_MUSTARD, GTC_CACHE)); - auto transflag = K_GetTransFlagFromFixed(stplyr->exp); - skincolornum_t overlaycolor = stplyr->exp < FRACUNIT ? SKINCOLOR_RUBY : SKINCOLOR_ULTRAMARINE ; + auto transflag = K_GetTransFlagFromFixed(stplyr->gradingfactor); + skincolornum_t overlaycolor = stplyr->gradingfactor < FRACUNIT ? SKINCOLOR_RUBY : SKINCOLOR_ULTRAMARINE ; auto colormap = R_GetTranslationColormap(TC_RAINBOW, overlaycolor, GTC_CACHE); V_DrawMappedPatch(fr, fy, transflag|V_SLIDEIN|splitflags, kp_exp[1], colormap); @@ -3382,8 +3382,8 @@ static boolean K_drawKartLaps(void) V_DrawMappedPatch(LAPS_X+bump, LAPS_Y, V_HUDTRANS|V_SLIDEIN|splitflags, kp_exp[0], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_MUSTARD, GTC_CACHE)); - auto transflag = K_GetTransFlagFromFixed(stplyr->exp); - skincolornum_t overlaycolor = stplyr->exp < FRACUNIT ? SKINCOLOR_RUBY : SKINCOLOR_ULTRAMARINE ; + auto transflag = K_GetTransFlagFromFixed(stplyr->gradingfactor); + skincolornum_t overlaycolor = stplyr->gradingfactor < FRACUNIT ? SKINCOLOR_RUBY : SKINCOLOR_ULTRAMARINE ; auto colormap = R_GetTranslationColormap(TC_RAINBOW, overlaycolor, GTC_CACHE); V_DrawMappedPatch(LAPS_X+bump, LAPS_Y, transflag|V_SLIDEIN|splitflags, kp_exp[0], colormap); diff --git a/src/k_kart.c b/src/k_kart.c index 147b32159..f492bfa0d 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4234,9 +4234,10 @@ void K_CheckpointCrossAward(player_t *player) if (gametype != GT_RACE) return; - player->exp += K_GetExpAdjustment(player); + player->gradingfactor += K_GetGradingMultAdjustment(player); if (!player->cangrabitems) player->cangrabitems = 1; + K_AwardPlayerRings(player, (player->bot ? 20 : 10), true); } @@ -13284,7 +13285,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else { UINT32 behind = K_GetItemRouletteDistance(player, player->itemRoulette.playing); - behind = FixedMul(behind, max(player->exp, FRACUNIT/2)); + behind = FixedMul(behind, max(player->gradingfactor, FRACUNIT/2)); UINT32 behindMulti = behind / 500; behindMulti = min(behindMulti, 60); award = award * (behindMulti + 10) / 10; @@ -15440,10 +15441,10 @@ boolean K_PlayerCanUseItem(player_t *player) return (player->mo->health > 0 && !player->spectator && !P_PlayerInPain(player) && !mapreset && leveltime > introtime); } -fixed_t K_GetExpAdjustment(player_t *player) +fixed_t K_GetGradingMultAdjustment(player_t *player) { - fixed_t exp_power = 3*FRACUNIT/100; // adjust to change overall xp volatility - fixed_t exp_stablerate = 3*FRACUNIT/10; // how low is your placement before losing XP? 4*FRACUNIT/10 = top 40% of race will gain + fixed_t power = 3*FRACUNIT/100; // adjust to change overall xp volatility + fixed_t stablerate = 3*FRACUNIT/10; // how low is your placement before losing XP? 4*FRACUNIT/10 = top 40% of race will gain fixed_t result = 0; INT32 live_players = 0; // players we are competing against @@ -15464,7 +15465,7 @@ fixed_t K_GetExpAdjustment(player_t *player) if (live_players < 8) { - exp_power += (8 - live_players) * exp_power/4; + power += (8 - live_players) * power/4; } // Increase XP for each player you're beating... @@ -15480,18 +15481,18 @@ fixed_t K_GetExpAdjustment(player_t *player) } if (player->position < players[i].position) - result += exp_power; + result += power; } // ...then take all of the XP you could possibly have earned, // and lose it proportional to the stable rate. If you're below // the stable threshold, this results in you losing XP. - result -= FixedMul(exp_power, FixedMul(live_players*FRACUNIT, FRACUNIT - exp_stablerate)); + result -= FixedMul(power, FixedMul(live_players*FRACUNIT, FRACUNIT - stablerate)); return result; } -UINT16 K_GetDisplayEXP(player_t *player) +UINT16 K_GetEXP(player_t *player) { UINT32 numgradingpoints = K_GetNumGradingPoints(); @@ -15499,9 +15500,9 @@ UINT16 K_GetDisplayEXP(player_t *player) return UINT16_MAX; // target is where you should be if you're doing good and at a 1.0 mult - fixed_t clampedexp = max(FRACUNIT/2, min(FRACUNIT*5/4, player->exp)); // clamp between 0.5 and 1.25 - fixed_t targetdisplayexp = (TARGETDISPLAYEXP*player->gradingpointnum/max(1,numgradingpoints))<>FRACBITS; + fixed_t clampedmult = max(FRACUNIT/2, min(FRACUNIT*5/4, player->gradingfactor)); // clamp between 0.5 and 1.25 + fixed_t targetdisplayexp = (TARGETEXP*player->gradingpointnum/max(1,numgradingpoints))<>FRACBITS; return displayexp; } diff --git a/src/k_kart.h b/src/k_kart.h index 5c3cc88db..2313955f8 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -308,9 +308,9 @@ boolean K_ThunderDome(void); boolean K_PlayerCanUseItem(player_t *player); -fixed_t K_GetExpAdjustment(player_t *player); +fixed_t K_GetGradingMultAdjustment(player_t *player); -UINT16 K_GetDisplayEXP(player_t *player); +UINT16 K_GetEXP(player_t *player); UINT32 K_GetNumGradingPoints(void); diff --git a/src/k_podium.cpp b/src/k_podium.cpp index 987824155..5b0c08c88 100644 --- a/src/k_podium.cpp +++ b/src/k_podium.cpp @@ -138,7 +138,7 @@ void podiumData_s::Init(void) constexpr INT32 numRaces = 5; for (INT32 i = 0; i < rank.numPlayers; i++) { - rank.totalPoints += numRaces * K_CalculateGPRankPoints(MAXDISPLAYEXP, i+1, rank.totalPlayers); + rank.totalPoints += numRaces * K_CalculateGPRankPoints(MAXEXP, i+1, rank.totalPlayers); } rank.totalRings = numRaces * rank.numPlayers * 20; @@ -156,7 +156,7 @@ void podiumData_s::Init(void) gpRank_level_t *const lvl = &rank.levels[i]; UINT8 specialWinner = 0; UINT16 pprs = 0; - UINT16 plaps = 0; + UINT16 pexp = 0; lvl->id = M_RandomRange(4, nummapheaders); @@ -179,8 +179,8 @@ void podiumData_s::Init(void) } default: { - lvl->totalLapPoints = TARGETDISPLAYEXP; - tlaps += lvl->totalLapPoints; + lvl->totalExp = TARGETEXP; + tlaps += lvl->totalExp; break; } } @@ -198,8 +198,8 @@ void podiumData_s::Init(void) dta->rings = M_RandomRange(0, 20); rgs += dta->rings; - dta->lapPoints = M_RandomRange(MINDISPLAYEXP, MAXDISPLAYEXP); - plaps = std::max(plaps, dta->lapPoints); + dta->exp = M_RandomRange(MINEXP, MAXEXP); + pexp = std::max(pexp, dta->exp); } if (lvl->event == GPEVENT_BONUS) @@ -223,7 +223,7 @@ void podiumData_s::Init(void) } } - laps += plaps; + laps += pexp; prs += pprs; } @@ -691,7 +691,7 @@ void podiumData_s::Draw(void) .xy(22, 1) .align(srb2::Draw::Align::kCenter) .font(srb2::Draw::Font::kPing) - .text(va("%d/%d", dta->lapPoints, lvl->totalLapPoints)); + .text(va("%d/%d", dta->exp, lvl->totalExp)); break; } } diff --git a/src/k_rank.cpp b/src/k_rank.cpp index 9a64bfc23..138461874 100644 --- a/src/k_rank.cpp +++ b/src/k_rank.cpp @@ -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 * K_CalculateGPRankPoints(MAXDISPLAYEXP, i+1, totalPlayers); + totalPoints += grandprixinfo.cup->numlevels * K_CalculateGPRankPoints(MAXEXP, i+1, totalPlayers); } totalRings = grandprixinfo.cup->numlevels * numHumans * 20; @@ -333,7 +333,7 @@ void gpRank_t::Init(void) if (cupLevelNum < nummapheaders && mapheaderinfo[cupLevelNum] != NULL) { //laps += K_RaceLapCount(cupLevelNum); - laps += TARGETDISPLAYEXP; + laps += TARGETEXP; } } @@ -373,7 +373,7 @@ void gpRank_t::Rejigger(UINT16 removedmap, UINT16 removedgt, UINT16 addedmap, UI { for (i = 0; i < numPlayers; i++) { - deltaPoints += K_CalculateGPRankPoints(MAXDISPLAYEXP, i + 1, totalPlayers); + deltaPoints += K_CalculateGPRankPoints(MAXEXP, i + 1, totalPlayers); } if (addedgt == GT_RACE) totalPoints += deltaPoints; @@ -511,7 +511,7 @@ void gpRank_t::Update(void) lvl->time = UINT32_MAX; - lvl->totalLapPoints = TARGETDISPLAYEXP; + lvl->totalExp = TARGETEXP; lvl->totalPrisons = maptargets; UINT8 i; @@ -553,7 +553,7 @@ void gpRank_t::Update(void) dta->position = player->tally.position; dta->rings = player->tally.rings; - dta->lapPoints = player->tally.laps; + dta->exp = player->tally.laps; dta->prisons = player->tally.prisons; dta->gotSpecialPrize = !!!(player->pflags & PF_NOCONTEST); dta->grade = static_cast(player->tally.rank); diff --git a/src/k_rank.h b/src/k_rank.h index fc233fbb0..59c57eae9 100644 --- a/src/k_rank.h +++ b/src/k_rank.h @@ -21,7 +21,7 @@ struct gpRank_level_perplayer_t { UINT8 position; UINT8 rings; - UINT16 lapPoints; + UINT16 exp; UINT16 prisons; boolean gotSpecialPrize; gp_rank_e grade; @@ -32,7 +32,7 @@ struct gpRank_level_t UINT16 id; INT32 event; UINT32 time; - UINT16 totalLapPoints; + UINT16 totalExp; UINT16 totalPrisons; gpRank_level_perplayer_t perPlayer[MAXSPLITSCREENPLAYERS]; }; diff --git a/src/k_roulette.c b/src/k_roulette.c index 4056f67d6..e9a1ac7d1 100644 --- a/src/k_roulette.c +++ b/src/k_roulette.c @@ -486,8 +486,8 @@ static UINT32 K_ScaleItemDistance(const player_t *player, UINT32 distance, UINT8 FRACUNIT + (K_ItemOddsScale(numPlayers) / 2) ); - // Distance is reduced based on the player's exp - // distance = FixedMul(distance, player->exp); + // Distance is reduced based on the player's gradingfactor + // distance = FixedMul(distance, player->gradingfactor); return distance; } @@ -1382,7 +1382,7 @@ void K_FillItemRouletteData(const player_t *player, itemroulette_t *const roulet if ((gametyperules & GTR_CIRCUIT) && !K_Cooperative()) { - roulette->dist = FixedMul(roulette->preexpdist, max(player->exp, FRACUNIT/2)); + roulette->dist = FixedMul(roulette->preexpdist, max(player->gradingfactor, FRACUNIT/2)); } // =============================================================================== diff --git a/src/k_tally.cpp b/src/k_tally.cpp index 1cde311d5..17dacceb7 100644 --- a/src/k_tally.cpp +++ b/src/k_tally.cpp @@ -343,7 +343,7 @@ void level_tally_t::Init(player_t *player) if ((gametypes[gt]->rules & GTR_CIRCUIT) == GTR_CIRCUIT) { - UINT16 displayEXP = K_GetDisplayEXP(player); + UINT16 displayEXP = K_GetEXP(player); if (displayEXP != UINT16_MAX) { diff --git a/src/objects/checkpoint.cpp b/src/objects/checkpoint.cpp index 338e3f3a1..e3b477f71 100644 --- a/src/objects/checkpoint.cpp +++ b/src/objects/checkpoint.cpp @@ -669,11 +669,11 @@ void Obj_CrossCheckpoints(player_t* player, fixed_t old_x, fixed_t old_y) { if (player->position == 1) { - player->lapPoints += 2; + player->exp += 2; } else { - player->lapPoints += 1; + player->exp += 1; } } diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 591613d6f..f74c490d3 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -288,8 +288,8 @@ static void P_NetArchivePlayers(savebuffer_t *save) } WRITEUINT8(save->p, players[i].laps); WRITEUINT8(save->p, players[i].latestlap); - WRITEUINT32(save->p, players[i].lapPoints); - WRITEINT32(save->p, players[i].exp); + WRITEUINT32(save->p, players[i].exp); + WRITEINT32(save->p, players[i].gradingfactor); WRITEUINT16(save->p, players[i].gradingpointnum); WRITEINT32(save->p, players[i].cheatchecknum); WRITEINT32(save->p, players[i].checkpointId); @@ -979,8 +979,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save) } players[i].laps = READUINT8(save->p); // Number of laps (optional) players[i].latestlap = READUINT8(save->p); - players[i].lapPoints = READUINT32(save->p); - players[i].exp = READINT32(save->p); + players[i].exp = READUINT32(save->p); + players[i].gradingfactor = READINT32(save->p); players[i].gradingpointnum = READUINT16(save->p); players[i].cheatchecknum = READINT32(save->p); players[i].checkpointId = READINT32(save->p); @@ -6395,7 +6395,7 @@ static inline void P_ArchiveMisc(savebuffer_t *save) WRITEINT32(save->p, lvl->event); WRITEUINT32(save->p, lvl->time); - WRITEUINT16(save->p, lvl->totalLapPoints); + WRITEUINT16(save->p, lvl->totalExp); WRITEUINT16(save->p, lvl->totalPrisons); UINT8 j; @@ -6405,7 +6405,7 @@ static inline void P_ArchiveMisc(savebuffer_t *save) WRITEUINT8(save->p, plr->position); WRITEUINT8(save->p, plr->rings); - WRITEUINT16(save->p, plr->lapPoints); + WRITEUINT16(save->p, plr->exp); WRITEUINT16(save->p, plr->prisons); WRITEUINT8(save->p, (UINT8)plr->gotSpecialPrize); WRITESINT8(save->p, (SINT8)plr->grade); @@ -6683,7 +6683,7 @@ static boolean P_UnArchiveSPGame(savebuffer_t *save) lvl->event = READINT32(save->p); lvl->time = READUINT32(save->p); - lvl->totalLapPoints = READUINT16(save->p); + lvl->totalExp = READUINT16(save->p); lvl->totalPrisons = READUINT16(save->p); for (j = 0; j < rank->numPlayers; j++) @@ -6692,7 +6692,7 @@ static boolean P_UnArchiveSPGame(savebuffer_t *save) plr->position = READUINT8(save->p); plr->rings = READUINT8(save->p); - plr->lapPoints = READUINT16(save->p); + plr->exp = READUINT16(save->p); plr->prisons = READUINT16(save->p); plr->gotSpecialPrize = (boolean)READUINT8(save->p); plr->grade = (gp_rank_e)READSINT8(save->p); diff --git a/src/p_spec.c b/src/p_spec.c index 2d5707d37..22ae3c5e9 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2113,11 +2113,11 @@ static void K_HandleLapIncrement(player_t *player) { if (inDuel == false && player->position == 1) // 1st place in 1v1 uses thumbs up { - player->lapPoints += 2; + player->exp += 2; } else { - player->lapPoints++; + player->exp++; } } diff --git a/src/y_inter.cpp b/src/y_inter.cpp index 572aca76b..5de356f41 100644 --- a/src/y_inter.cpp +++ b/src/y_inter.cpp @@ -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_GetDisplayEXP(&players[i]), data.pos[data.numplayers], pointgetters); + data.increase[i] = K_CalculateGPRankPoints(K_GetEXP(&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_CalculateGPRankPoints(K_GetDisplayEXP(player), pos, numPlaying); + ourScore += K_CalculateGPRankPoints(K_GetEXP(player), pos, numPlaying); return ourScore; }