From 51fbf12903b3dea4fe1a1c06df6fe0e91add6f64 Mon Sep 17 00:00:00 2001 From: GenericHeroGuy Date: Sat, 27 Dec 2025 22:58:27 +0100 Subject: [PATCH] Start by clearing out a bunch of warnings --- src/d_netcmd.c | 4 ++-- src/k_hud.c | 6 +++--- src/k_items.c | 8 +++++--- src/k_kart.c | 2 +- src/lua_baselib.c | 10 +++++----- src/lua_infolib.c | 5 ++++- src/lua_voicelib.c | 4 ++-- src/p_mobj.c | 2 +- src/v_video.c | 2 +- src/y_inter.c | 2 +- 10 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index c347435d9..a21fc6abb 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -5144,7 +5144,7 @@ static void Command_Addfilelocal(void) else if (nocompat) compat = WC_OFF; - if (COM_Argc() != 2 + (docompat || nocompat)) + if (COM_Argc() != 2u + (docompat || nocompat)) { CONS_Printf(M_GetText("addfilelocal [-c|-n] : Load local add-on\n" "-c forces compatmode, -n disables it.\n")); @@ -5189,7 +5189,7 @@ static void Command_Addfile(void) else if (nocompat) compat = WC_OFF; - if (argc < 2 + (docompat || nocompat)) + if (argc < 2u + (docompat || nocompat)) { CONS_Printf(M_GetText("addfile [-c|-n] [filename2...]: Load add-ons\n" "-c forces compatmode, -n disables it.\n")); diff --git a/src/k_hud.c b/src/k_hud.c index 5fc993782..2f0c1c3b0 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -5786,8 +5786,8 @@ static void K_DrawWaypointDebugger(void) V_DrawString(8, 150, 0, va("Current Waypoint ID: %d", K_GetWaypointID(stplyr->currentwaypoint))); V_DrawString(8, 160, 0, va("Next Waypoint ID: %d", K_GetWaypointID(stplyr->nextwaypoint))); - V_DrawString(8, 170, 0, va("Finishline Distance: %d (WP %d)", stplyr->distancetofinish, - stplyr->currentwaypoint ? stplyr->currentwaypoint->distancetofinish : -1)); + V_DrawString(8, 170, 0, va("Finishline Distance: %u (WP %u)", stplyr->distancetofinish, + stplyr->currentwaypoint ? stplyr->currentwaypoint->distancetofinish : 0)); } static void K_DrawClusterDebugger(void) @@ -6519,7 +6519,7 @@ void K_DrawFlamometer(void) // fire animation if (stplyr->flamestore >= FLAMESTOREMAX-1) { - UINT8 flamofiretic = CLAMP((leveltime / 3) % MAXFLAMOFIRETICS, 0, MAXFLAMOFIRETICS) + 1; + UINT8 flamofiretic = ((leveltime / 3) % MAXFLAMOFIRETICS) + 1; if (stplyr->flameoverheat < 3) { diff --git a/src/k_items.c b/src/k_items.c index 82226f94a..8ffa1e288 100644 --- a/src/k_items.c +++ b/src/k_items.c @@ -216,7 +216,9 @@ patch_t *K_GetCachedItemPatchEx(kartitemtype_e type, boolean tiny, UINT8 amount, if (graphics->numpatches == 0) return missingpat; - tic_t timer = G_GamestateUsesLevel() ? leveltime : finalecount; + tic_t timer = leveltime; + if (!G_GamestateUsesLevel()) + timer = finalecount; if (K_GetItemFlags(type) & KIF_ANIMATED) return graphics->patches[(timer % (graphics->numpatches*3)) / 3]; @@ -1000,12 +1002,12 @@ UINT8 K_FindUseodds(const player_t *player, fixed_t mashed, UINT32 pdis, UINT8 b if (pdis == 0) useodds = disttable[0]; else if (pdis > (UINT32)ACTIVEDISTVAR * ((12 * distlen) / sizeof(disttable))) - useodds = disttable[max(0, distlen-1)]; + useodds = disttable[distlen ? distlen - 1 : distlen]; else { for (i = 1; i < (sizeof(disttable) - 1); i++) { - INT32 distcalc = min(distlen-1, (i * distlen) / sizeof(disttable)); + INT32 distcalc = min(distlen-1u, (i * distlen) / sizeof(disttable)); if (pdis <= (UINT32)usedistvar * distcalc) { diff --git a/src/k_kart.c b/src/k_kart.c index f5c917ab2..57a9ab95e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7629,7 +7629,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) K_UpdateSPBTimer(); } -void K_KartResetPlayerFullbright(player_t *player) +static void K_KartResetPlayerFullbright(player_t *player) { boolean fullbright = false; diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 9194bb5bf..791efe442 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -4178,7 +4178,7 @@ static int lib_kGetSpeedPercentage(lua_State *L) // see K_GetItemGraphics static int lib_kGetItemPatch(lua_State *L) { - kartitemtype_e item = (kartitemtype_e)luaL_optinteger(L, 1, KITEM_NONE); + kartitemtype_e item = luaL_optinteger(L, 1, KITEM_NONE); boolean tiny = lua_optboolean(L, 2); UINT8 index = 0; //HUDSAFE @@ -4239,7 +4239,7 @@ static int lib_kGetItemGraphics(lua_State *L) static int lib_kIsKartItemAlternate(lua_State *L) { - kartitemtype_e item = (kartitemtype_e)luaL_optinteger(L, 1, KITEM_NONE); + kartitemtype_e item = luaL_optinteger(L, 1, KITEM_NONE); // HUDSAFE if (item <= 0 || item >= numkartitems) @@ -5309,7 +5309,7 @@ static int lib_kSetPlayerItemCooldown(lua_State *L) static int lib_kAddItemRollToList(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); - kartitemtype_e item_id = (kartitemtype_e)luaL_checkinteger(L, 2); + kartitemtype_e item_id = luaL_checkinteger(L, 2); INT32 amt = luaL_checkinteger(L, 3); //HUDSAFE @@ -5342,7 +5342,7 @@ static int lib_kGetItemListSize(lua_State *L) static int lib_kSetItemListEntry(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); - kartitemtype_e item_id = (kartitemtype_e)luaL_checkinteger(L, 2); + kartitemtype_e item_id = luaL_checkinteger(L, 2); INT32 num = luaL_checkinteger(L, 3); //HUDSAFE @@ -5361,7 +5361,7 @@ static int lib_kSetItemListEntry(lua_State *L) static int lib_kGetItemListEntry(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); - kartitemtype_e item_id = (kartitemtype_e)luaL_checkinteger(L, 2); + kartitemtype_e item_id = luaL_checkinteger(L, 2); //HUDSAFE if (!player) diff --git a/src/lua_infolib.c b/src/lua_infolib.c index 533977696..139ea0501 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -1479,7 +1479,10 @@ static int sfxinfo_get(lua_State *L) if (!lua_compatmode) goto nope; sfxenum_t sound = sfx - S_sfx; - lua_pushinteger(L, sound >= sfx_kwin && sound <= sfx_kgloat ? sound - sfx_kwin : -1); + if (sound >= sfx_kwin && sound <= sfx_kgloat) + lua_pushinteger(L, sound - sfx_kwin); + else + lua_pushinteger(L, -1); return 1; case sfxinfor_string: lua_pushstring(L, sfx->name); diff --git a/src/lua_voicelib.c b/src/lua_voicelib.c index aaaa23436..f0fcb0e26 100644 --- a/src/lua_voicelib.c +++ b/src/lua_voicelib.c @@ -141,7 +141,7 @@ static int voice_array_set(lua_State *L) if (i < 0 || i >= VOICEARRAYSIZE) return luaL_error(L, "index %d out of range (0 - %d)", i, VOICEARRAYSIZE-1); - voice_array[i] = (sfxenum_t)luaL_checkinteger(L, 3); + voice_array[i] = luaL_checkinteger(L, 3); return 0; } @@ -181,7 +181,7 @@ static int voice_array1_set(lua_State *L) if (i < 0 || i >= 1) return luaL_error(L, "index %d out of range (0 - %d)", i, 1-1); - voice_array[i] = (sfxenum_t)luaL_checkinteger(L, 3); + voice_array[i] = luaL_checkinteger(L, 3); return 0; } diff --git a/src/p_mobj.c b/src/p_mobj.c index 1301fbfec..fb943afb3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -15074,7 +15074,7 @@ kartvoice_t *P_GetMobjVoice(const mobj_t *mo) // Scream at the idiot that let this happen :^) CONS_Printf( "PARANOIA/P_GetMobjVoice: %p MT_%s passed to function with NULL voice\n", - (void*)mo, + (const void *)mo, P_MobjTypeName(mo) ); #endif diff --git a/src/v_video.c b/src/v_video.c index 4a22bd321..6b39f4021 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -3844,7 +3844,7 @@ void InitColorLUT(colorlookup_t *lut, RGBA_t *palette, boolean makecolors) if (!lut->init || memcmp(lut->palette, palette, palsize)) { - INT32 i; + size_t i; lut->init = true; memcpy(lut->palette, palette, palsize); diff --git a/src/y_inter.c b/src/y_inter.c index c193686b9..cc11ace5a 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -578,7 +578,7 @@ void Y_IntermissionDrawer(void) if (displayitemrolls) { - if (data.pos[i] < 0 || data.pos[i] > 16) + if (kp_facenum[data.pos[i]] == missingpat) V_DrawPingNum(x+2-xscroll_px, y+1, 0, data.pos[i], NULL); else V_DrawScaledPatch(x-5-xscroll_px, y+1, 0, kp_facenum[data.pos[i]]);