From d7bc644dfeb3dd42465d7d8badca8ed033136701 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Fri, 25 Aug 2023 00:57:10 -0300 Subject: [PATCH] Check for cv_skybox.value if in a portal too --- src/r_main.c | 2 +- src/r_portal.c | 28 +++++++++++++--------------- src/r_portal.h | 2 -- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index c999b0f5e..3d0eafe37 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1560,7 +1560,7 @@ void R_RenderPlayerView(player_t *player) } // Don't add skybox portals while IN a skybox portal, because that'll cause infinite recursion - Portal_AddPlanePortals(!portal->is_skybox); + Portal_AddPlanePortals(cv_skybox.value && !portal->is_skybox); Mask_Post(&masks[nummasks - 1]); diff --git a/src/r_portal.c b/src/r_portal.c index ffa5d1a0d..3e7954ca6 100644 --- a/src/r_portal.c +++ b/src/r_portal.c @@ -305,13 +305,13 @@ static void Portal_GetViewpointForSkybox(portal_t *portal) * Applies the necessary offsets and rotation to give * a depth illusion to the skybox. */ -void Portal_AddSkybox (const visplane_t* plane) +static boolean Portal_AddSkybox (const visplane_t* plane) { INT16 start, end; portal_t* portal; if (TrimVisplaneBounds(plane, &start, &end)) - return; + return false; portal = Portal_Add(start, end); @@ -323,6 +323,8 @@ void Portal_AddSkybox (const visplane_t* plane) portal->horizon_sector = NULL; Portal_GetViewpointForSkybox(portal); + + return true; } static void Portal_GetViewpointForSecPortal(portal_t *portal, sectorportal_t *secportal) @@ -390,7 +392,7 @@ static void Portal_GetViewpointForSecPortal(portal_t *portal, sectorportal_t *se /** Creates a sector portal out of a visplane. */ -void Portal_AddSectorPortal (const visplane_t* plane) +static boolean Portal_AddSectorPortal (const visplane_t* plane) { INT16 start, end; sectorportal_t *secportal = plane->portalsector; @@ -398,13 +400,13 @@ void Portal_AddSectorPortal (const visplane_t* plane) // Shortcut if (secportal->type == SECPORTAL_SKYBOX) { - if (skyboxmo[0]) - Portal_AddSkybox(plane); - return; + if (cv_skybox.value && skyboxmo[0]) + return Portal_AddSkybox(plane); + return false; } if (TrimVisplaneBounds(plane, &start, &end)) - return; + return false; portal_t* portal = Portal_Add(start, end); @@ -416,6 +418,8 @@ void Portal_AddSectorPortal (const visplane_t* plane) portal->horizon_sector = NULL; Portal_GetViewpointForSecPortal(portal, secportal); + + return true; } /** Creates a transferred sector portal. @@ -467,17 +471,11 @@ void Portal_AddPlanePortals (boolean add_skyboxes) // Render sector portal if recursiveness limit hasn't been reached if (pl->portalsector && portalrender < cv_maxportals.value) - { - Portal_AddSectorPortal(pl); - added_portal = true; - } + added_portal = Portal_AddSectorPortal(pl); // Render skybox portal if (!added_portal && pl->picnum == skyflatnum && add_skyboxes && skyboxmo[0]) - { - Portal_AddSkybox(pl); - added_portal = true; - } + added_portal = Portal_AddSkybox(pl); // don't render this visplane anymore if (added_portal) diff --git a/src/r_portal.h b/src/r_portal.h index b3c4b0edc..2485e45a7 100644 --- a/src/r_portal.h +++ b/src/r_portal.h @@ -58,8 +58,6 @@ extern INT32 portalclipstart, portalclipend; void Portal_InitList (void); void Portal_Remove (portal_t* portal); void Portal_Add2Lines (const INT32 line1, const INT32 line2, const INT32 x1, const INT32 x2); -void Portal_AddSkybox (const visplane_t* plane); -void Portal_AddSectorPortal (const visplane_t* plane); void Portal_AddTransferred (UINT32 secportalnum, const INT32 x1, const INT32 x2); void Portal_ClipRange (portal_t* portal);