From 04a6132f66253696f5c23c69d020a05f25e636c9 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sat, 25 Mar 2023 16:34:02 -0500 Subject: [PATCH] software: Skip precip mobjs in sky portal renders --- src/r_main.c | 4 ++++ src/r_portal.c | 4 ++++ src/r_portal.h | 2 ++ src/r_things.c | 2 +- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/r_main.c b/src/r_main.c index 9d001fc88..308c3fdf5 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1599,11 +1599,15 @@ void R_RenderPlayerView(void) Mask_Pre(&masks[nummasks - 1]); curdrawsegs = ds_p; + portalskipprecipmobjs = portal->isskybox; + // Render the BSP from the new viewpoint, and clip // any sprites with the new clipsegs and window. R_RenderBSPNode((INT32)numnodes - 1); Mask_Post(&masks[nummasks - 1]); + portalskipprecipmobjs = false; + R_ClipSprites(ds_p - (masks[nummasks - 1].drawsegs[1] - masks[nummasks - 1].drawsegs[0]), portal); Portal_Remove(portal); diff --git a/src/r_portal.c b/src/r_portal.c index f3ae2524c..aa0164eb6 100644 --- a/src/r_portal.c +++ b/src/r_portal.c @@ -21,6 +21,7 @@ #include "r_sky.h" UINT8 portalrender; /**< When rendering a portal, it establishes the depth of the current BSP traversal. */ +boolean portalskipprecipmobjs = false; // Linked list for portals. portal_t *portal_base, *portal_cap; @@ -127,6 +128,8 @@ static portal_t* Portal_Add (const INT16 x1, const INT16 x2) // Increase recursion level. portal->pass = portalrender+1; + portal->isskybox = false; + return portal; } @@ -309,6 +312,7 @@ void Portal_AddSkybox portal->viewz += viewz * -mh->skybox_scalez; portal->clipline = -1; + portal->isskybox = true; } /** Creates portals for the currently existing sky visplanes. diff --git a/src/r_portal.h b/src/r_portal.h index 933ff31d9..460c8a036 100644 --- a/src/r_portal.h +++ b/src/r_portal.h @@ -35,6 +35,7 @@ struct portal_t angle_t viewangle; UINT8 pass; /**< Keeps track of the portal's recursion depth. */ + boolean isskybox; INT32 clipline; /**< Optional clipline for line-based portals. */ // Clipping information. @@ -48,6 +49,7 @@ struct portal_t extern portal_t* portal_base; extern portal_t* portal_cap; extern UINT8 portalrender; +extern boolean portalskipprecipmobjs; extern line_t *portalclipline; extern sector_t *portalcullsector; diff --git a/src/r_things.c b/src/r_things.c index 74cf29de8..c8ef9b557 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2698,7 +2698,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) } // no, no infinite draw distance for precipitation. this option at zero is supposed to turn it off - if ((limit_dist = (fixed_t)cv_drawdist_precip.value * mapobjectscale)) + if ((limit_dist = (fixed_t)cv_drawdist_precip.value * mapobjectscale) && !portalskipprecipmobjs) { for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext) {