From 2876e2adc6b38bd2df505aa54cd58f33d8608968 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Sun, 23 Mar 2025 22:30:36 -0400 Subject: [PATCH] Properly fix shearing crash without the ugly hack --- src/r_main.cpp | 8 +++++++- src/st_stuff.c | 5 +---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/r_main.cpp b/src/r_main.cpp index f80181fc4..8adb6ab5e 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -1438,7 +1438,13 @@ boolean R_ViewpointHasChasecam(player_t *player) boolean R_IsViewpointThirdPerson(player_t *player, boolean skybox) { - boolean chasecam = R_ViewpointHasChasecam(player); + boolean chasecam = false; + + // Prevent game crash if player is ever invalid. + if (!player) + return false; + + chasecam = R_ViewpointHasChasecam(player); // cut-away view stuff if (player->awayviewtics || skybox) diff --git a/src/st_stuff.c b/src/st_stuff.c index c9e9777b8..d108a1c9c 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -918,10 +918,7 @@ void ST_Drawer(void) stplyr = &players[displayplayers[i]]; stplyrnum = i; R_SetViewContext(VIEWCONTEXT_PLAYER1 + i); - - // HACK: This can possibly crash the game in R_IsViewpointThirdPerson during first two tics if the player object doesn't exist. - if (stplyr->mo) - R_InterpolateView(rendertimefrac); // to assist with object tracking + R_InterpolateView(rendertimefrac); // to assist with object tracking ST_overlayDrawer(); }