From e354e139373ea9aaf0737f22bdd920e475a8a7fc Mon Sep 17 00:00:00 2001 From: Nep2Disk <suesakamoto@outlook.com> Date: Sat, 22 Mar 2025 19:01:31 +0000 Subject: [PATCH 1/3] Hack to fix possible crash in R_IsViewpointThirdPerson Basically to explain, due to R_InterpolateView being called here it can possibly pass an invalid player ref to R_IsViewpointThirdPerson since the player mobj hasn't been created yet. Thanks to GenericHeroGuy for helping me figure this out. --- src/st_stuff.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 7349599d7..e459f5733 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1602,7 +1602,13 @@ void ST_Drawer(void) stplyr = &players[displayplayers[i]]; st_fadein = localfadein[i]; R_SetViewContext(VIEWCONTEXT_PLAYER1 + i); - R_InterpolateView(rendertimefrac); // to assist with object tracking + + // 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 + } + ST_overlayDrawer(); } -- GitLab From 4294b943e1d3320ddaf34bf5d0153ee2a28389b5 Mon Sep 17 00:00:00 2001 From: Nep2Disk <suesakamoto@outlook.com> Date: Mon, 24 Mar 2025 02:24:00 +0000 Subject: [PATCH 2/3] Update 2 files - /src/st_stuff.c - /src/r_main.cpp --- src/r_main.cpp | 6 +++++- src/st_stuff.c | 8 +------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/r_main.cpp b/src/r_main.cpp index 47d2d7ded..41827d4a9 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -1430,7 +1430,11 @@ 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; // cut-away view stuff if (player->awayview.tics || skybox) diff --git a/src/st_stuff.c b/src/st_stuff.c index e459f5733..7349599d7 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1602,13 +1602,7 @@ void ST_Drawer(void) stplyr = &players[displayplayers[i]]; st_fadein = localfadein[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(); } -- GitLab From 9b36f9805c6fd29c585064f3a5a0dff063a63ea8 Mon Sep 17 00:00:00 2001 From: Nep2Disk <suesakamoto@outlook.com> Date: Mon, 24 Mar 2025 02:26:26 +0000 Subject: [PATCH 3/3] Whoops I forgot the chasecam assignment --- src/r_main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/r_main.cpp b/src/r_main.cpp index 41827d4a9..b62a245df 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -1435,6 +1435,8 @@ boolean R_IsViewpointThirdPerson(player_t *player, boolean skybox) // Prevent game crash if player is ever invalid. if (!player) return false; + + chasecam = R_ViewpointHasChasecam(player); // cut-away view stuff if (player->awayview.tics || skybox) -- GitLab