1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/raycastlib.git synced 2024-11-20 20:19:57 +01:00

Check screen bounds

This commit is contained in:
Miloslav Číž 2018-09-13 07:34:35 +02:00
parent 853f938521
commit 04c6040fb9

View file

@ -855,6 +855,10 @@ void drawSpriteSquare(const unsigned char *sprite, int16_t x, int16_t y, Unit de
*/
void pixelFunc(PixelInfo *pixel)
{
if (pixel->position.x < 0 || pixel->position.x >= SCREEN_WIDTH ||
pixel->position.y < 0 || pixel->position.y >= SCREEN_HEIGHT)
printf("error: writing outside screen! %d %d\n",pixel->position.x,pixel->position.y);
if (pixel->position.y == MIDDLE_ROW)
zBuffer[pixel->position.x] = pixel->depth;