mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'kitem-none-hud-crash' into 'master'
Fix HUD drawing crash if 1 or more KITEM_NONE See merge request KartKrew/Kart!702
This commit is contained in:
commit
f970e82109
1 changed files with 5 additions and 5 deletions
10
src/k_hud.c
10
src/k_hud.c
|
|
@ -695,7 +695,7 @@ const char *K_GetItemPatch(UINT8 item, boolean tiny)
|
|||
}
|
||||
}
|
||||
|
||||
static patch_t **K_GetItemPatchTable(INT32 item)
|
||||
static patch_t *K_GetCachedItemPatch(INT32 item, UINT8 offset)
|
||||
{
|
||||
patch_t **kp[1 + NUMKARTITEMS] = {
|
||||
kp_sadface,
|
||||
|
|
@ -723,8 +723,8 @@ static patch_t **K_GetItemPatchTable(INT32 item)
|
|||
kp_droptarget,
|
||||
};
|
||||
|
||||
if (item >= KITEM_SAD && item < NUMKARTITEMS)
|
||||
return kp[item - KITEM_SAD];
|
||||
if (item == KITEM_SAD || (item > KITEM_NONE && item < NUMKARTITEMS))
|
||||
return kp[item - KITEM_SAD][offset];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1146,7 +1146,7 @@ static void K_drawKartItem(void)
|
|||
break;
|
||||
|
||||
default:
|
||||
localpatch = K_GetItemPatchTable(item)[offset];
|
||||
localpatch = K_GetCachedItemPatch(item, offset);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1224,7 +1224,7 @@ static void K_drawKartItem(void)
|
|||
/*FALLTHRU*/
|
||||
|
||||
default:
|
||||
localpatch = K_GetItemPatchTable(stplyr->itemtype)[offset];
|
||||
localpatch = K_GetCachedItemPatch(stplyr->itemtype, offset);
|
||||
|
||||
if (localpatch == NULL)
|
||||
localpatch = kp_nodraw; // diagnose underflows
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue