Skip to content

Commit 5752afd

Browse files
committed
Isometric rendering: Reduce safety margin around screen to correct values.
This may be a leftover from the static background rendering, which has redrawn the background just from time to time, not every frame. -------------------------- | | . | | / \| | < |> You can see this | \ /| | v | | | | . -------------------------- / \ | | You still need to draw these, which are mostly off screen. To be really safe, you need to find the largest tile of the tile set and do the math for that. For simplicity reasons we will treat all tiles as if they are as large as the largest tile. This addresses flareteam#1084 and brings down the number of render calls down to 1300 (2500 before) for a 640x480 window and the grassland tile set.
1 parent dead631 commit 5752afd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/MapRenderer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,11 @@ void MapRenderer::renderIsoLayer(const unsigned short layerdata[256][256]) {
310310
int_fast16_t j; // second index of the map array
311311
Rect dest;
312312
const Point upperleft = floor(screen_to_map(0, 0, shakycam.x, shakycam.y));
313-
const int_fast16_t max_tiles_width = (VIEW_W / TILE_W) + 2 * tset.max_size_x;
314-
const int_fast16_t max_tiles_height = ((2 * VIEW_H / TILE_H) + 2 * tset.max_size_y) * 2;
313+
const int_fast16_t max_tiles_width = (VIEW_W / TILE_W) + 2*tset.max_size_x;
314+
const int_fast16_t max_tiles_height = (2 * VIEW_H / TILE_H) + 2*tset.max_size_y;
315315

316-
j = upperleft.y - tset.max_size_y + tset.max_size_x;
317-
i = upperleft.x - tset.max_size_y - tset.max_size_x;
316+
j = upperleft.y - tset.max_size_y/2 + tset.max_size_x;
317+
i = upperleft.x - tset.max_size_y/2 - tset.max_size_x;
318318

319319
for (uint_fast16_t y = max_tiles_height ; y; --y) {
320320
int_fast16_t tiles_width = 0;

0 commit comments

Comments
 (0)