From 2a36838b540844d15c05409b643978efaf9bce65 Mon Sep 17 00:00:00 2001 From: Ashnal Date: Thu, 12 Jun 2025 00:09:44 -0400 Subject: [PATCH] grading refinements attempt --- src/doomdef.h | 6 ++++-- src/k_kart.c | 4 ++-- src/k_podium.cpp | 52 +++++++++++++++++++++++++++++++++++++++++------- src/k_tally.cpp | 8 ++++---- 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index b62f44472..3ff5c274b 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -745,9 +745,11 @@ extern int #define MAXAMPSCALINGDIST 18000 // Exp +#define EXP_STABLERATE 3*FRACUNIT/10 // how low is your placement before losing XP? 4*FRACUNIT/10 = top 40% of race will gain +#define EXP_POWER 3*FRACUNIT/100 // adjust to change overall xp volatility #define MINEXP 25 // The min value target -#define TARGETEXP 100 // The target value needed for A rank -#define MAXEXP 125 // The max value displayed by the hud and in the tally screen and GP results screen +#define TARGETEXP 120 // Used for grading ... +#define MAXEXP 120 // The max value displayed by the hud and in the tally screen and GP results screen #ifdef __cplusplus } // extern "C" diff --git a/src/k_kart.c b/src/k_kart.c index 8a1a6869a..afe184910 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -15739,8 +15739,8 @@ boolean K_PlayerCanUseItem(player_t *player) fixed_t K_GetGradingFactorAdjustment(player_t *player) { - 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 power = EXP_POWER; // adjust to change overall xp volatility + const fixed_t stablerate = EXP_STABLERATE; // how low is your placement before losing XP? 4*FRACUNIT/10 = top 40% of race will gain fixed_t result = 0; if (g_teamplay) diff --git a/src/k_podium.cpp b/src/k_podium.cpp index 7ce1eaef0..d3ee64205 100644 --- a/src/k_podium.cpp +++ b/src/k_podium.cpp @@ -723,10 +723,28 @@ void podiumData_s::Draw(void) .xy(0, 1) .colorize(static_cast(SKINCOLOR_MUSTARD)) .patch("K_SPTEXP"); + // Colorize the crystal, just like we do for hud - fixed_t factor = FixedDiv(dta->exp*FRACUNIT, lvl->totalExp*FRACUNIT); - skincolornum_t overlaycolor = factor < FRACUNIT ? SKINCOLOR_RUBY : SKINCOLOR_ULTRAMARINE; - if (factor >= FRACUNIT) {factor += factor-FRACUNIT;} // exaggerate the positive side, since reverse engineering the factor like this results in half the translucency range + skincolornum_t overlaycolor = SKINCOLOR_MUSTARD; + fixed_t stablerateinverse = FRACUNIT - EXP_STABLERATE; + INT16 exp_range = MAXEXP-MINEXP; + INT16 exp_offset = dta->exp-MINEXP; + fixed_t factor = (exp_offset*FRACUNIT) / exp_range; // 0.0 to 1.0 in fixed + // amount of blue is how much factor is above EXP_STABLERATE, and amount of red is how much factor is below + // assume that EXP_STABLERATE is within 0.0 to 1.0 in fixed + if (factor <= stablerateinverse) + { + overlaycolor = SKINCOLOR_RUBY; + factor = FixedDiv(factor, stablerateinverse); + } + else + { + overlaycolor = SKINCOLOR_ULTRAMARINE; + fixed_t bluemaxoffset = EXP_STABLERATE; + factor = factor - stablerateinverse; + factor = FRACUNIT - FixedDiv(factor, bluemaxoffset); + } + auto transflag = K_GetTransFlagFromFixed(factor); drawer_gametype .xy(0, 1) @@ -872,12 +890,32 @@ void podiumData_s::Draw(void) drawer_totals_right .colorize(static_cast(SKINCOLOR_MUSTARD)) .patch("K_STEXP"); + // Colorize the crystal for the totals, just like we do for in race hud - fixed_t factor = FixedDiv((rank.exp+(35*rank.numPlayers-1))*FRACUNIT, rank.totalExp*FRACUNIT); // bump the calc a bit, because its probably not possible for every human to get 125 on every race - skincolornum_t overlaycolor = factor < FRACUNIT ? SKINCOLOR_RUBY : SKINCOLOR_ULTRAMARINE; - if (factor >= FRACUNIT) {factor += factor-FRACUNIT;} // exaggerate the positive side, since reverse engineering the factor like this results in half the translucency range + fixed_t extraexpfactor = (MAXEXP*FRACUNIT) / TARGETEXP; + INT16 totalExpMax = FixedMul(rank.totalExp*FRACUNIT, extraexpfactor) / FRACUNIT; // im just going to calculate it from target lol + INT16 totalExpMin = rank.numPlayers*MINEXP; + skincolornum_t overlaycolor = SKINCOLOR_MUSTARD; + fixed_t stablerateinverse = FRACUNIT - EXP_STABLERATE; + INT16 exp_range = totalExpMax-totalExpMin; + INT16 exp_offset = rank.exp-totalExpMin; + fixed_t factor = (exp_offset*FRACUNIT) / exp_range; // 0.0 to 1.0 in fixed + // amount of blue is how much factor is above EXP_STABLERATE, and amount of red is how much factor is below + // assume that EXP_STABLERATE is within 0.0 to 1.0 in fixed + if (factor <= stablerateinverse) + { + overlaycolor = SKINCOLOR_RUBY; + factor = FixedDiv(factor, stablerateinverse); + } + else + { + overlaycolor = SKINCOLOR_ULTRAMARINE; + fixed_t bluemaxoffset = EXP_STABLERATE; + factor = factor - stablerateinverse; + factor = FRACUNIT - FixedDiv(factor, bluemaxoffset); + } + auto transflag = K_GetTransFlagFromFixed(factor); - drawer_totals_right .colorize(static_cast(overlaycolor)) .flags(transflag) diff --git a/src/k_tally.cpp b/src/k_tally.cpp index 8a855f909..379986c92 100644 --- a/src/k_tally.cpp +++ b/src/k_tally.cpp @@ -204,14 +204,14 @@ INT32 level_tally_t::CalculateGrade(void) } case TALLY_BONUS_SCORE: { - bonusWeights[i] = ((pointLimit != 0) ? 100 : 0); + bonusWeights[i] = ((pointLimit != 0) ? 200 : 0); break; } case TALLY_BONUS_EXP: case TALLY_BONUS_PRISON: case TALLY_BONUS_POWERSTONES: { - bonusWeights[i] = 150; + bonusWeights[i] = 300; break; } default: @@ -222,7 +222,7 @@ INT32 level_tally_t::CalculateGrade(void) } } - const INT32 positionWeight = (position > 0 && numPlayers > 2) ? 20 : 0; + const INT32 positionWeight = (position > 0 && numPlayers > 2) ? 50 : 0; const INT32 total = positionWeight + bonusWeights[0] + bonusWeights[1]; INT32 ours = 0; @@ -247,7 +247,7 @@ INT32 level_tally_t::CalculateGrade(void) case TALLY_BONUS_EXP: { const fixed_t frac = std::min(FRACUNIT, ((exp) * FRACUNIT) / std::max(1, static_cast(totalExp))); - ours += Easing_InQuint(frac, 0, bonusWeights[i]); + ours += Easing_Linear(frac, 0, bonusWeights[i]); break; } case TALLY_BONUS_PRISON: