From 3949d0fcdba173b3593a7c86aa72604794b92f42 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 22 Sep 2018 22:22:44 -0400 Subject: [PATCH 1/7] Obvious first commit: enable the NOCLIPCAM define again --- src/doomdef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doomdef.h b/src/doomdef.h index b5519f6f..31eb1877 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -546,6 +546,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// SRB2Kart: Camera always has noclip. /// \note Kind of problematic. If we decide to keep this on, we'll need serious map changes. -//#define NOCLIPCAM +#define NOCLIPCAM #endif // __DOOMDEF__ From 9f42e74fe2db52fbe18e28675feb9034ad80d18b Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 22 Sep 2018 22:46:06 -0400 Subject: [PATCH 2/7] 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; From 376656343a032d6612067315abf3270998b63dc6 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 4 Oct 2018 20:08:29 -0400 Subject: [PATCH 3/7] Revert "Attempt to not let the camera into thok barriers" This reverts commit 9f42e74fe2db52fbe18e28675feb9034ad80d18b. --- src/p_map.c | 19 +++++-------------- src/p_mobj.c | 2 -- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 11dda089..b249f362 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2181,12 +2181,6 @@ 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; @@ -2384,15 +2378,12 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) fixed_t tryx = thiscam->x; fixed_t tryy = thiscam->y; -#ifdef NOCLIPCAM - if (!(s->sector->floorheight >= s->sector->ceilingheight - || s->sector->ceilingheight <= s->sector->floorheight)) -#else +#ifndef NOCLIPCAM 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 456c0acf..d22d5cb6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3702,7 +3702,6 @@ 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; @@ -3713,7 +3712,6 @@ 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; From ea6bdca9497fca3d93b61ed4f5ee2ff23c7fbc6e Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 6 Oct 2018 15:13:57 -0400 Subject: [PATCH 4/7] Remove R_DoorClosed This function has caused me, so much unexpected pain because of just how out of the way it is, and NOTHING else uses it --- src/r_bsp.c | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index 34b082ca..d47c1140 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -222,30 +222,6 @@ void R_PortalClearClipSegs(INT32 start, INT32 end) newend = solidsegs + 2; } - -// R_DoorClosed -// -// This function is used to fix the automap bug which -// showed lines behind closed doors simply because the door had a dropoff. -// -// It assumes that Doom has already ruled out a door being closed because -// of front-back closure (e.g. front floor is taller than back ceiling). -static INT32 R_DoorClosed(void) -{ - return - - // if door is closed because back is shut: - backsector->ceilingheight <= backsector->floorheight - - // preserve a kind of transparent door/lift special effect: - && (backsector->ceilingheight >= frontsector->ceilingheight || curline->sidedef->toptexture) - - && (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture) - - // properly render skies (consider door "open" if both ceilings are sky): - && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum); -} - // // If player's view height is underneath fake floor, lower the // drawn ceiling to be just under the floor height, and replace @@ -534,7 +510,11 @@ static void R_AddLine(seg_t *line) } // Check for automap fix. Store in doorclosed for r_segs.c - doorclosed = R_DoorClosed(); + doorclosed = (backsector->ceilingheight <= backsector->floorheight + && (backsector->ceilingheight >= frontsector->ceilingheight || curline->sidedef->toptexture) + && (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture) + && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)); + if (doorclosed) goto clipsolid; From 3d7a1d44d506aa50e0a3c67da67e3e4ca09be15b Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 6 Oct 2018 16:22:36 -0400 Subject: [PATCH 5/7] Do clipsolid for doorclosed only while your camera is outside of the sector --- src/r_bsp.c | 55 +++++++++++++++++++++++++------------------- src/r_segs.c | 65 ++++++++++++++++++++++++++++------------------------ 2 files changed, 66 insertions(+), 54 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index d47c1140..da9ad665 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -374,6 +374,7 @@ static void R_AddLine(seg_t *line) INT32 x1, x2; angle_t angle1, angle2, span, tspan; static sector_t tempsec; // ceiling/water hack + sector_t *thissec = R_PointInSubsector(viewx, viewy)->sector; if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES)) return; @@ -478,21 +479,24 @@ static void R_AddLine(seg_t *line) SLOPEPARAMS( backsector->f_slope, backf1, backf2, backsector->floorheight) SLOPEPARAMS( backsector->c_slope, backc1, backc2, backsector->ceilingheight) #undef SLOPEPARAMS - if ((backc1 <= frontf1 && backc2 <= frontf2) - || (backf1 >= frontc1 && backf2 >= frontc2)) + if (thissec != backsector && thissec != frontsector) { - goto clipsolid; + if ((backc1 <= frontf1 && backc2 <= frontf2) + || (backf1 >= frontc1 && backf2 >= frontc2)) + { + goto clipsolid; + } + + // Check for automap fix. Store in doorclosed for r_segs.c + doorclosed = (backc1 <= backf1 && backc2 <= backf2 + && ((backc1 >= frontc1 && backc2 >= frontc2) || curline->sidedef->toptexture) + && ((backf1 <= frontf1 && backf2 >= frontf2) || curline->sidedef->bottomtexture) + && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)); + + if (doorclosed) + goto clipsolid; } - // Check for automap fix. Store in doorclosed for r_segs.c - doorclosed = (backc1 <= backf1 && backc2 <= backf2 - && ((backc1 >= frontc1 && backc2 >= frontc2) || curline->sidedef->toptexture) - && ((backf1 <= frontf1 && backf2 >= frontf2) || curline->sidedef->bottomtexture) - && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)); - - if (doorclosed) - goto clipsolid; - // Window. if (backc1 != frontc1 || backc2 != frontc2 || backf1 != frontf1 || backf2 != frontf2) @@ -503,21 +507,24 @@ static void R_AddLine(seg_t *line) else #endif { - if (backsector->ceilingheight <= frontsector->floorheight - || backsector->floorheight >= frontsector->ceilingheight) + if (thissec != backsector && thissec != frontsector) { - goto clipsolid; + if (backsector->ceilingheight <= frontsector->floorheight + || backsector->floorheight >= frontsector->ceilingheight) + { + goto clipsolid; + } + + // Check for automap fix. Store in doorclosed for r_segs.c + doorclosed = (backsector->ceilingheight <= backsector->floorheight + && (backsector->ceilingheight >= frontsector->ceilingheight || curline->sidedef->toptexture) + && (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture) + && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)); + + if (doorclosed) + goto clipsolid; } - // Check for automap fix. Store in doorclosed for r_segs.c - doorclosed = (backsector->ceilingheight <= backsector->floorheight - && (backsector->ceilingheight >= frontsector->ceilingheight || curline->sidedef->toptexture) - && (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture) - && (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)); - - if (doorclosed) - goto clipsolid; - // Window. if (backsector->ceilingheight != frontsector->ceilingheight || backsector->floorheight != frontsector->floorheight) diff --git a/src/r_segs.c b/src/r_segs.c index 11287f16..84bb119f 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2020,6 +2020,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) { // two sided line + sector_t *thissec = R_PointInSubsector(viewx, viewy)->sector; + #ifdef ESLOPE if (backsector->c_slope) { worldhigh = P_GetZAt(backsector->c_slope, segleft.x, segleft.y) - viewz; @@ -2113,52 +2115,55 @@ void R_StoreWallRange(INT32 start, INT32 stop) // ds_p->sprtopclip = screenheightarray; } -#ifdef ESLOPE - if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope) -#else - if (worldhigh <= worldbottom) -#endif - { - ds_p->sprbottomclip = negonearray; - ds_p->bsilheight = INT32_MAX; - ds_p->silhouette |= SIL_BOTTOM; - } - -#ifdef ESLOPE - if (worldlow >= worldtop && worldlowslope >= worldtopslope) -#else - if (worldlow >= worldtop) -#endif - { - ds_p->sprtopclip = screenheightarray; - ds_p->tsilheight = INT32_MIN; - ds_p->silhouette |= SIL_TOP; - } - - //SoM: 3/25/2000: This code fixes an automap bug that didn't check - // frontsector->ceiling and backsector->floor to see if a door was closed. - // Without the following code, sprites get displayed behind closed doors. + if (thissec != frontsector && thissec != backsector) { #ifdef ESLOPE - if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)) + if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope) #else - if (doorclosed || backsector->ceilingheight <= frontsector->floorheight) + if (worldhigh <= worldbottom) #endif { ds_p->sprbottomclip = negonearray; ds_p->bsilheight = INT32_MAX; ds_p->silhouette |= SIL_BOTTOM; } + #ifdef ESLOPE - if (doorclosed || (worldlow >= worldtop && worldlowslope >= worldtopslope)) + if (worldlow >= worldtop && worldlowslope >= worldtopslope) #else - if (doorclosed || backsector->floorheight >= frontsector->ceilingheight) + if (worldlow >= worldtop) #endif - { // killough 1/17/98, 2/8/98 + { ds_p->sprtopclip = screenheightarray; ds_p->tsilheight = INT32_MIN; ds_p->silhouette |= SIL_TOP; } + + //SoM: 3/25/2000: This code fixes an automap bug that didn't check + // frontsector->ceiling and backsector->floor to see if a door was closed. + // Without the following code, sprites get displayed behind closed doors. + { +#ifdef ESLOPE + if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)) +#else + if (doorclosed || backsector->ceilingheight <= frontsector->floorheight) +#endif + { + ds_p->sprbottomclip = negonearray; + ds_p->bsilheight = INT32_MAX; + ds_p->silhouette |= SIL_BOTTOM; + } +#ifdef ESLOPE + if (doorclosed || (worldlow >= worldtop && worldlowslope >= worldtopslope)) +#else + if (doorclosed || backsector->floorheight >= frontsector->ceilingheight) +#endif + { // killough 1/17/98, 2/8/98 + ds_p->sprtopclip = screenheightarray; + ds_p->tsilheight = INT32_MIN; + ds_p->silhouette |= SIL_TOP; + } + } } if (worldlow != worldbottom From ff7b402dc572396fba11c23d48bbd6180a08663d Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 6 Oct 2018 19:25:59 -0400 Subject: [PATCH 6/7] OGL support --- src/hardware/hw_main.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 6a664d39..774ff8c1 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2690,6 +2690,8 @@ static void HWR_AddLine(seg_t * line) // SoM: Backsector needs to be run through R_FakeFlat static sector_t tempsec; + sector_t *thissec = R_PointInSubsector(viewx, viewy)->sector; + if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES)) return; @@ -2811,11 +2813,14 @@ static void HWR_AddLine(seg_t * line) SLOPEPARAMS( gr_backsector->c_slope, backc1, backc2, gr_backsector->ceilingheight) #undef SLOPEPARAMS - // Closed door. - if ((backc1 <= frontf1 && backc2 <= frontf2) - || (backf1 >= frontc1 && backf2 >= frontc2)) + if (thissec != gr_backsector && thissec != gr_frontsector) { - goto clipsolid; + // Closed door. + if ((backc1 <= frontf1 && backc2 <= frontf2) + || (backf1 >= frontc1 && backf2 >= frontc2)) + { + goto clipsolid; + } } // Window. @@ -2828,10 +2833,13 @@ static void HWR_AddLine(seg_t * line) else #endif { - // Closed door. - if (gr_backsector->ceilingheight <= gr_frontsector->floorheight || - gr_backsector->floorheight >= gr_frontsector->ceilingheight) - goto clipsolid; + if (thissec != gr_backsector && thissec != gr_frontsector) + { + // Closed door. + if (gr_backsector->ceilingheight <= gr_frontsector->floorheight || + gr_backsector->floorheight >= gr_frontsector->ceilingheight) + goto clipsolid; + } // Window. if (gr_backsector->ceilingheight != gr_frontsector->ceilingheight || From 8ba3f8855355c19fe499c383369e28bac3cbf177 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 6 Oct 2018 23:37:27 -0400 Subject: [PATCH 7/7] Don't need thissec --- src/hardware/hw_main.c | 6 ++---- src/r_bsp.c | 5 ++--- src/r_segs.c | 6 ++---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 774ff8c1..2e4c733b 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2690,8 +2690,6 @@ static void HWR_AddLine(seg_t * line) // SoM: Backsector needs to be run through R_FakeFlat static sector_t tempsec; - sector_t *thissec = R_PointInSubsector(viewx, viewy)->sector; - if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES)) return; @@ -2813,7 +2811,7 @@ static void HWR_AddLine(seg_t * line) SLOPEPARAMS( gr_backsector->c_slope, backc1, backc2, gr_backsector->ceilingheight) #undef SLOPEPARAMS - if (thissec != gr_backsector && thissec != gr_frontsector) + if (viewsector != gr_backsector && viewsector != gr_frontsector) { // Closed door. if ((backc1 <= frontf1 && backc2 <= frontf2) @@ -2833,7 +2831,7 @@ static void HWR_AddLine(seg_t * line) else #endif { - if (thissec != gr_backsector && thissec != gr_frontsector) + if (viewsector != gr_backsector && viewsector != gr_frontsector) { // Closed door. if (gr_backsector->ceilingheight <= gr_frontsector->floorheight || diff --git a/src/r_bsp.c b/src/r_bsp.c index da9ad665..0c48ae8b 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -374,7 +374,6 @@ static void R_AddLine(seg_t *line) INT32 x1, x2; angle_t angle1, angle2, span, tspan; static sector_t tempsec; // ceiling/water hack - sector_t *thissec = R_PointInSubsector(viewx, viewy)->sector; if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES)) return; @@ -479,7 +478,7 @@ static void R_AddLine(seg_t *line) SLOPEPARAMS( backsector->f_slope, backf1, backf2, backsector->floorheight) SLOPEPARAMS( backsector->c_slope, backc1, backc2, backsector->ceilingheight) #undef SLOPEPARAMS - if (thissec != backsector && thissec != frontsector) + if (viewsector != backsector && viewsector != frontsector) { if ((backc1 <= frontf1 && backc2 <= frontf2) || (backf1 >= frontc1 && backf2 >= frontc2)) @@ -507,7 +506,7 @@ static void R_AddLine(seg_t *line) else #endif { - if (thissec != backsector && thissec != frontsector) + if (viewsector != backsector && viewsector != frontsector) { if (backsector->ceilingheight <= frontsector->floorheight || backsector->floorheight >= frontsector->ceilingheight) diff --git a/src/r_segs.c b/src/r_segs.c index 84bb119f..231a84f7 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1365,7 +1365,7 @@ static void R_RenderSegLoop (void) if (bottom >= floorclip[rw_x]) bottom = floorclip[rw_x]-1; - if (top <= bottom) + if (top <= bottom && ceilingplane) { ceilingplane->top[rw_x] = (INT16)top; ceilingplane->bottom[rw_x] = (INT16)bottom; @@ -2020,8 +2020,6 @@ void R_StoreWallRange(INT32 start, INT32 stop) { // two sided line - sector_t *thissec = R_PointInSubsector(viewx, viewy)->sector; - #ifdef ESLOPE if (backsector->c_slope) { worldhigh = P_GetZAt(backsector->c_slope, segleft.x, segleft.y) - viewz; @@ -2115,7 +2113,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) // ds_p->sprtopclip = screenheightarray; } - if (thissec != frontsector && thissec != backsector) + if (viewsector != frontsector && viewsector != backsector) { #ifdef ESLOPE if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)