From fd4833568880ea0db4d709e80aa021fda037a935 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 28 Sep 2024 01:30:14 +0200 Subject: [PATCH] Replace portalline boolean with g_portal pointer to current portal Beta --- src/r_bsp.c | 4 ++-- src/r_bsp.h | 4 +++- src/r_main.c | 20 +------------------- src/r_main.h | 21 +++++++++++++++++++++ src/r_segs.c | 2 +- 5 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index d1ceadbf4..586aa3799 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -28,7 +28,7 @@ side_t *sidedef; line_t *linedef; sector_t *frontsector; sector_t *backsector; -boolean portalline; // is curline a portal seg? +portal_pair *g_portal; // is curline a portal seg? // very ugly realloc() of drawsegs at run-time, I upped it to 512 // instead of 256.. and someone managed to send me a level with @@ -417,7 +417,7 @@ static void R_AddLine(seg_t *line) angle_t angle1, angle2, span, tspan; static sector_t tempsec; - portalline = false; + g_portal = NULL; if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES)) return; diff --git a/src/r_bsp.h b/src/r_bsp.h index 2803a90e4..0d73c2bc4 100644 --- a/src/r_bsp.h +++ b/src/r_bsp.h @@ -18,12 +18,14 @@ #pragma interface #endif +#include "r_main.h" + extern seg_t *curline; extern side_t *sidedef; extern line_t *linedef; extern sector_t *frontsector; extern sector_t *backsector; -extern boolean portalline; // is curline a portal seg? +extern portal_pair *g_portal; // is curline a portal seg? // drawsegs are allocated on the fly... see r_segs.c diff --git a/src/r_main.c b/src/r_main.c index ba2c3551e..9b1787931 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -70,24 +70,6 @@ player_t *viewplayer; // You can thank and/or curse JTE for these. UINT8 portalrender; sector_t *portalcullsector; -typedef struct portal_pair -{ - INT32 line1; - INT32 line2; - UINT8 pass; - struct portal_pair *next; - - fixed_t viewx; - fixed_t viewy; - fixed_t viewz; - angle_t viewangle; - - INT32 start; - INT32 end; - INT16 *ceilingclip; - INT16 *floorclip; - fixed_t *frontscale; -} portal_pair; portal_pair *portal_base, *portal_cap; line_t *portalclipline; INT32 portalclipstart, portalclipend; @@ -1613,7 +1595,7 @@ void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2) portal->start = x1; portal->end = x2; - portalline = true; // this tells R_StoreWallRange that curline is a portal seg + g_portal = portal; // this tells R_StoreWallRange that curline is a portal seg portal->viewx = viewx; portal->viewy = viewy; diff --git a/src/r_main.h b/src/r_main.h index 34fe686b5..8766ea65c 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -88,6 +88,27 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y); boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixed_t bottomh, fixed_t toph); void R_GetRenderBlockMapDimensions(fixed_t drawdist, INT32 *xl, INT32 *xh, INT32 *yl, INT32 *yh); + +typedef struct portal_pair +{ + INT32 line1; + INT32 line2; + UINT8 pass; + struct portal_pair *next; + + fixed_t viewx; + fixed_t viewy; + fixed_t viewz; + angle_t viewangle; + + INT32 start; + INT32 end; + INT16 *ceilingclip; + INT16 *floorclip; + fixed_t *frontscale; +} portal_pair; + + // Performance stats extern precise_t ps_prevframetime;// time when previous frame was rendered extern ps_metric_t ps_rendercalltime; diff --git a/src/r_segs.c b/src/r_segs.c index 07d217608..e89a10780 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2840,7 +2840,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) R_RenderSegLoop(); colfunc = wallcolfunc; - if (portalline) // if curline is a portal, set portalrender for drawseg + if (g_portal) // if curline is a portal, set portalrender for drawseg ds_p->portalpass = portalrender+1; else ds_p->portalpass = 0;