From bc566fac4e709664b98188d00bf7c4c44d0d221b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 12 Apr 2022 00:17:25 +0200 Subject: [PATCH] - treat PSP layer ID 0 as invalid No PSprites with this ID may ever be created, as there is no means to find them again. --- src/playsim/p_pspr.cpp | 2 +- src/playsim/p_pspr.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/playsim/p_pspr.cpp b/src/playsim/p_pspr.cpp index cc921b86b8..6f57fb6d4e 100644 --- a/src/playsim/p_pspr.cpp +++ b/src/playsim/p_pspr.cpp @@ -316,7 +316,7 @@ DPSprite *player_t::GetPSprite(PSPLayers layer) newcaller = ReadyWeapon; } - if (newcaller == nullptr) return nullptr; // Error case was not handled properly. This function cannot give a guarantee to always succeed! + if (newcaller == nullptr || layer == PSP_CALLERID) return nullptr; // Error case was not handled properly. This function cannot give a guarantee to always succeed! DPSprite *pspr = FindPSprite(layer); if (pspr == nullptr) diff --git a/src/playsim/p_pspr.h b/src/playsim/p_pspr.h index 31d3ec0bbe..a992e90d8d 100644 --- a/src/playsim/p_pspr.h +++ b/src/playsim/p_pspr.h @@ -51,6 +51,7 @@ class player_t; enum PSPLayers { PSP_STRIFEHANDS = -1, + PSP_CALLERID = 0, PSP_WEAPON = 1, PSP_FLASH = 1000, PSP_TARGETCENTER = INT_MAX - 2,