mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-14 13:51:31 +00:00
camera checks to avoid crashes
This commit is contained in:
parent
ef279ac5fe
commit
9a1bfb3a92
2 changed files with 11 additions and 8 deletions
15
src/p_user.c
15
src/p_user.c
|
@ -7418,6 +7418,9 @@ void P_DemoCameraMovement(camera_t *cam)
|
||||||
awayviewmobj_hack->flags2 |= MF2_DONTDRAW;
|
awayviewmobj_hack->flags2 |= MF2_DONTDRAW;
|
||||||
|
|
||||||
democam.soundmobj = awayviewmobj_hack;
|
democam.soundmobj = awayviewmobj_hack;
|
||||||
|
|
||||||
|
// update subsector to avoid crashes;
|
||||||
|
thiscam->subsector = R_PointInSubsector(cam->x, cam->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void P_ResetCamera(player_t *player, camera_t *thiscam)
|
void P_ResetCamera(player_t *player, camera_t *thiscam)
|
||||||
|
@ -7485,12 +7488,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
|
|
||||||
democam.soundmobj = NULL; // reset this each frame, we don't want the game crashing for stupid reasons now do we
|
democam.soundmobj = NULL; // reset this each frame, we don't want the game crashing for stupid reasons now do we
|
||||||
|
|
||||||
if (demo.freecam)
|
|
||||||
{
|
|
||||||
P_DemoCameraMovement(thiscam);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We probably shouldn't move the camera if there is no player or player mobj somehow
|
// We probably shouldn't move the camera if there is no player or player mobj somehow
|
||||||
if (!player || !player->mo)
|
if (!player || !player->mo)
|
||||||
return true;
|
return true;
|
||||||
|
@ -7499,6 +7496,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL)
|
if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (demo.freecam)
|
||||||
|
{
|
||||||
|
P_DemoCameraMovement(thiscam);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
mo = player->mo;
|
mo = player->mo;
|
||||||
|
|
||||||
#ifndef NOCLIPCAM
|
#ifndef NOCLIPCAM
|
||||||
|
|
|
@ -1176,7 +1176,7 @@ void R_SetupFrame(player_t *player, boolean skybox)
|
||||||
viewx += quake.x;
|
viewx += quake.x;
|
||||||
viewy += quake.y;
|
viewy += quake.y;
|
||||||
|
|
||||||
if (thiscam->subsector)
|
if (thiscam->subsector && thiscam->subsector->sector)
|
||||||
viewsector = thiscam->subsector->sector;
|
viewsector = thiscam->subsector->sector;
|
||||||
else
|
else
|
||||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||||
|
@ -1188,7 +1188,7 @@ void R_SetupFrame(player_t *player, boolean skybox)
|
||||||
viewx += quake.x;
|
viewx += quake.x;
|
||||||
viewy += quake.y;
|
viewy += quake.y;
|
||||||
|
|
||||||
if (viewmobj->subsector)
|
if (viewmobj->subsector && thiscam->subsector->sector)
|
||||||
viewsector = viewmobj->subsector->sector;
|
viewsector = viewmobj->subsector->sector;
|
||||||
else
|
else
|
||||||
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
viewsector = R_PointInSubsector(viewx, viewy)->sector;
|
||||||
|
|
Loading…
Reference in a new issue