mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-20 06:53:00 +00:00
K_drawKartTimestamp: Do not update visible emblems on level completion unless you got more than one on completion
TODO: this code relies heavily on static variables. It has always done so, but the extent to which they're currently employed is worth a fresh look
This commit is contained in:
parent
2207115424
commit
ac2255572a
1 changed files with 31 additions and 6 deletions
37
src/k_hud.c
37
src/k_hud.c
|
|
@ -1471,6 +1471,9 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
|||
// TIME_X = BASEVIDWIDTH-124; // 196
|
||||
// TIME_Y = 6; // 6
|
||||
|
||||
static UINT8 prevmode = UINT8_MAX;
|
||||
static emblem_t *maxemblem = NULL;
|
||||
|
||||
tic_t worktime;
|
||||
INT32 jitter = 0;
|
||||
|
||||
|
|
@ -1510,6 +1513,10 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
|||
}
|
||||
}
|
||||
|
||||
if (mode != prevmode)
|
||||
maxemblem = NULL;
|
||||
prevmode = mode;
|
||||
|
||||
V_DrawScaledPatch(TX, TY, splitflags, ((mode == 2) ? kp_lapstickerwide : kp_timestickerwide));
|
||||
|
||||
TX += 33;
|
||||
|
|
@ -1558,10 +1565,13 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
|||
UINT8 *emblemcol[3] = {NULL, NULL, NULL};
|
||||
|
||||
emblem_t *emblem = M_GetLevelEmblems(emblemmap);
|
||||
|
||||
while (emblem)
|
||||
{
|
||||
char targettext[9];
|
||||
|
||||
emblem_t *nextemblem = M_GetLevelEmblems(-1);
|
||||
|
||||
switch (emblem->type)
|
||||
{
|
||||
case ET_TIME:
|
||||
|
|
@ -1573,11 +1583,20 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
|||
{
|
||||
emblempic[curemb] = W_CachePatchName(M_GetEmblemPatch(emblem, false), PU_CACHE);
|
||||
emblemcol[curemb] = R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_CACHE);
|
||||
if (++curemb == 3)
|
||||
break;
|
||||
goto bademblem;
|
||||
curemb++;
|
||||
|
||||
if (emblem == maxemblem
|
||||
&& nextemblem != NULL
|
||||
&& nextemblem->type == emblem->type
|
||||
&& gamedata->collected[(nextemblem-emblemlocations)])
|
||||
maxemblem = NULL;
|
||||
|
||||
if (emblem != maxemblem)
|
||||
goto bademblem;
|
||||
}
|
||||
|
||||
maxemblem = emblem;
|
||||
|
||||
if (emblem->tag > 0)
|
||||
{
|
||||
if (emblem->tag > mapheaderinfo[emblemmap-1]->ghostCount
|
||||
|
|
@ -1616,13 +1635,19 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UI
|
|||
|
||||
workx -= V_ThinStringWidth(targettext, splitflags|V_6WIDTHSPACE);
|
||||
V_DrawThinString(workx, worky, splitflags|V_6WIDTHSPACE, targettext);
|
||||
workx -= 11;
|
||||
V_DrawSmallScaledPatch(workx, worky, splitflags, W_CachePatchName("NEEDIT", PU_CACHE));
|
||||
|
||||
if (emblem != maxemblem || !gamedata->collected[(emblem-emblemlocations)])
|
||||
{
|
||||
emblempic[curemb] = W_CachePatchName("NEEDIT", PU_CACHE);
|
||||
curemb++;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
bademblem:
|
||||
emblem = M_GetLevelEmblems(-1);
|
||||
if (emblem == maxemblem || curemb == 3)
|
||||
break;
|
||||
emblem = nextemblem;
|
||||
}
|
||||
|
||||
if (!mode)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue