From bb020c15f1eb652806867aafb87a547a0485b6b0 Mon Sep 17 00:00:00 2001 From: NY00123 Date: Mon, 6 Jan 2020 22:07:41 +0200 Subject: [PATCH] PCExhumed: Further improve the widescreen fix for the smoke in menu_DrawTheMap. rotatesprite is now directly called, instead of going through the overwritesprite wrapper, in order to trim the smoke sprites, so they don't leave the map's boundaries in widescreen. A technical side-effect is that picanm[tilenum].sf is not temporarily set to 0, as done in overwritesprite. The call to videoClearScreen is still required, in case the console is shown and then hidden. It's now called after HandleAsync, just for the sake of it (less useful in case of quit, and maybe also in another scenario). --- source/exhumed/src/menu.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/source/exhumed/src/menu.cpp b/source/exhumed/src/menu.cpp index ad8b2ee59..56929e5d1 100644 --- a/source/exhumed/src/menu.cpp +++ b/source/exhumed/src/menu.cpp @@ -669,12 +669,23 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest) int runtimer = (int)totalclock; + // Trim smoke in widescreen + vec2_t mapwinxy1 = windowxy1, mapwinxy2 = windowxy2; + int32_t width = mapwinxy2.x - mapwinxy1.x + 1, height = mapwinxy2.y - mapwinxy1.y + 1; + if (3 * width > 4 * height) + { + mapwinxy1.x += (width - 4 * height / 3) / 2; + mapwinxy2.x -= (width - 4 * height / 3) / 2; + } + // User has 12 seconds to do something on the map screen before loading the current level while (nIdleSeconds < 12) { HandleAsync(); twod->ClearScreen(); + videoClearScreen(overscanindex); // fix hall of mirrors when console renders offscreen in widescreen resolutions. + if (((int)totalclock - startTime) / kTimerTicks) { nIdleSeconds++; @@ -711,7 +722,10 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest) int smokeX = MapLevelFires[i].fires[j].xPos + FireTiles[nFireType][nFireFrame].xOffs; int smokeY = MapLevelFires[i].fires[j].yPos + FireTiles[nFireType][nFireFrame].yOffs + curYPos + screenY; - overwritesprite(smokeX, smokeY, nTile, 0, 2, kPalNormal); + // Use rotatesprite to trim smoke in widescreen + rotatesprite(smokeX << 16, smokeY << 16, 65536L, 0, + nTile, 0, kPalNormal, 16 + 2, mapwinxy1.x, mapwinxy1.y, mapwinxy2.x, mapwinxy2.y); +// overwritesprite(smokeX, smokeY, nTile, 0, 2, kPalNormal); } }