grading refinements attempt

This commit is contained in:
Ashnal 2025-06-12 00:09:44 -04:00
parent 7c1df623ae
commit 2a36838b54
4 changed files with 55 additions and 15 deletions

View file

@ -745,9 +745,11 @@ extern int
#define MAXAMPSCALINGDIST 18000 #define MAXAMPSCALINGDIST 18000
// Exp // 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 MINEXP 25 // The min value target
#define TARGETEXP 100 // The target value needed for A rank #define TARGETEXP 120 // Used for grading ...
#define MAXEXP 125 // The max value displayed by the hud and in the tally screen and GP results screen #define MAXEXP 120 // The max value displayed by the hud and in the tally screen and GP results screen
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"

View file

@ -15739,8 +15739,8 @@ boolean K_PlayerCanUseItem(player_t *player)
fixed_t K_GetGradingFactorAdjustment(player_t *player) fixed_t K_GetGradingFactorAdjustment(player_t *player)
{ {
fixed_t power = 3*FRACUNIT/100; // adjust to change overall xp volatility fixed_t power = EXP_POWER; // 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 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; fixed_t result = 0;
if (g_teamplay) if (g_teamplay)

View file

@ -723,10 +723,28 @@ void podiumData_s::Draw(void)
.xy(0, 1) .xy(0, 1)
.colorize(static_cast<skincolornum_t>(SKINCOLOR_MUSTARD)) .colorize(static_cast<skincolornum_t>(SKINCOLOR_MUSTARD))
.patch("K_SPTEXP"); .patch("K_SPTEXP");
// Colorize the crystal, just like we do for hud // Colorize the crystal, just like we do for hud
fixed_t factor = FixedDiv(dta->exp*FRACUNIT, lvl->totalExp*FRACUNIT); skincolornum_t overlaycolor = SKINCOLOR_MUSTARD;
skincolornum_t overlaycolor = factor < FRACUNIT ? SKINCOLOR_RUBY : SKINCOLOR_ULTRAMARINE; fixed_t stablerateinverse = FRACUNIT - EXP_STABLERATE;
if (factor >= FRACUNIT) {factor += factor-FRACUNIT;} // exaggerate the positive side, since reverse engineering the factor like this results in half the translucency range 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); auto transflag = K_GetTransFlagFromFixed(factor);
drawer_gametype drawer_gametype
.xy(0, 1) .xy(0, 1)
@ -872,12 +890,32 @@ void podiumData_s::Draw(void)
drawer_totals_right drawer_totals_right
.colorize(static_cast<skincolornum_t>(SKINCOLOR_MUSTARD)) .colorize(static_cast<skincolornum_t>(SKINCOLOR_MUSTARD))
.patch("K_STEXP"); .patch("K_STEXP");
// Colorize the crystal for the totals, just like we do for in race hud // 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 fixed_t extraexpfactor = (MAXEXP*FRACUNIT) / TARGETEXP;
skincolornum_t overlaycolor = factor < FRACUNIT ? SKINCOLOR_RUBY : SKINCOLOR_ULTRAMARINE; INT16 totalExpMax = FixedMul(rank.totalExp*FRACUNIT, extraexpfactor) / FRACUNIT; // im just going to calculate it from target lol
if (factor >= FRACUNIT) {factor += factor-FRACUNIT;} // exaggerate the positive side, since reverse engineering the factor like this results in half the translucency range 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); auto transflag = K_GetTransFlagFromFixed(factor);
drawer_totals_right drawer_totals_right
.colorize(static_cast<skincolornum_t>(overlaycolor)) .colorize(static_cast<skincolornum_t>(overlaycolor))
.flags(transflag) .flags(transflag)

View file

@ -204,14 +204,14 @@ INT32 level_tally_t::CalculateGrade(void)
} }
case TALLY_BONUS_SCORE: case TALLY_BONUS_SCORE:
{ {
bonusWeights[i] = ((pointLimit != 0) ? 100 : 0); bonusWeights[i] = ((pointLimit != 0) ? 200 : 0);
break; break;
} }
case TALLY_BONUS_EXP: case TALLY_BONUS_EXP:
case TALLY_BONUS_PRISON: case TALLY_BONUS_PRISON:
case TALLY_BONUS_POWERSTONES: case TALLY_BONUS_POWERSTONES:
{ {
bonusWeights[i] = 150; bonusWeights[i] = 300;
break; break;
} }
default: 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]; const INT32 total = positionWeight + bonusWeights[0] + bonusWeights[1];
INT32 ours = 0; INT32 ours = 0;
@ -247,7 +247,7 @@ INT32 level_tally_t::CalculateGrade(void)
case TALLY_BONUS_EXP: case TALLY_BONUS_EXP:
{ {
const fixed_t frac = std::min(FRACUNIT, ((exp) * FRACUNIT) / std::max(1, static_cast<int>(totalExp))); const fixed_t frac = std::min(FRACUNIT, ((exp) * FRACUNIT) / std::max(1, static_cast<int>(totalExp)));
ours += Easing_InQuint(frac, 0, bonusWeights[i]); ours += Easing_Linear(frac, 0, bonusWeights[i]);
break; break;
} }
case TALLY_BONUS_PRISON: case TALLY_BONUS_PRISON: