HUD: display "Finish" and "Best Lap" times underneath timer when watching Time Attack replays

- Replace replay tab screen
This commit is contained in:
James R 2024-03-07 12:09:43 -08:00
parent 2d39617014
commit d07291690d
2 changed files with 34 additions and 48 deletions

View file

@ -1958,43 +1958,6 @@ static void HU_DrawTitlecardCEcho(size_t num)
UINT32 hu_demotime;
UINT32 hu_demolap;
static void HU_DrawDemoInfo(void)
{
if (!multiplayer)/* netreplay */
{
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, 0, M_GetText("Replay:"));
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, 0, player_names[0]);
}
else
{
V_DrawRightAlignedThinString(BASEVIDWIDTH-2, BASEVIDHEIGHT-10, 0, demo.titlename);
}
if (modeattacking & ATTACKING_TIME)
{
V_DrawRightAlignedString((BASEVIDWIDTH/2)-4, BASEVIDHEIGHT-24, V_YELLOWMAP|V_MONOSPACE, "BEST TIME:");
if (hu_demotime != UINT32_MAX)
V_DrawString((BASEVIDWIDTH/2)+4, BASEVIDHEIGHT-24, V_MONOSPACE, va("%i'%02i\"%02i",
G_TicsToMinutes(hu_demotime,true),
G_TicsToSeconds(hu_demotime),
G_TicsToCentiseconds(hu_demotime)));
else
V_DrawString((BASEVIDWIDTH/2)+4, BASEVIDHEIGHT-24, V_MONOSPACE, "--'--\"--");
}
if (modeattacking & ATTACKING_LAP)
{
V_DrawRightAlignedString((BASEVIDWIDTH/2)-4, BASEVIDHEIGHT-16, V_YELLOWMAP|V_MONOSPACE, "BEST LAP:");
if (hu_demolap != UINT32_MAX)
V_DrawString((BASEVIDWIDTH/2)+4, BASEVIDHEIGHT-16, V_MONOSPACE, va("%i'%02i\"%02i",
G_TicsToMinutes(hu_demolap,true),
G_TicsToSeconds(hu_demolap),
G_TicsToCentiseconds(hu_demolap)));
else
V_DrawString((BASEVIDWIDTH/2)+4, BASEVIDHEIGHT-16, V_MONOSPACE, "--'--\"--");
}
}
//
// Song credits
@ -2068,11 +2031,6 @@ void HU_Drawer(void)
}
LUA_HUD_DrawList(luahuddrawlist_scores);
}
if (demo.playback)
{
HU_DrawDemoInfo();
}
}
if (cv_vhseffect.value && (paused || (demo.playback && cv_playbackspeed.value > 1)))

View file

@ -6005,13 +6005,41 @@ void K_drawKartHUD(void)
bool ta = modeattacking && !demo.playback;
INT32 flags = V_HUDTRANS|V_SLIDEIN|V_SNAPTOTOP|V_SNAPTORIGHT;
K_drawKartTimestamp(stplyr->realtime, TIME_X, TIME_Y + (ta ? 2 : 0), flags, 0);
if (ta)
if (modeattacking)
{
using srb2::Draw;
Draw(BASEVIDWIDTH - 19, 2)
.flags(flags | V_YELLOWMAP)
.align(Draw::Align::kRight)
.text("\xBE Restart");
if (ta)
{
using srb2::Draw;
Draw(BASEVIDWIDTH - 19, 2)
.flags(flags | V_YELLOWMAP)
.align(Draw::Align::kRight)
.text("\xBE Restart");
}
else
{
using srb2::Draw;
Draw row = Draw(BASEVIDWIDTH - 20, TIME_Y + 18).flags(flags).align(Draw::Align::kRight);
auto insert = [&](const char *label, UINT32 tics)
{
Draw::TextElement text =
tics != UINT32_MAX ?
Draw::TextElement(
"{}'{}\"{}",
G_TicsToMinutes(tics, true),
G_TicsToSeconds(tics),
G_TicsToCentiseconds(tics)
) :
Draw::TextElement("--'--\"--");
text.font(Draw::Font::kZVote);
row.x(-text.width()).flags(V_ORANGEMAP).text(label);
row.y(1).text(text);
row = row.y(10);
};
if (modeattacking & ATTACKING_TIME)
insert("Finish: ", hu_demotime);
if (modeattacking & ATTACKING_LAP)
insert("Best Lap: ", hu_demolap);
}
}
}