From 9a1296702031a15b5a69ef0c5d8b99729622d8e0 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sun, 17 Feb 2019 23:39:00 +0100 Subject: [PATCH] Expose battlefullscreen and battlecomebacktimer huds to lua --- src/k_kart.c | 18 +++++++++++++++--- src/lua_hud.h | 2 ++ src/lua_hudlib.c | 2 ++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index b006ae3bb..39da4a229 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7838,6 +7838,11 @@ static void K_drawBattleFullscreen(void) INT32 y = -64+(stplyr->kartstuff[k_cardanimation]); // card animation goes from 0 to 164, 164 is the middle of the screen INT32 splitflags = V_SNAPTOTOP; // I don't feel like properly supporting non-green resolutions, so you can have a misuse of SNAPTO instead fixed_t scale = FRACUNIT; + boolean drawcomebacktimer = true; // lazy hack because it's cleaner in the long run. +#ifdef HAVE_BLUA + if (!LUA_HudEnabled(hud_battlecomebacktimer)) + drawcomebacktimer = false; +#endif if (splitscreen) { @@ -7889,7 +7894,7 @@ static void K_drawBattleFullscreen(void) else K_drawKartFinish(); } - else if (stplyr->kartstuff[k_bumper] <= 0 && stplyr->kartstuff[k_comebacktimer] && comeback && !stplyr->spectator) + else if (stplyr->kartstuff[k_bumper] <= 0 && stplyr->kartstuff[k_comebacktimer] && comeback && !stplyr->spectator && drawcomebacktimer) { UINT16 t = stplyr->kartstuff[k_comebacktimer]/(10*TICRATE); INT32 txoff, adjust = (splitscreen > 1) ? 4 : 6; // normal string is 8, kart string is 12, half of that for ease @@ -8449,8 +8454,15 @@ void K_drawKartHUD(void) if (battlefullscreen) { - K_drawBattleFullscreen(); - return; +#ifdef HAVE_BLUA + if (LUA_HudEnabled(hud_battlefullscreen)) + { +#endif + K_drawBattleFullscreen(); + return; +#ifdef HAVE_BLUA + } // yes we legit checked if we had lua to close a single bracket. Not my proudest code edit tbh. +#endif } // Draw the item window diff --git a/src/lua_hud.h b/src/lua_hud.h index 4fbbbace4..88d7fd6bc 100644 --- a/src/lua_hud.h +++ b/src/lua_hud.h @@ -21,6 +21,8 @@ enum hud { hud_position, hud_minirankings, // Rankings to the left hud_battlebumpers, // mini rankings battle bumpers. + hud_battlefullscreen, // battle huge text (WAIT, WIN, LOSE ...) + karma comeback time + hud_battlecomebacktimer, // comeback timer in battlefullscreen. separated for ease of use. hud_wanted, hud_speedometer, hud_freeplay, diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index cd8e03923..e0a360ade 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -48,6 +48,8 @@ static const char *const hud_disable_options[] = { "position", "minirankings", // Gametype rankings to the left "battlerankingsbumpers", // bumper drawer for battle. Useful if you want to make a custom battle gamemode without bumpers being involved. + "battlefullscreen", // battlefullscreen func (WAIT, ATTACK OR PROTECT ...) + "battlecomebacktimer", // come back timer in battlefullscreen "wanted", "speedometer", "freeplay",