From 9f42e74fe2db52fbe18e28675feb9034ad80d18b Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 22 Sep 2018 22:46:06 -0400 Subject: [PATCH] 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 --- src/p_map.c | 19 ++++++++++++++----- src/p_mobj.c | 2 ++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 41d61cb0..e9d38272 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -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; diff --git a/src/p_mobj.c b/src/p_mobj.c index d39e3876..233b307f 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -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;