Let Lua toggle Match/CTF team scores HUD element
This commit is contained in:
parent
53c7df4818
commit
0ab31b3de0
|
@ -21,6 +21,7 @@ enum hud {
|
||||||
// Match / CTF / Tag / Ringslinger
|
// Match / CTF / Tag / Ringslinger
|
||||||
hud_weaponrings,
|
hud_weaponrings,
|
||||||
hud_powerstones,
|
hud_powerstones,
|
||||||
|
hud_teamscores,
|
||||||
// NiGHTS mode
|
// NiGHTS mode
|
||||||
hud_nightslink,
|
hud_nightslink,
|
||||||
hud_nightsdrill,
|
hud_nightsdrill,
|
||||||
|
|
|
@ -48,6 +48,7 @@ static const char *const hud_disable_options[] = {
|
||||||
|
|
||||||
"weaponrings",
|
"weaponrings",
|
||||||
"powerstones",
|
"powerstones",
|
||||||
|
"teamscores",
|
||||||
|
|
||||||
"nightslink",
|
"nightslink",
|
||||||
"nightsdrill",
|
"nightsdrill",
|
||||||
|
|
|
@ -2321,6 +2321,9 @@ static void ST_drawTeamHUD(void)
|
||||||
else
|
else
|
||||||
p = bmatcico;
|
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);
|
V_DrawSmallScaledPatch(BASEVIDWIDTH/2 - SEP - SHORT(p->width)/4, 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p);
|
||||||
|
|
||||||
if (gametype == GT_CTF)
|
if (gametype == GT_CTF)
|
||||||
|
@ -2328,6 +2331,9 @@ static void ST_drawTeamHUD(void)
|
||||||
else
|
else
|
||||||
p = rmatcico;
|
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);
|
V_DrawSmallScaledPatch(BASEVIDWIDTH/2 + SEP - SHORT(p->width)/4, 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p);
|
||||||
|
|
||||||
if (gametype != GT_CTF)
|
if (gametype != GT_CTF)
|
||||||
|
@ -2339,28 +2345,53 @@ static void ST_drawTeamHUD(void)
|
||||||
// Show which flags aren't at base.
|
// Show which flags aren't at base.
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
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);
|
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);
|
V_DrawScaledPatch(BASEVIDWIDTH/2 + SEP - SHORT(nonicon2->width)/2, 0, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, nonicon2);
|
||||||
|
|
||||||
whichflag |= players[i].gotflag;
|
whichflag |= players[i].gotflag;
|
||||||
|
|
||||||
if ((whichflag & (GF_REDFLAG|GF_BLUEFLAG)) == (GF_REDFLAG|GF_BLUEFLAG))
|
if ((whichflag & (GF_REDFLAG|GF_BLUEFLAG)) == (GF_REDFLAG|GF_BLUEFLAG))
|
||||||
break; // both flags were found, let's stop early
|
break; // both flags were found, let's stop early
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display a countdown timer showing how much time left until the flag returns to base.
|
// 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)));
|
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)));
|
V_DrawCenteredString(BASEVIDWIDTH/2 + SEP, 8, V_YELLOWMAP|V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", (redflag->fuse / TICRATE)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
num:
|
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));
|
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));
|
V_DrawCenteredString(BASEVIDWIDTH/2 + SEP, 16, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", redscore));
|
||||||
|
|
||||||
#undef SEP
|
#undef SEP
|
||||||
|
|
Loading…
Reference in New Issue