mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03: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:
@@ -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 )
|
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 };
|
SDL_Rect rect = { Sint16(x), Sint16(y), sprites_rect.w, sprites_rect.h };
|
||||||
setcolreal(getRGB(r,g,b));
|
setcolreal(getRGB(r,g,b));
|
||||||
BlitSurfaceColoured(sprites[t], NULL, backBuffer, &rect, ct);
|
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)
|
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 };
|
SDL_Rect rect = { Sint16(x), Sint16(y), sprites_rect.w, sprites_rect.h };
|
||||||
setcolreal(c);
|
setcolreal(c);
|
||||||
BlitSurfaceColoured(sprites[t], NULL, backBuffer, &rect, ct);
|
BlitSurfaceColoured(sprites[t], NULL, backBuffer, &rect, ct);
|
||||||
|
|||||||
Reference in New Issue
Block a user