From 30602a8eb76072dafab2cf8c62a11261c2590bc4 Mon Sep 17 00:00:00 2001 From: Indev Date: Sun, 12 Nov 2023 19:10:51 +0300 Subject: [PATCH] Fix crash related to localskins and stat display --- src/k_kart.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 11f69a5b0..58d6a9e07 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7656,28 +7656,25 @@ static void K_drawKartStats(void) y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset; flags |= V_HUDTRANS; - INT32 skinnum; - skin_t fakeskin; - fakeskin = skins[stplyr->skin]; - skinnum = stplyr->skin; + skin_t *fakeskin; + fakeskin = &skins[stplyr->skin]; // local skinner - if (stplyr->localskin) + if (stplyr->localskin) { - skinnum = stplyr->localskin - 1; - if (stplyr->mo->skinlocal) - fakeskin = localskins[stplyr->localskin - 1]; + if (stplyr->skinlocal) + fakeskin = &localskins[stplyr->localskin - 1]; else - fakeskin = skins[stplyr->localskin - 1]; + fakeskin = &skins[stplyr->localskin - 1]; } if (!splitscreen) { // Skin name - V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE, va("%c%s", V_GetSkincolorChar(stplyr->skincolor), fakeskin.realname)); + V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE, va("%c%s", V_GetSkincolorChar(stplyr->skincolor), fakeskin->realname)); // Icon and stats - V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(stplyr->mo->skin, stplyr->mo->localskin, stplyr->skincolor, GTC_CACHE, stplyr->mo->skinlocal)); + V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal)); V_DrawMappedPatch(x-3, y-2, flags, kp_facenum[min(9, max(1, stplyr->kartspeed))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE)); V_DrawMappedPatch(x+10, y+10, flags, kp_facenum[min(9, max(1, stplyr->kartweight))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE)); }