From c646341a5dca32a2b21f3d2f6cf3ab46c519a700 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Mon, 11 Mar 2024 23:39:25 -0700 Subject: [PATCH] Minimap: check for removed ghost mobjs --- src/k_hud.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/k_hud.cpp b/src/k_hud.cpp index d5d16ab49..9d80582f6 100644 --- a/src/k_hud.cpp +++ b/src/k_hud.cpp @@ -4425,27 +4425,28 @@ static void K_drawKartMinimap(void) demoghost *g = ghosts; while (g) { - if (g->mo->skin) - skin = ((skin_t*)g->mo->skin)-skins; - else - skin = 0; - - workingPic = R_CanShowSkinInDemo(skin) ? faceprefix[skin][FACE_MINIMAP] : kp_unknownminimap; - - if (g->mo->color) + if (g->mo && !P_MobjWasRemoved(g->mo) && g->mo->skin) { - if (g->mo->colorized) - colormap = R_GetTranslationColormap(TC_RAINBOW, static_cast(g->mo->color), GTC_CACHE); + skin = ((skin_t*)g->mo->skin)-skins; + + workingPic = R_CanShowSkinInDemo(skin) ? faceprefix[skin][FACE_MINIMAP] : kp_unknownminimap; + + if (g->mo->color) + { + if (g->mo->colorized) + colormap = R_GetTranslationColormap(TC_RAINBOW, static_cast(g->mo->color), GTC_CACHE); + else + colormap = R_GetTranslationColormap(skin, static_cast(g->mo->color), GTC_CACHE); + } else - colormap = R_GetTranslationColormap(skin, static_cast(g->mo->color), GTC_CACHE); + colormap = NULL; + + interpx = R_InterpolateFixed(g->mo->old_x, g->mo->x); + interpy = R_InterpolateFixed(g->mo->old_y, g->mo->y); + + K_drawKartMinimapIcon(interpx, interpy, x, y, splitflags, workingPic, colormap); } - else - colormap = NULL; - interpx = R_InterpolateFixed(g->mo->old_x, g->mo->x); - interpy = R_InterpolateFixed(g->mo->old_y, g->mo->y); - - K_drawKartMinimapIcon(interpx, interpy, x, y, splitflags, workingPic, colormap); g = g->next; } }