Allow Rings/Blue Sphere HUD to be toggleable through Lua

This commit is contained in:
JugadorXEI 2025-08-05 13:30:35 +02:00
parent 294e60bf8d
commit 8a2d452d78
3 changed files with 33 additions and 6 deletions

View file

@ -3212,6 +3212,22 @@ static void K_drawKartAccessibilityIcons(boolean gametypeinfoshown, INT32 fx)
mirror = true;
}
}
// Adjust for Lua disabling things underneath or to the left of the speedometer.
if (!LUA_HudEnabled(hud_rings))
{
if (r_splitscreen < 2)
{
fy += 14;
}
// For 4P race, only check if it's a race.
// For 4P battle/capsules, check if it's either prisons or battle, AND check if that element isn't disabled.
else if ((gametyperules & GTR_CIRCUIT) == GTR_CIRCUIT ||
((battleprisons || (gametyperules & GTR_BUMPERS) == GTR_BUMPERS) && !LUA_HudEnabled(hud_gametypeinfo)))
{
fx -= 44;
}
}
// Kickstart Accel
if (stplyr->pflags & PF_KICKSTARTACCEL)
@ -3338,6 +3354,12 @@ static void K_drawKartSpeedometer(boolean gametypeinfoshown)
{
fy += 9;
}
// Adjust for Lua disabling things underneath the speedometer.
if (!LUA_HudEnabled(hud_rings))
{
fy += 14;
}
using srb2::Draw;
Draw(LAPS_X+7, fy+1).flags(V_HUDTRANS|V_SLIDEIN|splitflags).align(Draw::Align::kCenter).width(42).small_sticker();
@ -6400,13 +6422,16 @@ void K_drawKartHUD(void)
K_drawKartAccessibilityIcons(gametypeinfoshown, 0);
}
if (gametyperules & GTR_SPHERES)
if (LUA_HudEnabled(hud_rings))
{
K_drawBlueSphereMeter(gametypeinfoshown);
}
else
{
K_drawRingCounter(gametypeinfoshown);
if (gametyperules & GTR_SPHERES)
{
K_drawBlueSphereMeter(gametypeinfoshown);
}
else
{
K_drawRingCounter(gametypeinfoshown);
}
}
// Draw the item window

View file

@ -39,6 +39,7 @@ enum hud {
hud_speedometer,
hud_freeplay,
hud_rankings, // Tab rankings
hud_rings, // Rings and Spheres HUD element
// Intermission
hud_intermissiontally,

View file

@ -59,6 +59,7 @@ static const char *const hud_disable_options[] = {
"speedometer",
"freeplay",
"rankings",
"rings",
"intermissiontally",
"intermissionmessages",