From c63088f28891125a17ed57ce4d259515bbbdd430 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 25 Jun 2013 17:00:40 -0700 Subject: [PATCH] Moved lightmap changes into one loop at end --- lightmap.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lightmap.cpp b/lightmap.cpp index 33def889a8ad2..abc9d62fb54fd 100644 --- a/lightmap.cpp +++ b/lightmap.cpp @@ -39,21 +39,16 @@ void map::generate_lightmap(game* g) // the lightmap when in less than total sunlight. lm[sx][sy] = natural_light; } - if (g->u.has_active_bionic("bio_night") && rl_dist(sx, sy, g->u.posx, g->u.posy) < 15) - { - lm[sx][sy] = 0; - } } } } // Apply player light sources - if (held_luminance > LIGHT_AMBIENT_LOW && !(g->u.has_active_bionic("bio_night"))) + if (held_luminance > LIGHT_AMBIENT_LOW) apply_light_source(g->u.posx, g->u.posy, held_luminance, trigdist); int flood_basalt_check = 0; // does excessive lava need high quality lighting? Nope nope nope nope for(int sx = 0; sx < LIGHTMAP_CACHE_X; ++sx) { for(int sy = 0; sy < LIGHTMAP_CACHE_Y; ++sy) { - if (!(g->u.has_active_bionic("bio_night") && rl_dist(sx, sy, g->u.posx, g->u.posy) < 15)) { const ter_id terrain = g->m.ter(sx, sy); const std::vector &items = g->m.i_at(sx, sy); const field ¤t_field = g->m.field_at(sx, sy); @@ -64,7 +59,7 @@ void map::generate_lightmap(game* g) for(int i = 0; i < 4; ++i) { if (INBOUNDS(sx + dir_x[i], sy + dir_y[i]) && g->m.is_outside(sx + dir_x[i], sy + dir_y[i])) { - if (INBOUNDS(sx, sy) && g->m.is_outside(0, 0) && !(g->u.has_active_bionic("bio_night") && rl_dist(sx, sy, g->u.posx, g->u.posy) < 15)) + if (INBOUNDS(sx, sy) && g->m.is_outside(0, 0)) lm[sx][sy] = natural_light; if (g->m.light_transparency(sx, sy) > LIGHT_TRANSPARENCY_SOLID) @@ -117,13 +112,12 @@ void map::generate_lightmap(game* g) break; } } - } } for (int i = 0; i < g->z.size(); ++i) { int mx = g->z[i].posx; int my = g->z[i].posy; - if (INBOUNDS(mx, my) && !(g->u.has_active_bionic("bio_night") && rl_dist(mx, my, g->u.posx, g->u.posy) < 15)) { + if (INBOUNDS(mx, my)) { if (g->z[i].has_effect(ME_ONFIRE)) { apply_light_source(mx, my, 3, trigdist); } @@ -167,7 +161,7 @@ void map::generate_lightmap(game* g) part != vehs[v].v->external_parts.end(); ++part) { int px = vehs[v].x + vehs[v].v->parts[*part].precalc_dx[0]; int py = vehs[v].y + vehs[v].v->parts[*part].precalc_dy[0]; - if(INBOUNDS(px, py) && !(g->u.has_active_bionic("bio_night") && rl_dist(px, py, g->u.posx, g->u.posy) < 15)) { + if(INBOUNDS(px, py)) { int dpart = vehs[v].v->part_with_feature(*part , vpf_light); if (dpart >= 0) { @@ -178,6 +172,16 @@ void map::generate_lightmap(game* g) } } } + for(int sx = 0; sx < LIGHTMAP_CACHE_X; ++sx) + { + for(int sy = 0; sy < LIGHTMAP_CACHE_Y; ++sy) + { + if (g->u.has_active_bionic("bio_night") && rl_dist(sx, sy, g->u.posx, g->u.posy) < 15) + { + lm[sx][sy] = 0; + } + } + } } lit_level map::light_at(int dx, int dy)