Optimize fog of war visibility to 5x5 for enhanced gameplay and performance

This commit is contained in:
2026-06-22 19:25:16 +02:00
parent d82008dac0
commit d1bb95f166
2 changed files with 8 additions and 8 deletions
+8 -8
View File
@@ -102,17 +102,17 @@ static void draw_map(uint8_t center_x, uint8_t center_y) {
// Fill entire map with tile index 0 (completely black empty tile) // Fill entire map with tile index 0 (completely black empty tile)
memset(map_buffer, 0, sizeof(map_buffer)); memset(map_buffer, 0, sizeof(map_buffer));
int8_t start_x = center_x - 3; int8_t start_x = center_x - 2;
if (start_x < 0) start_x = 0; if (start_x < 0) start_x = 0;
int8_t end_x = center_x + 3; int8_t end_x = center_x + 2;
if (end_x >= MAP_SIZE) end_x = MAP_SIZE - 1; if (end_x >= MAP_SIZE) end_x = MAP_SIZE - 1;
int8_t start_y = center_y - 3; int8_t start_y = center_y - 2;
if (start_y < 0) start_y = 0; if (start_y < 0) start_y = 0;
int8_t end_y = center_y + 3; int8_t end_y = center_y + 2;
if (end_y >= MAP_SIZE) end_y = MAP_SIZE - 1; if (end_y >= MAP_SIZE) end_y = MAP_SIZE - 1;
// Draw logical map path tiles in the visible 7x7 window // Draw logical map path tiles in the visible 5x5 window
for (int8_t ly = start_y; ly <= end_y; ly++) { for (int8_t ly = start_y; ly <= end_y; ly++) {
for (int8_t lx = start_x; lx <= end_x; lx++) { for (int8_t lx = start_x; lx <= end_x; lx++) {
if (maze[ly][lx] == 1) { if (maze[ly][lx] == 1) {
@@ -123,8 +123,8 @@ static void draw_map(uint8_t center_x, uint8_t center_y) {
if (dy < 0) dy = -dy; if (dy < 0) dy = -dy;
int8_t dist = (dx > dy) ? dx : dy; int8_t dist = (dx > dy) ? dx : dy;
// Hide tiles at distance > 3 (Fog of War) // Hide tiles at distance > 2 (Fog of War)
if (dist > 3) continue; if (dist > 2) continue;
// Centering math for 15x15 map on 32x32 background map // Centering math for 15x15 map on 32x32 background map
int8_t iso_x = (lx - ly) * 2 + 12; int8_t iso_x = (lx - ly) * 2 + 12;
@@ -143,7 +143,7 @@ static void draw_map(uint8_t center_x, uint8_t center_y) {
// Determine variation style based on lighting distance // Determine variation style based on lighting distance
uint8_t v; uint8_t v;
if (dist == 3) { if (dist == 2) {
// Darker variants (Tile 1 Dark starting at 32, Tile 2 Dark starting at 48) // Darker variants (Tile 1 Dark starting at 32, Tile 2 Dark starting at 48)
v = is_alt ? (48 + mask) : (32 + mask); v = is_alt ? (48 + mask) : (32 + mask);
} else { } else {
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB