Attempt to not let the camera into thok barriers

Doesn't really work right now; it'll still go into thok barriers and get caught up at its floor height
This commit is contained in:
TehRealSalt 2018-09-22 22:46:06 -04:00
parent 3949d0fcdb
commit 9f42e74fe2
2 changed files with 16 additions and 5 deletions

View file

@ -2181,6 +2181,12 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
mapcampointer = thiscam;
#ifdef NOCLIPCAM
if (newsubsec->sector->floorheight >= newsubsec->sector->ceilingheight
|| newsubsec->sector->ceilingheight <= newsubsec->sector->floorheight)
return false;
#endif
if (GETSECSPECIAL(newsubsec->sector->special, 4) == 12)
{ // Camera noclip on entire sector.
tmfloorz = tmdropoffz = thiscam->z;
@ -2378,12 +2384,15 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam)
fixed_t tryx = thiscam->x;
fixed_t tryy = thiscam->y;
#ifndef NOCLIPCAM
#ifdef NOCLIPCAM
if (!(s->sector->floorheight >= s->sector->ceilingheight
|| s->sector->ceilingheight <= s->sector->floorheight))
#else
if ((thiscam == &camera && (players[displayplayer].pflags & PF_NOCLIP))
|| (thiscam == &camera2 && (players[secondarydisplayplayer].pflags & PF_NOCLIP))
|| (thiscam == &camera3 && (players[thirddisplayplayer].pflags & PF_NOCLIP))
|| (thiscam == &camera4 && (players[fourthdisplayplayer].pflags & PF_NOCLIP))
|| (leveltime < introtime))
|| (thiscam == &camera2 && (players[secondarydisplayplayer].pflags & PF_NOCLIP))
|| (thiscam == &camera3 && (players[thirddisplayplayer].pflags & PF_NOCLIP))
|| (thiscam == &camera4 && (players[fourthdisplayplayer].pflags & PF_NOCLIP))
|| (leveltime < introtime))
#endif
{ // Noclipping player camera noclips too!!
floatok = true;

View file

@ -3701,6 +3701,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
{
if (!P_TryCameraMove(thiscam->x + thiscam->momx, thiscam->y + thiscam->momy, thiscam))
{ // Never fails for 2D mode.
#ifndef NOCLIPCAM
mobj_t dummy;
dummy.thinker.function.acp1 = (actionf_p1)P_MobjThinker;
dummy.subsector = thiscam->subsector;
@ -3711,6 +3712,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
if (!resetcalled && !(player->pflags & PF_NOCLIP || leveltime < introtime) && !P_CheckSight(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead.
P_ResetCamera(player, thiscam);
else
#endif
P_SlideCameraMove(thiscam);
if (resetcalled) // Okay this means the camera is fully reset.
return true;