Cull BSP behind a raised floor or lowered ceiling that covers the entire screen
https://git.do.srb2.org/KartKrew/RingRacers/-/commit/7b8a564f69688515319ccd425f2b88ffe8b7b120
This commit is contained in:
1 parent
837746c0a9
commit
d794de3e83
3 files changed
+34
-17
No files matched your search
+19
-6
@@ -39,6 +39,10 @@ drawseg_t *ds_p = NULL;
|
||||
// indicates doors closed wrt automap bugfix:
|
||||
INT32 doorclosed;
|
||||
|
||||
// A wall was drawn covering the whole screen, which means we
|
||||
// can block off the BSP across that seg.
|
||||
boolean g_walloffscreen;
|
||||
|
||||
boolean R_NoEncore(sector_t *sector, boolean ceiling)
|
||||
{
|
||||
boolean invertencore = (GETSECSPECIAL(sector->special, 2) == 15);
|
||||
@@ -163,7 +167,7 @@ crunch:
|
||||
// Clips the given range of columns, but does not include it in the clip list.
|
||||
// Does handle windows, e.g. LineDefs with upper and lower texture.
|
||||
//
|
||||
static inline void R_ClipPassWallSegment(INT32 first, INT32 last)
|
||||
static inline void R_ClipPassWallSegment(INT32 first, INT32 last, boolean soliddontrender)
|
||||
{
|
||||
cliprange_t *start;
|
||||
|
||||
@@ -178,12 +182,14 @@ static inline void R_ClipPassWallSegment(INT32 first, INT32 last)
|
||||
if (last < start->first - 1)
|
||||
{
|
||||
// Post is entirely visible (above start).
|
||||
R_StoreWallRange(first, last);
|
||||
if (!soliddontrender)
|
||||
R_StoreWallRange(first, last);
|
||||
return;
|
||||
}
|
||||
|
||||
// There is a fragment above *start.
|
||||
R_StoreWallRange(first, start->first - 1);
|
||||
if (!soliddontrender)
|
||||
R_StoreWallRange(first, start->first - 1);
|
||||
}
|
||||
|
||||
// Bottom contained in start?
|
||||
@@ -193,7 +199,8 @@ static inline void R_ClipPassWallSegment(INT32 first, INT32 last)
|
||||
while (last >= (start+1)->first - 1)
|
||||
{
|
||||
// There is a fragment between two posts.
|
||||
R_StoreWallRange(start->last + 1, (start+1)->first - 1);
|
||||
if (!soliddontrender)
|
||||
R_StoreWallRange(start->last + 1, (start+1)->first - 1);
|
||||
start++;
|
||||
|
||||
if (last <= start->last)
|
||||
@@ -201,7 +208,8 @@ static inline void R_ClipPassWallSegment(INT32 first, INT32 last)
|
||||
}
|
||||
|
||||
// There is a fragment after *next.
|
||||
R_StoreWallRange(start->last + 1, last);
|
||||
if (!soliddontrender)
|
||||
R_StoreWallRange(start->last + 1, last);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -579,10 +587,15 @@ static void R_AddLine(seg_t *line)
|
||||
return;
|
||||
|
||||
clippass:
|
||||
R_ClipPassWallSegment(x1, x2 - 1);
|
||||
g_walloffscreen = false;
|
||||
if (g_walloffscreen)
|
||||
R_ClipPassWallSegment(x1, x2 - 1, true);
|
||||
else
|
||||
R_ClipPassWallSegment(x1, x2 - 1, false);
|
||||
return;
|
||||
|
||||
clipsolid:
|
||||
g_walloffscreen = false;
|
||||
R_ClipSolidWallSegment(x1, x2 - 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ extern INT32 checkcoord[12][4];
|
||||
extern drawseg_t *drawsegs;
|
||||
extern drawseg_t *ds_p;
|
||||
extern INT32 doorclosed;
|
||||
extern boolean g_walloffscreen;
|
||||
|
||||
// BSP?
|
||||
void R_ClearClipSegs(void);
|
||||
|
||||
+14
-11
@@ -2596,23 +2596,26 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
|
||||
if (toptexture)
|
||||
{
|
||||
pixhigh = (centeryfrac>>4) - FixedMul (worldhigh, rw_scale);
|
||||
pixhighstep = -FixedMul (rw_scalestep,worldhigh);
|
||||
fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldhighslope, ds_p->scale2);
|
||||
|
||||
if (backsector->c_slope) {
|
||||
fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldhighslope, ds_p->scale2);
|
||||
pixhighstep = (topfracend-pixhigh)/(range);
|
||||
}
|
||||
pixhigh = (centeryfrac>>4) - FixedMul (worldhigh, rw_scale);
|
||||
pixhighstep = (topfracend-pixhigh)/(range);
|
||||
|
||||
// If the lowest part of a ceiling stretching down covers the entire screen
|
||||
if (min(pixhigh, topfracend)>>HEIGHTBITS >= viewheight-1)
|
||||
g_walloffscreen = true;
|
||||
}
|
||||
|
||||
if (bottomtexture)
|
||||
{
|
||||
fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldlowslope, ds_p->scale2);
|
||||
|
||||
pixlow = (centeryfrac>>4) - FixedMul (worldlow, rw_scale);
|
||||
pixlowstep = -FixedMul (rw_scalestep,worldlow);
|
||||
if (backsector->f_slope) {
|
||||
fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldlowslope, ds_p->scale2);
|
||||
pixlowstep = (bottomfracend-pixlow)/(range);
|
||||
}
|
||||
pixlowstep = (bottomfracend-pixlow)/(range);
|
||||
|
||||
// If the highest part of a floor stretching up covers the entire screen
|
||||
if ((max(pixlow, bottomfracend)+HEIGHTUNIT-1)>>HEIGHTBITS <= 0)
|
||||
g_walloffscreen = true;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user