Properly fix shearing crash without the ugly hack

This commit is contained in:
NepDisk 2025-03-23 22:30:36 -04:00
parent f845a3aca5
commit 2876e2adc6
2 changed files with 8 additions and 5 deletions

View file

@ -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)

View file

@ -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();
}