K_GetGradeColor

Colors for grades.
Done as a seperate function so that future other circumstances can utilise it.
But for now, just apply to M_DrawCupSelect windata.
This commit is contained in:
toaster 2023-05-30 22:15:08 +01:00
parent d9940fdef2
commit e74d01660f
3 changed files with 52 additions and 2 deletions

View file

@ -51,6 +51,7 @@
#include "d_player.h" // KITEM_ constants
#include "doomstat.h" // MAXSPLITSCREENPLAYERS
#include "k_grandprix.h" // K_CanChangeRules
#include "k_rank.h" // K_GetGradeColor
#include "y_inter.h" // Y_RoundQueueDrawer
@ -2388,8 +2389,15 @@ void M_DrawCupSelect(void)
const INT32 ranky = 8 + (j*100) - (30*menutransition.tics);
patch_t *gradePat = NULL;
colormap = NULL;
switch (windata->best_grade)
const gp_rank_e grade = windata->best_grade; // (cupgrid.previewanim/TICRATE) % (GRADE_S + 1); -- testing
UINT16 gradecolor = K_GetGradeColor(grade);
if (gradecolor != SKINCOLOR_NONE)
colormap = R_GetTranslationColormap(TC_DEFAULT, gradecolor, GTC_MENUCACHE);
switch (grade)
{
case GRADE_E:
gradePat = W_CachePatchName("R_CUPRNE", PU_CACHE);
@ -2414,7 +2422,7 @@ void M_DrawCupSelect(void)
}
if (gradePat)
V_DrawFixedPatch((rankx)*FRACUNIT, (ranky)*FRACUNIT, FRACUNIT, 0, gradePat, NULL);
V_DrawFixedPatch((rankx)*FRACUNIT, (ranky)*FRACUNIT, FRACUNIT, 0, gradePat, colormap);
rankx += 14 + 1;

View file

@ -417,3 +417,31 @@ gp_rank_e K_CalculateGPGrade(gpRank_t *rankData)
return retGrade;
}
/*--------------------------------------------------
UINT16 K_GetGradeColor(gp_rank_e grade)
See header file for description.
--------------------------------------------------*/
UINT16 K_GetGradeColor(gp_rank_e grade)
{
switch (grade)
{
case GRADE_E:
return SKINCOLOR_BLUE;
case GRADE_D:
return SKINCOLOR_TURTLE;
case GRADE_C:
return SKINCOLOR_ORANGE;
case GRADE_B:
return SKINCOLOR_RED;
case GRADE_A:
return SKINCOLOR_MAGENTA;
case GRADE_S:
return SKINCOLOR_PIGEON;
default:
break;
}
return SKINCOLOR_NONE;
}

View file

@ -82,6 +82,20 @@ void K_InitGrandPrixRank(gpRank_t *rankData);
gp_rank_e K_CalculateGPGrade(gpRank_t *rankData);
/*--------------------------------------------------
UINT16 K_GetGradeColor(gp_rank_e grade)
Maps grades to skincolors for HUD purposes.
Input Arguments:-
grade - gp_rank_e representing an achieved ranking.
Return:-
skincolor ID representing the achieved grade.
--------------------------------------------------*/
UINT16 K_GetGradeColor(gp_rank_e grade);
#ifdef __cplusplus
} // extern "C"
#endif