K_drawKartTimestamp: Fix time attack HUD flashing when lap animation is in play

This commit is contained in:
toaster 2024-04-11 21:35:43 +01:00
parent f1f7edbe9a
commit c758ba3062

View file

@ -1889,7 +1889,7 @@ tic_t K_TranslateTimer(tic_t drawtime, UINT8 mode, INT32 *return_jitter)
{ {
INT32 jitter = 0; INT32 jitter = 0;
if (!mode) if (!mode && drawtime != UINT32_MAX)
{ {
if (timelimitintics > 0) if (timelimitintics > 0)
{ {
@ -1948,7 +1948,6 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT32 splitflags, U
// TIME_X = BASEVIDWIDTH-124; // 196 // TIME_X = BASEVIDWIDTH-124; // 196
// TIME_Y = 6; // 6 // TIME_Y = 6; // 6
tic_t worktime;
INT32 jitter = 0; INT32 jitter = 0;
drawtime = K_TranslateTimer(drawtime, mode, &jitter); drawtime = K_TranslateTimer(drawtime, mode, &jitter);
@ -1957,7 +1956,15 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT32 splitflags, U
TX += 33; TX += 33;
worktime = drawtime/(60*TICRATE); if (drawtime == UINT32_MAX)
;
else if (mode && !drawtime)
{
V_DrawTimerString(TX, TY+3, splitflags, "--'--\"--");
}
else
{
tic_t worktime = drawtime/(60*TICRATE);
if (worktime >= 100) if (worktime >= 100)
{ {
@ -1966,10 +1973,6 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT32 splitflags, U
drawtime = (100*(60*TICRATE))-1; drawtime = (100*(60*TICRATE))-1;
} }
if (mode && !drawtime)
V_DrawTimerString(TX, TY+3, splitflags, "--'--\"--");
else
{
// minutes time 00 __ __ // minutes time 00 __ __
V_DrawTimerString(TX, TY+3+jitter, splitflags, va("%d", worktime/10)); V_DrawTimerString(TX, TY+3+jitter, splitflags, va("%d", worktime/10));
V_DrawTimerString(TX+12, TY+3-jitter, splitflags, va("%d", worktime%10)); V_DrawTimerString(TX+12, TY+3-jitter, splitflags, va("%d", worktime%10));
@ -6090,6 +6093,8 @@ void K_drawKartHUD(void)
bool ta = modeattacking && !demo.playback; bool ta = modeattacking && !demo.playback;
INT32 flags = V_HUDTRANS|V_SLIDEIN|V_SNAPTOTOP|V_SNAPTORIGHT; INT32 flags = V_HUDTRANS|V_SLIDEIN|V_SNAPTOTOP|V_SNAPTORIGHT;
tic_t realtime = stplyr->realtime;
if (stplyr->karthud[khud_lapanimation] if (stplyr->karthud[khud_lapanimation]
&& !stplyr->exiting && !stplyr->exiting
&& stplyr->laptime[LAP_LAST] != 0 && stplyr->laptime[LAP_LAST] != 0
@ -6097,17 +6102,15 @@ void K_drawKartHUD(void)
{ {
if ((stplyr->karthud[khud_lapanimation] / 5) & 1) if ((stplyr->karthud[khud_lapanimation] / 5) & 1)
{ {
K_drawKartTimestamp(stplyr->laptime[LAP_LAST], TIME_X, TIME_Y + (ta ? 2 : 0), flags, 0); realtime = stplyr->laptime[LAP_LAST];
} }
else else
{ {
V_DrawScaledPatch(TIME_X, TIME_Y + (ta ? 2 : 0), flags, kp_timestickerwide); realtime = UINT32_MAX;
} }
} }
else
{ K_drawKartTimestamp(realtime, TIME_X, TIME_Y + (ta ? 2 : 0), flags, 0);
K_drawKartTimestamp(stplyr->realtime, TIME_X, TIME_Y + (ta ? 2 : 0), flags, 0);
}
if (modeattacking) if (modeattacking)
{ {