From 1fab1d2d6d8416453300fcf999d077358aa9ef22 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Thu, 28 Nov 2024 03:13:48 -0500 Subject: [PATCH] Map now brings back wall light. --- map.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/map.cpp b/map.cpp index 8bb4bfd..a27f71c 100644 --- a/map.cpp +++ b/map.cpp @@ -409,29 +409,32 @@ int Map::light_level(int level, size_t x, size_t y) { } void Map::render_light(LightSource source, Point at) { + const int UNPATH = $limit; Point min, max; light_box(source, at, min, max); clear_light_target(at); + vector has_light; for(size_t x = min.x; x <= max.x; ++x) { for(size_t y = min.y; y <= max.y; ++y) { - $lightmap[y][x] = light_level(source.strength, x, y); + if($paths[y][x] != UNPATH) { + $lightmap[y][x] = light_level(source.strength, x, y); + has_light.push_back({x,y}); + } } } - /* - const int UNPATH = game_map.limit(); - for(auto point : has_light) { - for(int i = -1; i <= 1; i++) { - for(int j = -1; j <= 1; j++) { - if(!game_map.inmap(point.x+i, point.y+j)) continue; + const int wall_light = source.strength+3; + for(auto point : has_light) { + for(int i = -1; i <= 1; i++) { + for(int j = -1; j <= 1; j++) { + if(!inmap(point.x+i, point.y+j)) continue; - if(paths[point.y+j][point.x+i] == UNPATH) { - lightmap[point.y+j][point.x+i] = lighting::MAX; - } - } - } - } - */ + if($paths[point.y+j][point.x+i] == UNPATH) { + $lightmap[point.y+j][point.x+i] = light_level(wall_light, point.x, point.y); + } + } + } + } }