From e7e1b40dd9e7c3c7e57c174825c6e1d6f1fbfee3 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Thu, 2 Jan 2025 15:41:02 +0000 Subject: [PATCH] Take ceiling of endx and endy in mapdraw() This fixes an issue where tiles around the right and bottom edges would not be drawn when vpos was just under a tile boundary. I'm guessing it wasn't noticable before fixing the frame rate as the buggy frames were only on-screen for a hilariously short amount of time. --- game/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/game/main.c b/game/main.c index 1394757..75714a3 100644 --- a/game/main.c +++ b/game/main.c @@ -345,8 +345,8 @@ static void mapdraw(const gamestate_t *state, SDL_Renderer *renderer) { const int startx = TILESIZE * floor(state->vpos.x / TILESIZE); const int starty = TILESIZE * floor(state->vpos.y / TILESIZE); - const int endx = state->vpos.x + VIEWWIDTH; - const int endy = state->vpos.y + VIEWHEIGHT; + const int endx = ceil(state->vpos.x + VIEWWIDTH); + const int endy = ceil(state->vpos.y + VIEWHEIGHT); for (int l = 0; l < MAPNLAYERS; ++l) { for (int y = starty; y < endy; y += TILESIZE) { for (int x = startx; x < endx; x += TILESIZE) {