Map now brings back wall light.
This commit is contained in:
parent
435ad8f237
commit
1fab1d2d6d
1 changed files with 17 additions and 14 deletions
15
map.cpp
15
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) {
|
void Map::render_light(LightSource source, Point at) {
|
||||||
|
const int UNPATH = $limit;
|
||||||
Point min, max;
|
Point min, max;
|
||||||
light_box(source, at, min, max);
|
light_box(source, at, min, max);
|
||||||
clear_light_target(at);
|
clear_light_target(at);
|
||||||
|
vector<Point> has_light;
|
||||||
|
|
||||||
for(size_t x = min.x; x <= max.x; ++x) {
|
for(size_t x = min.x; x <= max.x; ++x) {
|
||||||
for(size_t y = min.y; y <= max.y; ++y) {
|
for(size_t y = min.y; y <= max.y; ++y) {
|
||||||
|
if($paths[y][x] != UNPATH) {
|
||||||
$lightmap[y][x] = light_level(source.strength, x, y);
|
$lightmap[y][x] = light_level(source.strength, x, y);
|
||||||
|
has_light.push_back({x,y});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
const int UNPATH = game_map.limit();
|
|
||||||
|
|
||||||
|
const int wall_light = source.strength+3;
|
||||||
for(auto point : has_light) {
|
for(auto point : has_light) {
|
||||||
for(int i = -1; i <= 1; i++) {
|
for(int i = -1; i <= 1; i++) {
|
||||||
for(int j = -1; j <= 1; j++) {
|
for(int j = -1; j <= 1; j++) {
|
||||||
if(!game_map.inmap(point.x+i, point.y+j)) continue;
|
if(!inmap(point.x+i, point.y+j)) continue;
|
||||||
|
|
||||||
if(paths[point.y+j][point.x+i] == UNPATH) {
|
if($paths[point.y+j][point.x+i] == UNPATH) {
|
||||||
lightmap[point.y+j][point.x+i] = lighting::MAX;
|
$lightmap[point.y+j][point.x+i] = light_level(wall_light, point.x, point.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue