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.
This commit is contained in:
Camden Dixie O'Brien 2025-01-02 15:41:02 +00:00
parent bbaf58869a
commit e7e1b40dd9

View File

@ -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) {