Map now brings back wall light.

main
Zed A. Shaw 7 days ago
parent 435ad8f237
commit 1fab1d2d6d
  1. 35
      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<Point> 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;
if(paths[point.y+j][point.x+i] == UNPATH) {
lightmap[point.y+j][point.x+i] = lighting::MAX;
}
}
}
}
*/
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] = light_level(wall_light, point.x, point.y);
}
}
}
}
}

Loading…
Cancel
Save