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).
This commit is contained in:
NY00123 2020-01-06 22:07:41 +02:00 committed by Christoph Oelckers
parent 338dcef94c
commit bb020c15f1

View file

@ -669,12 +669,23 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest)
int runtimer = (int)totalclock; 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 // User has 12 seconds to do something on the map screen before loading the current level
while (nIdleSeconds < 12) while (nIdleSeconds < 12)
{ {
HandleAsync(); HandleAsync();
twod->ClearScreen(); twod->ClearScreen();
videoClearScreen(overscanindex); // fix hall of mirrors when console renders offscreen in widescreen resolutions.
if (((int)totalclock - startTime) / kTimerTicks) if (((int)totalclock - startTime) / kTimerTicks)
{ {
nIdleSeconds++; 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 smokeX = MapLevelFires[i].fires[j].xPos + FireTiles[nFireType][nFireFrame].xOffs;
int smokeY = MapLevelFires[i].fires[j].yPos + FireTiles[nFireType][nFireFrame].yOffs + curYPos + screenY; 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);
} }
} }