From 31f9937d7e1a9d17e46fb34e1f5e5a21ba5aece9 Mon Sep 17 00:00:00 2001 From: hayaunderscore Date: Mon, 4 Dec 2023 16:28:41 +0800 Subject: [PATCH] Fix horizon lines not rendering with portals + fix portal wall z-fighting --- src/hardware/hw_main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 842a765b7..bf019adfd 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -6251,8 +6251,16 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t * if (!rootportal && portallist.base && !skybox)// if portals have been drawn in the main view, then render skywalls differently gr_collect_skywalls = true; + // HAYA: Save the old portal state, and turn portals off while normally rendering the BSP tree. + // This fixes specific effects not working, such as horizon lines. + int oldportal_state = gr_portal; + + if (gr_portal != GRPORTAL_OFF) // if we already haven't hit the recursion limit or we already ended our portal shenanigans + gr_portal = GRPORTAL_INSIDE; // TURN IT OFF // Recursively "render" the BSP tree. HWR_RenderBSPNode((INT32)numnodes-1); + // woo we back + gr_portal = oldportal_state; PS_STOP_TIMING(ps_bsptime);