Add spectator HUD for A, X, R buttons

Old spectator HUD is preserved for empty game, "flying
around" mode.
This commit is contained in:
James R 2023-02-26 02:27:25 -08:00
parent 898cac9515
commit 5f1e64d6d9
2 changed files with 35 additions and 1 deletions

View file

@ -4639,6 +4639,33 @@ K_drawMiniPing (void)
}
}
static void K_DrawDirectorButton(INT32 idx, const char *label, patch_t *kp[2])
{
const INT32 flags = V_SNAPTORIGHT | V_SLIDEIN;
const INT32 textflags = flags | V_6WIDTHSPACE | V_ALLOWLOWERCASE;
const UINT8 anim_duration = 16;
const UINT8 anim = (leveltime % (anim_duration * 2)) < anim_duration;
const INT32 x = BASEVIDWIDTH - 60;
const INT32 y = BASEVIDHEIGHT - 70 + (idx * 16);
V_DrawScaledPatch(x, y - 4, flags, kp[anim]);
V_DrawRightAlignedThinString(x - 2, y, textflags, label);
}
static void K_drawDirectorHUD(void)
{
if (!LUA_HudEnabled(hud_textspectator))
{
return;
}
K_DrawDirectorButton(0, "Next Player", kp_button_a[0]);
K_DrawDirectorButton(1, "Prev Player", kp_button_x[0]);
K_DrawDirectorButton(2, "Director", kp_button_r);
}
static void K_drawDistributionDebugger(void)
{
itemroulette_t rouletteData = {0};
@ -4957,6 +4984,11 @@ void K_drawKartHUD(void)
K_drawMiniPing();
}
if (displayplayers[viewnum] != g_localplayers[viewnum])
{
K_drawDirectorHUD();
}
if (cv_kartdebugdistribution.value)
K_drawDistributionDebugger();

View file

@ -1095,6 +1095,8 @@ void ST_preLevelTitleCardDrawer(void)
//
static void ST_overlayDrawer(void)
{
const UINT8 viewnum = R_GetViewNumber();
// hu_showscores = auto hide score/time/rings when tab rankings are shown
if (!(hu_showscores && (netgame || multiplayer)))
{
@ -1135,7 +1137,7 @@ static void ST_overlayDrawer(void)
if (!hu_showscores && netgame && !mapreset)
{
if (stplyr->spectator && LUA_HudEnabled(hud_textspectator))
if (stplyr->spectator && displayplayers[viewnum] == g_localplayers[viewnum] && LUA_HudEnabled(hud_textspectator))
{
const char *itemtxt = M_GetText("Item - Join Game");