1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 06:28:30 +02:00

Add bounds checks to both versions of Graphics::drawsprite()

For some reason, I forgot to add bounds checks to these functions. Well,
I'm glad I caught it, anyways.
This commit is contained in:
Misa 2020-09-09 22:35:35 -07:00 committed by Ethan Lee
parent 76d6a3536b
commit 140861a79d

View File

@ -622,6 +622,11 @@ void Graphics::printcrewnamestatus( int x, int y, int t )
void Graphics::drawsprite( int x, int y, int t, int r, int g, int b )
{
if (!INBOUNDS_VEC(t, sprites))
{
WHINE_ONCE("drawsprite() out-of-bounds!");
}
SDL_Rect rect = { Sint16(x), Sint16(y), sprites_rect.w, sprites_rect.h };
setcolreal(getRGB(r,g,b));
BlitSurfaceColoured(sprites[t], NULL, backBuffer, &rect, ct);
@ -629,6 +634,11 @@ void Graphics::drawsprite( int x, int y, int t, int r, int g, int b )
void Graphics::drawsprite(int x, int y, int t, Uint32 c)
{
if (!INBOUNDS_VEC(t, sprites))
{
WHINE_ONCE("drawsprite() out-of-bounds!");
}
SDL_Rect rect = { Sint16(x), Sint16(y), sprites_rect.w, sprites_rect.h };
setcolreal(c);
BlitSurfaceColoured(sprites[t], NULL, backBuffer, &rect, ct);