From d880abe8ea3563f85528f38049ace107ee6e7f0a Mon Sep 17 00:00:00 2001 From: yamamama Date: Wed, 4 Feb 2026 10:33:43 -0500 Subject: [PATCH] Clean up and make safe some hudcode * Un-shadowed the two hudtrans variables * Zero-initialized the trackingResult_t in K_getRoulettePositionForTrackingPlayer * Zero-initialized the drawinfo_t and rouletteinfo_t in libd_getDrawInfo * Removed really gross trailing whitespaces from ported RadioRacers code --- src/k_hud.c | 12 ++++++------ src/lua_hudlib.c | 15 ++------------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/k_hud.c b/src/k_hud.c index 6e6247a2a..5813977bf 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -1055,7 +1055,7 @@ static void K_initKartHUD(void) // RadioRacers static trackingResult_t K_getRoulettePositionForTrackingPlayer(void) { - trackingResult_t result; + trackingResult_t result = {0}; // No player object? Not bothering. const boolean doesPlayerHaveMo = !((stplyr->mo == NULL || P_MobjWasRemoved(stplyr->mo))); @@ -1069,13 +1069,13 @@ static trackingResult_t K_getRoulettePositionForTrackingPlayer(void) }; vector3_t v2 = { - 0, - 0, + 0, + 0, 64 * stplyr->mo->scale * P_MobjFlip(stplyr->mo) }; FV3_Add(&v,&v2); - + K_ObjectTracking(&result, &v, false); return result; @@ -1590,7 +1590,7 @@ static void K_drawKartItem(void) { fixed_t rfy = fy<itemroulette<> FRACBITS)+(10-hudtrans); + alpha = (FixedMul((abs(shiftprog) * 10), FixedDiv(cvarhudtrans << FRACBITS, 10 << FRACBITS)) >> FRACBITS)+(10-cvarhudtrans); rfy = (fy< alpha) alpha = 0; if (alpha >= 10) alpha = 10; diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index d4bd71435..c00611b9d 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -1504,19 +1504,8 @@ static int libd_getDrawInfo(lua_State *L) { HUDONLY enum huddrawinfo option = luaL_checkoption(L, 1, NULL, hud_drawinfo_options); - drawinfo_t info; - rouletteinfo_t rinfo; - - // Initialize the extra values that might not get used. - info.hudScale = 0; - info.hudScaleFloat = 0.0f; - - rinfo.crop.x = 0; - rinfo.crop.y = 0; - rinfo.flags = 0; - rinfo.offset = 0; - rinfo.spacing = 0; - rinfo.intSpacing = 0; + drawinfo_t info = {0}; + rouletteinfo_t rinfo = {0}; switch(option) { case huddrawinfo_item: K_getItemBoxDrawinfo(&info, &rinfo);break;