diff --git a/src/am_map.cpp b/src/am_map.cpp index 9292e81d9..d74927b68 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2046,7 +2046,8 @@ void AM_drawSubsectors() scale / scaley, rotation, colormap, - floorlight + floorlight, + f_y + f_h ); } } diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 6276cb49e..05cfdd0dc 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -1356,7 +1356,7 @@ void DCanvas::FinishSimplePolys() void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, double originx, double originy, double scalex, double scaley, DAngle rotation, - FDynamicColormap *colormap, int lightlevel) + FDynamicColormap *colormap, int lightlevel, int bottomclip) { #ifndef NO_SWRENDER // Use an equation similar to player sprites to determine shade @@ -1374,6 +1374,11 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, return; } + if (bottomclip <= 0) + { + bottomclip = Height; + } + // Find the extents of the polygon, in particular the highest and lowest points. for (botpt = toppt = 0, boty = topy = points[0].Y, leftx = rightx = points[0].X, i = 1; i <= npoints; ++i) { @@ -1396,7 +1401,7 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, rightx = points[i].X; } } - if (topy >= Height || // off the bottom of the screen + if (topy >= bottomclip || // off the bottom of the screen boty <= 0 || // off the top of the screen leftx >= Width || // off the right of the screen rightx <= 0) // off the left of the screen @@ -1454,13 +1459,13 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, { x = FLOAT2FIXED(points[pt1].X + 0.5f); y2 = xs_RoundToInt(points[pt2].Y + 0.5f); - if (y1 >= y2 || (y1 < 0 && y2 < 0) || (y1 >= Height && y2 >= Height)) + if (y1 >= y2 || (y1 < 0 && y2 < 0) || (y1 >= bottomclip && y2 >= bottomclip)) { } else { fixed_t xinc = FLOAT2FIXED((points[pt2].X - points[pt1].X) / (points[pt2].Y - points[pt1].Y)); - int y3 = MIN(y2, Height); + int y3 = MIN(y2, bottomclip); if (y1 < 0) { x += xinc * -y1; @@ -1485,13 +1490,13 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, { x = FLOAT2FIXED(points[pt1].X + 0.5f); y2 = xs_RoundToInt(points[pt2].Y + 0.5f); - if (y1 >= y2 || (y1 < 0 && y2 < 0) || (y1 >= Height && y2 >= Height)) + if (y1 >= y2 || (y1 < 0 && y2 < 0) || (y1 >= bottomclip && y2 >= bottomclip)) { } else { fixed_t xinc = FLOAT2FIXED((points[pt2].X - points[pt1].X) / (points[pt2].Y - points[pt1].Y)); - int y3 = MIN(y2, Height); + int y3 = MIN(y2, bottomclip); if (y1 < 0) { x += xinc * -y1; diff --git a/src/v_video.h b/src/v_video.h index 9769ce06c..cb59544e7 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -225,7 +225,7 @@ public: // Fill a simple polygon with a texture virtual void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, double originx, double originy, double scalex, double scaley, DAngle rotation, - struct FDynamicColormap *colormap, int lightlevel); + struct FDynamicColormap *colormap, int lightlevel, int bottomclip); // Set an area to a specified color virtual void Clear (int left, int top, int right, int bottom, int palcolor, uint32 color); diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index f4f0dfd56..3ede15b39 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -3120,11 +3120,16 @@ void D3DFB::FlatFill(int left, int top, int right, int bottom, FTexture *src, bo // // Here, "simple" means that a simple triangle fan can draw it. // +// Bottomclip is ignored by this implementation, since the hardware renderer +// will unconditionally draw the status bar border every frame on top of the +// polygons, so there's no need to waste time setting up a special scissor +// rectangle here and needlessly forcing separate batches. +// //========================================================================== void D3DFB::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints, double originx, double originy, double scalex, double scaley, - DAngle rotation, FDynamicColormap *colormap, int lightlevel) + DAngle rotation, FDynamicColormap *colormap, int lightlevel, int bottomclip) { // Use an equation similar to player sprites to determine shade double fadelevel = clamp((LIGHT2SHADE(lightlevel)/65536. - 12) / NUMCOLORMAPS, 0.0, 1.0); @@ -3145,7 +3150,7 @@ void D3DFB::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints, } if (In2D < 2) { - Super::FillSimplePoly(texture, points, npoints, originx, originy, scalex, scaley, rotation, colormap, lightlevel); + Super::FillSimplePoly(texture, points, npoints, originx, originy, scalex, scaley, rotation, colormap, lightlevel, bottomclip); return; } if (!InScene) diff --git a/src/win32/win32iface.h b/src/win32/win32iface.h index d30475eb3..171e0a799 100644 --- a/src/win32/win32iface.h +++ b/src/win32/win32iface.h @@ -265,7 +265,7 @@ public: void DrawPixel(int x, int y, int palcolor, uint32 rgbcolor); void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, double originx, double originy, double scalex, double scaley, - DAngle rotation, FDynamicColormap *colormap, int lightlevel); + DAngle rotation, FDynamicColormap *colormap, int lightlevel, int bottomclip) override; bool WipeStartScreen(int type); void WipeEndScreen(); bool WipeDo(int ticks);