mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 23:42:11 +00:00
Merge branch 'hud-toggling' into 'next'
Let Lua toggle Team Match/CTF team scores HUD element See merge request STJr/SRB2!544
This commit is contained in:
commit
e009d62dc3
3 changed files with 40 additions and 7 deletions
|
@ -21,6 +21,7 @@ enum hud {
|
|||
// Match / CTF / Tag / Ringslinger
|
||||
hud_weaponrings,
|
||||
hud_powerstones,
|
||||
hud_teamscores,
|
||||
// NiGHTS mode
|
||||
hud_nightslink,
|
||||
hud_nightsdrill,
|
||||
|
|
|
@ -48,6 +48,7 @@ static const char *const hud_disable_options[] = {
|
|||
|
||||
"weaponrings",
|
||||
"powerstones",
|
||||
"teamscores",
|
||||
|
||||
"nightslink",
|
||||
"nightsdrill",
|
||||
|
|
|
@ -2320,14 +2320,20 @@ static void ST_drawTeamHUD(void)
|
|||
p = bflagico;
|
||||
else
|
||||
p = bmatcico;
|
||||
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_teamscores))
|
||||
#endif
|
||||
V_DrawSmallScaledPatch(BASEVIDWIDTH/2 - SEP - SHORT(p->width)/4, 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p);
|
||||
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
p = rflagico;
|
||||
else
|
||||
p = rmatcico;
|
||||
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_teamscores))
|
||||
#endif
|
||||
V_DrawSmallScaledPatch(BASEVIDWIDTH/2 + SEP - SHORT(p->width)/4, 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p);
|
||||
|
||||
if (gametype != GT_CTF)
|
||||
|
@ -2339,28 +2345,53 @@ static void ST_drawTeamHUD(void)
|
|||
// Show which flags aren't at base.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (players[i].gotflag & GF_BLUEFLAG) // Blue flag isn't at base
|
||||
if (players[i].gotflag & GF_BLUEFLAG // Blue flag isn't at base
|
||||
#ifdef HAVE_BLUA
|
||||
&& LUA_HudEnabled(hud_teamscores)
|
||||
#endif
|
||||
)
|
||||
V_DrawScaledPatch(BASEVIDWIDTH/2 - SEP - SHORT(nonicon->width)/2, 0, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, nonicon);
|
||||
if (players[i].gotflag & GF_REDFLAG) // Red flag isn't at base
|
||||
|
||||
if (players[i].gotflag & GF_REDFLAG // Red flag isn't at base
|
||||
#ifdef HAVE_BLUA
|
||||
&& LUA_HudEnabled(hud_teamscores)
|
||||
#endif
|
||||
)
|
||||
V_DrawScaledPatch(BASEVIDWIDTH/2 + SEP - SHORT(nonicon2->width)/2, 0, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, nonicon2);
|
||||
|
||||
whichflag |= players[i].gotflag;
|
||||
|
||||
if ((whichflag & (GF_REDFLAG|GF_BLUEFLAG)) == (GF_REDFLAG|GF_BLUEFLAG))
|
||||
break; // both flags were found, let's stop early
|
||||
}
|
||||
|
||||
// Display a countdown timer showing how much time left until the flag returns to base.
|
||||
{
|
||||
if (blueflag && blueflag->fuse > 1)
|
||||
if (blueflag && blueflag->fuse > 1
|
||||
#ifdef HAVE_BLUA
|
||||
&& LUA_HudEnabled(hud_teamscores)
|
||||
#endif
|
||||
)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2 - SEP, 8, V_YELLOWMAP|V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", (blueflag->fuse / TICRATE)));
|
||||
|
||||
if (redflag && redflag->fuse > 1)
|
||||
if (redflag && redflag->fuse > 1
|
||||
#ifdef HAVE_BLUA
|
||||
&& LUA_HudEnabled(hud_teamscores)
|
||||
#endif
|
||||
)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2 + SEP, 8, V_YELLOWMAP|V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", (redflag->fuse / TICRATE)));
|
||||
}
|
||||
}
|
||||
|
||||
num:
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_teamscores))
|
||||
#endif
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2 - SEP, 16, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", bluescore));
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_teamscores))
|
||||
#endif
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2 + SEP, 16, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", redscore));
|
||||
|
||||
#undef SEP
|
||||
|
|
Loading…
Reference in a new issue