1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-15 23:49:42 +01:00

Add bounds checks to drawforetile/drawforetile2/drawforetile3

When I was writing the previous commit I noticed that these functions
didn't have bounds checks, which is a bit bad. So I added them.
This commit is contained in:
Misa 2020-06-30 11:51:01 -07:00 committed by Ethan Lee
parent e84194db55
commit d610e2dae3

View file

@ -3110,6 +3110,11 @@ void Graphics::setcolreal(Uint32 t)
void Graphics::drawforetile(int x, int y, int t)
{
if (!INBOUNDS(t, tiles))
{
return;
}
SDL_Rect rect;
setRect(rect, x,y,tiles_rect.w, tiles_rect.h);
@ -3128,6 +3133,11 @@ void Graphics::drawforetile(int x, int y, int t)
void Graphics::drawforetile2(int x, int y, int t)
{
if (!INBOUNDS(t, tiles2))
{
return;
}
SDL_Rect rect;
setRect(rect, x,y,tiles_rect.w, tiles_rect.h);
@ -3146,9 +3156,14 @@ void Graphics::drawforetile2(int x, int y, int t)
void Graphics::drawforetile3(int x, int y, int t, int off)
{
t += off * 30;
if (!INBOUNDS(t, tiles3))
{
return;
}
SDL_Rect rect;
setRect(rect, x,y,tiles_rect.w, tiles_rect.h);
BlitSurfaceStandard(tiles3[t+(off*30)],NULL, foregroundBuffer, &rect );
BlitSurfaceStandard(tiles3[t],NULL, foregroundBuffer, &rect );
}
void Graphics::drawrect(int x, int y, int w, int h, int r, int g, int b)