diff --git a/src/k_kart.c b/src/k_kart.c index 40d519025..82228dd9e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7567,10 +7567,9 @@ INT32 K_calcSplitFlags(INT32 snapflags) return (splitflags|snapflags); } -drawinfo_t K_getItemBoxDrawinfo(void) +void K_getItemBoxDrawinfo(drawinfo_t *out) { INT32 fx, fy, fflags; - drawinfo_t info; // pain and suffering defined below if (splitscreen < 2) // don't change shit for THIS splitscreen. @@ -7595,16 +7594,14 @@ drawinfo_t K_getItemBoxDrawinfo(void) } } - info.x = fx; - info.y = fy; - info.flags = fflags; - return info; + out->x = fx; + out->y = fy; + out->flags = fflags; } -drawinfo_t K_getLapsDrawinfo(void) +void K_getLapsDrawinfo(drawinfo_t *out) { INT32 fx, fy, fflags; - drawinfo_t info; // pain and suffering defined below if (splitscreen < 2) // don't change shit for THIS splitscreen. @@ -7629,21 +7626,18 @@ drawinfo_t K_getLapsDrawinfo(void) } } - info.x = fx; - info.y = fy; - info.flags = fflags; - return info; + out->x = fx; + out->y = fy; + out->flags = fflags; } -drawinfo_t K_getMinimapDrawinfo(void) +void K_getMinimapDrawinfo(drawinfo_t *out) { INT32 fx = MINI_X, fy = MINI_Y, fflags = (splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split) - drawinfo_t info; - info.x = fx; - info.y = fy; - info.flags = fflags; - return info; + out->x = fx; + out->y = fy; + out->flags = fflags; } patch_t *K_getItemBoxPatch(boolean small, boolean dark) @@ -8018,7 +8012,8 @@ static void K_drawKartItem(void) } localbg = K_getItemBoxPatch((boolean)offset, dark); - drawinfo_t info = K_getItemBoxDrawinfo(); + drawinfo_t info; + K_getItemBoxDrawinfo(&info); fx = info.x; fy = info.y; fflags = info.flags; @@ -8642,7 +8637,8 @@ static void K_drawKartLaps(void) boolean flipstring = splitscreen > 1 && stplyrnum & 1; // used for 3p or 4p INT32 stringw = 0; // used with the above - drawinfo_t info = K_getLapsDrawinfo(); + drawinfo_t info; + K_getLapsDrawinfo(&info); fx = info.x; fy = info.y; fflags = info.flags; @@ -8845,7 +8841,8 @@ static void K_drawKartBumpersOrKarma(void) boolean flipstring = splitscreen > 1 && stplyrnum & 1; // same as laps, used for splitscreen INT32 stringw = 0; // used with the above - drawinfo_t info = K_getLapsDrawinfo(); + drawinfo_t info; + K_getLapsDrawinfo(&info); fx = info.x; fy = info.y; fflags = info.flags; @@ -9171,7 +9168,8 @@ static void K_drawKartMinimap(void) else return; // no pic, just get outta here - drawinfo_t info = K_getMinimapDrawinfo(); + drawinfo_t info; + K_getMinimapDrawinfo(&info); x = info.x - (AutomapPic->width/2); y = info.y - (AutomapPic->height/2); splitflags = info.flags; diff --git a/src/k_kart.h b/src/k_kart.h index 861d00991..cb9b9eced 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -106,9 +106,9 @@ typedef struct patch_t *K_getItemBoxPatch(boolean small, boolean dark); patch_t *K_getItemMulPatch(boolean small); -drawinfo_t K_getItemBoxDrawinfo(void); -drawinfo_t K_getLapsDrawinfo(void); -drawinfo_t K_getMinimapDrawinfo(void); +void K_getItemBoxDrawinfo(drawinfo_t *out); +void K_getLapsDrawinfo(drawinfo_t *out); +void K_getMinimapDrawinfo(drawinfo_t *out); // ========================================================================= #endif // __K_KART__ diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index e0b742094..d58360186 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -1164,9 +1164,9 @@ static int libd_getDrawInfo(lua_State *L) drawinfo_t info; switch(option) { - case huddrawinfo_item: info = K_getItemBoxDrawinfo(); break; - case huddrawinfo_gametypeinfo: info = K_getLapsDrawinfo(); break; - case huddrawinfo_minimap: info = K_getMinimapDrawinfo(); break; + case huddrawinfo_item: K_getItemBoxDrawinfo(&info); break; + case huddrawinfo_gametypeinfo: K_getLapsDrawinfo(&info); break; + case huddrawinfo_minimap: K_getMinimapDrawinfo(&info); break; default: return 0; // unreachable }