From 05e381ff6ddd123283d5750e856ed15c68bbc223 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 31 Dec 2019 19:50:27 +0100 Subject: [PATCH] - fixed screen clearing for the automap. This should only affect the active window, not the entire screen. --- source/blood/src/map2d.cpp | 4 +++- source/build/src/engine.cpp | 2 +- source/common/2d/v_2ddrawer.cpp | 9 ++++----- source/common/2d/v_2ddrawer.h | 5 +++-- source/rr/src/screens.cpp | 1 + source/sw/src/draw.cpp | 3 ++- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/source/blood/src/map2d.cpp b/source/blood/src/map2d.cpp index e8532289c..50ce97e98 100644 --- a/source/blood/src/map2d.cpp +++ b/source/blood/src/map2d.cpp @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "map2d.h" #include "trig.h" #include "view.h" +#include "v_2ddrawer.h" BEGIN_BLD_NS @@ -194,7 +195,8 @@ void CViewMap::sub_25C74(void) viewResizeView(3); tm = 1; } - videoClearScreen(0); + // only clear the actual window. + twod->AddColorOnlyQuad(windowxy1.x, windowxy1.y, windowxy2.x - windowxy1.x + 1, windowxy2.y - windowxy1.y - 1, 0xff000000); renderDrawMapView(x,y,nZoom>>2,angle); sub_2541C(x,y,nZoom>>2,angle); const char *pTitle = levelGetTitle(); diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 94016a9f5..4148f8843 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -8283,7 +8283,7 @@ static void renderFillPolygon(int32_t npoints) ytex.Y = ((float)y2) * (-1.f / 4294967296.f); otex.X = (fxdim * xtex.X + fydim * ytex.X) * -0.5f + fglobalposx * (1.f / 4294967296.f); otex.Y = (fxdim * xtex.Y + fydim * ytex.Y) * -0.5f - fglobalposy * (1.f / 4294967296.f); - twod->FillPolygon(rx1, ry1, xb1, npoints, globalpicnum, globalpal, globalshade, globalorientation, xtex, ytex, otex); + twod->FillPolygon(rx1, ry1, xb1, npoints, globalpicnum, globalpal, globalshade, globalorientation, xtex, ytex, otex, windowxy1.x, windowxy1.y, windowxy2.x, windowxy2.y); } // diff --git a/source/common/2d/v_2ddrawer.cpp b/source/common/2d/v_2ddrawer.cpp index 02ce64ee1..e88f5bea9 100644 --- a/source/common/2d/v_2ddrawer.cpp +++ b/source/common/2d/v_2ddrawer.cpp @@ -716,13 +716,12 @@ void F2DDrawer::rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16 // //========================================================================== -void F2DDrawer::AddPoly(FTexture* img, FVector4* vt, size_t vtcount, unsigned int* ind, size_t idxcount, int palette, int shade, int maskprops) +void F2DDrawer::AddPoly(FTexture* img, FVector4* vt, size_t vtcount, unsigned int* ind, size_t idxcount, int palette, int shade, int maskprops, int clipx1, int clipy1, int clipx2, int clipy2) { RenderCommand dg = {}; int method = 0; dg.mType = DrawTypeRotateSprite; -#if 0 if (clipx1 > 0 || clipy1 > 0 || clipx2 < screen->GetWidth() - 1 || clipy2 < screen->GetHeight() - 1) { dg.mScissor[0] = clipx1; @@ -731,7 +730,6 @@ void F2DDrawer::AddPoly(FTexture* img, FVector4* vt, size_t vtcount, unsigned in dg.mScissor[3] = clipy2 + 1; dg.mFlags |= DTF_Scissor; } -#endif PalEntry p = 0xffffffff; if (maskprops > DAMETH_MASK) @@ -770,7 +768,8 @@ void F2DDrawer::AddPoly(FTexture* img, FVector4* vt, size_t vtcount, unsigned in // //========================================================================== -void F2DDrawer::FillPolygon(int *rx1, int *ry1, int *xb1, int32_t npoints, int picnum, int palette, int shade, int props, const FVector2& xtex, const FVector2& ytex, const FVector2 &otex) +void F2DDrawer::FillPolygon(int *rx1, int *ry1, int *xb1, int32_t npoints, int picnum, int palette, int shade, int props, const FVector2& xtex, const FVector2& ytex, const FVector2 &otex, + int clipx1, int clipy1, int clipx2, int clipy2) { //Convert int32_t to float (in-place) TArray points(npoints, true); @@ -821,7 +820,7 @@ void F2DDrawer::FillPolygon(int *rx1, int *ry1, int *xb1, int32_t npoints, int p } } - AddPoly(TileFiles.tiles[picnum], points.Data(), points.Size(), indices.data(), indices.size(), palette, shade, (props >> 7)& DAMETH_MASKPROPS); + AddPoly(TileFiles.tiles[picnum], points.Data(), points.Size(), indices.data(), indices.size(), palette, shade, (props >> 7)& DAMETH_MASKPROPS, clipx1, clipy1, clipx2, clipy2); } diff --git a/source/common/2d/v_2ddrawer.h b/source/common/2d/v_2ddrawer.h index ea937f9fb..8db1d8e7c 100644 --- a/source/common/2d/v_2ddrawer.h +++ b/source/common/2d/v_2ddrawer.h @@ -127,8 +127,9 @@ public: public: void AddTexture(FTexture *img, DrawParms &parms); - void AddPoly(FTexture* img, FVector4 *vt, size_t vtcount, unsigned int *ind, size_t idxcount, int palette, int shade, int maskprops); - void FillPolygon(int* rx1, int* ry1, int* xb1, int32_t npoints, int picnum, int palette, int shade, int props, const FVector2& xtex, const FVector2& ytex, const FVector2& otex); + void AddPoly(FTexture* img, FVector4 *vt, size_t vtcount, unsigned int *ind, size_t idxcount, int palette, int shade, int maskprops, int clipx1, int clipy1, int clipx2, int clipy2); + void FillPolygon(int* rx1, int* ry1, int* xb1, int32_t npoints, int picnum, int palette, int shade, int props, const FVector2& xtex, const FVector2& ytex, const FVector2& otex, + int clipx1, int clipy1, int clipx2, int clipy2); void AddFlatFill(int left, int top, int right, int bottom, FTexture *src, bool local_origin); void AddColorOnlyQuad(int left, int top, int width, int height, PalEntry color, FRenderStyle *style = nullptr); diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index 92ee6d1ef..b9ac73d43 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -929,6 +929,7 @@ void G_DisplayRest(int32_t smoothratio) if (ud.overhead_on == 2) { twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000); + G_DrawBackground(); renderDrawMapView(cposx, cposy, pp->zoom, cang); } G_DrawOverheadMap(cposx, cposy, pp->zoom, cang); diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 6dffcd7c6..ce2b38c7b 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -2271,7 +2271,8 @@ drawscreen(PLAYERp pp) if (dimensionmode == 6) { - twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000); + // only clear the actual window. + twod->AddColorOnlyQuad(windowxy1.x, windowxy1.y, windowxy2.x - windowxy1.x + 1, windowxy2.y - windowxy1.y - 1, 0xff000000); renderDrawMapView(tx, ty, zoom, tang); }