Remove remnants of portalcullsector.

This commit is contained in:
Nev3r 2019-06-10 17:12:18 +02:00
parent 581e80ed69
commit d2605e0314
4 changed files with 31 additions and 32 deletions

View File

@ -31,7 +31,7 @@ sector_t *backsector;
// very ugly realloc() of drawsegs at run-time, I upped it to 512 // 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 // instead of 256.. and someone managed to send me a level with
// 896 drawsegs! So too bad here's a limit removal a-la-Boom // 896 drawsegs! So too bad here's a limit removal a-la-Boom
drawseg_t *curdrawsegs = NULL; drawseg_t *curdrawsegs = NULL; /**< This is used to handle multiple lists for masked drawsegs. */
drawseg_t *drawsegs = NULL; drawseg_t *drawsegs = NULL;
drawseg_t *ds_p = NULL; drawseg_t *ds_p = NULL;

View File

@ -997,15 +997,31 @@ static void R_PortalFrame(portal_t *portal)
if (portal->clipline != -1) if (portal->clipline != -1)
{ {
portalclipline = &lines[portal->clipline]; portalclipline = &lines[portal->clipline];
viewsector = portalcullsector = portalclipline->frontsector; viewsector = portalclipline->frontsector;
} }
else else
{ {
portalclipline = NULL; portalclipline = NULL;
viewsector = portalcullsector = R_PointInSubsector(viewx, viewy)->sector; viewsector = R_PointInSubsector(viewx, viewy)->sector;
} }
} }
static void Mask_Pre (maskcount_t* m)
{
m->drawsegs[0] = ds_p - drawsegs;
m->vissprites[0] = visspritecount;
m->viewx = viewx;
m->viewy = viewy;
m->viewz = viewz;
m->viewsector = viewsector;
}
static void Mask_Post (maskcount_t* m)
{
m->drawsegs[1] = ds_p - drawsegs;
m->vissprites[1] = visspritecount;
}
// ================ // ================
// R_RenderView // R_RenderView
// ================ // ================
@ -1048,24 +1064,14 @@ void R_RenderPlayerView(player_t *player)
// The head node is the last node output. // The head node is the last node output.
Mask_Pre(&masks[nummasks - 1]);
curdrawsegs = ds_p;
//profile stuff --------------------------------------------------------- //profile stuff ---------------------------------------------------------
#ifdef TIMING #ifdef TIMING
mytotal = 0; mytotal = 0;
ProfZeroTimer(); ProfZeroTimer();
#endif #endif
masks[nummasks - 1].drawsegs[0] = 0;
masks[nummasks - 1].vissprites[0] = 0;
masks[nummasks - 1].viewx = viewx;
masks[nummasks - 1].viewy = viewy;
masks[nummasks - 1].viewz = viewz;
masks[nummasks - 1].viewsector = viewsector;
curdrawsegs = ds_p;
R_RenderBSPNode((INT32)numnodes - 1); R_RenderBSPNode((INT32)numnodes - 1);
masks[nummasks - 1].drawsegs[1] = ds_p - drawsegs;
masks[nummasks - 1].vissprites[1] = visspritecount;
R_ClipSprites(drawsegs, NULL);
#ifdef TIMING #ifdef TIMING
RDMSR(0x10, &mycount); RDMSR(0x10, &mycount);
mytotal += mycount; // 64bit add mytotal += mycount; // 64bit add
@ -1073,6 +1079,10 @@ void R_RenderPlayerView(player_t *player)
CONS_Debug(DBG_RENDER, "RenderBSPNode: 0x%d %d\n", *((INT32 *)&mytotal + 1), (INT32)mytotal); CONS_Debug(DBG_RENDER, "RenderBSPNode: 0x%d %d\n", *((INT32 *)&mytotal + 1), (INT32)mytotal);
#endif #endif
//profile stuff --------------------------------------------------------- //profile stuff ---------------------------------------------------------
Mask_Post(&masks[nummasks - 1]);
R_ClipSprites(drawsegs, NULL);
// Add skybox portals caused by sky visplanes. // Add skybox portals caused by sky visplanes.
if (cv_skybox.value && skyboxmo[0]) if (cv_skybox.value && skyboxmo[0])
@ -1081,13 +1091,14 @@ void R_RenderPlayerView(player_t *player)
// Portal rendering. Hijacks the BSP traversal. // Portal rendering. Hijacks the BSP traversal.
if (portal_base) if (portal_base)
{ {
INT32 i, p;
portal_t *portal; portal_t *portal;
for(portal = portal_base; portal; portal = portal_base) for(portal = portal_base; portal; portal = portal_base)
{ {
portalrender = portal->pass; // Recursiveness depth. portalrender = portal->pass; // Recursiveness depth.
R_ClearFFloorClips();
// Apply the viewpoint stored for the portal. // Apply the viewpoint stored for the portal.
R_PortalFrame(portal); R_PortalFrame(portal);
@ -1102,30 +1113,20 @@ void R_RenderPlayerView(player_t *player)
validcount++; validcount++;
// Render the BSP from the new viewpoint, and clip
// any sprites with the new clipsegs and window.
masks = realloc(masks, (++nummasks)*sizeof(maskcount_t)); masks = realloc(masks, (++nummasks)*sizeof(maskcount_t));
masks[nummasks - 1].drawsegs[0] = ds_p - drawsegs; Mask_Pre(&masks[nummasks - 1]);
masks[nummasks - 1].vissprites[0] = visspritecount;
masks[nummasks - 1].viewx = viewx;
masks[nummasks - 1].viewy = viewy;
masks[nummasks - 1].viewz = viewz;
masks[nummasks - 1].viewsector = viewsector;
curdrawsegs = ds_p; curdrawsegs = ds_p;
R_ClearFFloorClips(); // Render the BSP from the new viewpoint, and clip
// any sprites with the new clipsegs and window.
R_RenderBSPNode((INT32)numnodes - 1); R_RenderBSPNode((INT32)numnodes - 1);
masks[nummasks - 1].drawsegs[1] = ds_p - drawsegs; Mask_Post(&masks[nummasks - 1]);
masks[nummasks - 1].vissprites[1] = visspritecount;
R_ClipSprites(ds_p - (masks[nummasks - 1].drawsegs[1] - masks[nummasks - 1].drawsegs[0]), portal); R_ClipSprites(ds_p - (masks[nummasks - 1].drawsegs[1] - masks[nummasks - 1].drawsegs[0]), portal);
Portal_Remove(portal); Portal_Remove(portal);
} }
portalcullsector = NULL; // Just in case...
} }
R_DrawPlanes(); R_DrawPlanes();

View File

@ -21,7 +21,6 @@
#include "r_sky.h" #include "r_sky.h"
UINT8 portalrender; /**< When rendering a portal, it establishes the depth of the current BSP traversal. */ UINT8 portalrender; /**< When rendering a portal, it establishes the depth of the current BSP traversal. */
sector_t *portalcullsector;
// Linked list for portals. // Linked list for portals.
portal_t *portal_base, *portal_cap; portal_t *portal_base, *portal_cap;

View File

@ -44,7 +44,6 @@ extern portal_t* portal_base;
extern portal_t* portal_cap; extern portal_t* portal_cap;
extern UINT8 portalrender; extern UINT8 portalrender;
extern sector_t *portalcullsector;
extern line_t *portalclipline; extern line_t *portalclipline;
extern INT32 portalclipstart, portalclipend; extern INT32 portalclipstart, portalclipend;