mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-22 08:49:46 +01:00
Fix the 2nd to 4th tiles of moving plats rendering offset from 1st tile
This commit fixes a bug where the second, third, and fourth tiles of moving platforms would render offset from the first tile if the moving platform hit the top or left edge of the screen. This is due to the fact that SDL_BlitSurface() will end up changing the coordinates of the rectangle we pass to it to be 0 if they're negative, but only after it's already been drawn. Previously, we kept re-using the same rectangle each time we drew each segment of the moving platform, but since it only changes the draw rectangle after it's already been drawn, the first tile shows up fine, but not the rest of the tiles, hence resulting in an offset. To fix this, we do the same thing as we did for drawing the "really big sprite" (size-type 9): just reset the rectangle we use every time we draw a segment of the moving platform.
This commit is contained in:
parent
da612de1f4
commit
a60cdb3ab7
1 changed files with 4 additions and 4 deletions
|
@ -1532,9 +1532,6 @@ void Graphics::drawentities()
|
||||||
// Special: Moving platform, 4 tiles or 8 tiles
|
// Special: Moving platform, 4 tiles or 8 tiles
|
||||||
tpoint.x = obj.entities[i].xp;
|
tpoint.x = obj.entities[i].xp;
|
||||||
tpoint.y = obj.entities[i].yp;
|
tpoint.y = obj.entities[i].yp;
|
||||||
drawRect = tiles_rect;
|
|
||||||
drawRect.x += tpoint.x;
|
|
||||||
drawRect.y += tpoint.y;
|
|
||||||
int thiswidth = 4;
|
int thiswidth = 4;
|
||||||
if (obj.entities[i].size == 8)
|
if (obj.entities[i].size == 8)
|
||||||
{
|
{
|
||||||
|
@ -1542,8 +1539,11 @@ void Graphics::drawentities()
|
||||||
}
|
}
|
||||||
for (int ii = 0; ii < thiswidth; ii++)
|
for (int ii = 0; ii < thiswidth; ii++)
|
||||||
{
|
{
|
||||||
|
drawRect = tiles_rect;
|
||||||
|
drawRect.x += tpoint.x;
|
||||||
|
drawRect.y += tpoint.y;
|
||||||
|
drawRect.x += 8 * ii;
|
||||||
BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect);
|
||||||
drawRect.x += 8;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (obj.entities[i].size == 3) // Big chunky pixels!
|
else if (obj.entities[i].size == 3) // Big chunky pixels!
|
||||||
|
|
Loading…
Reference in a new issue