diff --git a/src/cvars.cpp b/src/cvars.cpp index e2a1948c4..9be834fad 100644 --- a/src/cvars.cpp +++ b/src/cvars.cpp @@ -811,7 +811,6 @@ consvar_t cv_timescale = OnlineCheat(cvlist_timer)("timescale", "1.0").floating_ // consvar_t cv_botscanvote = ServerCheat("botscanvote", "No").yes_no(); -consvar_t cv_debugrank = ServerCheat("debugrank", "Off").on_off().description("Show GP rank state on the HUD"); void Gravity_OnChange(void); consvar_t cv_gravity = ServerCheat("gravity", "0.8").floating_point().onchange(Gravity_OnChange).description("Change the default gravity"); // change DEFAULT_GRAVITY if you change this @@ -830,6 +829,19 @@ consvar_t cv_kartdebugnodes = ServerCheat("debugnodes", "Off").on_off().descript consvar_t cv_1pswap = PlayerCheat("1pswap", "1").min_max(1, MAXSPLITSCREENPLAYERS).description("Let P1's Profile control a different splitscreen player"); consvar_t cv_debugfinishline = PlayerCheat("debugfinishline", "Off").on_off().description("Highlight finish lines and respawn lines with high contrast colors"); + +consvar_t cv_debugrank = PlayerCheat("debugrank", "Off").description("Show GP rank state on the HUD; optionally force a rank grade").values({ + {0, "Off"}, + {1, "On"}, + // This matches the order of gp_rank_e + {2, "E"}, + {3, "D"}, + {4, "C"}, + {5, "B"}, + {6, "A"}, + {7, "S"}, +}); + consvar_t cv_debugrender_contrast = PlayerCheat("debugrender_contrast", "0.0").floating_point().min_max(-FRACUNIT, FRACUNIT).description("Change level lighting"); consvar_t cv_debugrender_portal = PlayerCheat("debugrender_portal", "Off").on_off().description("Highlight visual portals in red"); consvar_t cv_debugrender_spriteclip = PlayerCheat("debugrender_spriteclip", "Off").on_off().description("Let sprites draw through walls"); diff --git a/src/k_rank.c b/src/k_rank.c index dd05cc11f..ddb58d9e0 100644 --- a/src/k_rank.c +++ b/src/k_rank.c @@ -25,6 +25,7 @@ #include "fastcmp.h" #include "byteptr.h" #include "k_race.h" +#include "command.h" // I was ALMOST tempted to start tearing apart all // of the map loading code and turning it into C++ @@ -383,6 +384,15 @@ void K_UpdateGPRank(void) --------------------------------------------------*/ gp_rank_e K_CalculateGPGrade(gpRank_t *rankData) { + { + extern consvar_t cv_debugrank; + + if (cv_debugrank.value >= 2) + { + return GRADE_E + (cv_debugrank.value - 2); + } + } + static const fixed_t gradePercents[GRADE_A] = { 7*FRACUNIT/20, // D: 35% or higher 10*FRACUNIT/20, // C: 50% or higher