Start by clearing out a bunch of warnings

This commit is contained in:
GenericHeroGuy 2025-12-27 22:58:27 +01:00
parent 1b69314d81
commit 51fbf12903
10 changed files with 25 additions and 20 deletions

View file

@ -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] <filename.pk3/wad/lua/soc>: 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] <filename.pk3/wad/lua/soc> [filename2...]: Load add-ons\n"
"-c forces compatmode, -n disables it.\n"));

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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;

View file

@ -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)

View file

@ -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);

View file

@ -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;
}

View file

@ -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

View file

@ -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);

View file

@ -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]]);