… | |
… | |
128 | // spiral path algorithm below, except when very little |
128 | // spiral path algorithm below, except when very little |
129 | // area is visible, in which case it is slower. which evens |
129 | // area is visible, in which case it is slower. which evens |
130 | // out los calculation times between large and small los maps. |
130 | // out los calculation times between large and small los maps. |
131 | // apply_lights also iterates over this area, maybe these |
131 | // apply_lights also iterates over this area, maybe these |
132 | // two passes could be combined somehow. |
132 | // two passes could be combined somehow. |
133 | unordered_mapwalk (pl->viewpoint, -half_x, -half_y, half_x, half_y) |
133 | unordered_mapwalk (mapwalk_buf, pl->viewpoint, -half_x, -half_y, half_x, half_y) |
134 | { |
134 | { |
135 | los_info &l = los [LOS_X0 + dx][LOS_Y0 + dy]; |
135 | los_info &l = los [LOS_X0 + dx][LOS_Y0 + dy]; |
136 | l.flags = m->at (nx, ny).flags () & P_BLOCKSVIEW ? FLG_BLOCKED : 0; |
136 | l.flags = m->at (nx, ny).flags () & P_BLOCKSVIEW ? FLG_BLOCKED : 0; |
137 | } |
137 | } |
138 | } |
138 | } |
… | |
… | |
366 | int half_y = pl->ns->mapy / 2; |
366 | int half_y = pl->ns->mapy / 2; |
367 | |
367 | |
368 | int pass2 = 0; // negative lights have an extra pass |
368 | int pass2 = 0; // negative lights have an extra pass |
369 | |
369 | |
370 | maprect *rects = pl->viewpoint->map->split_to_tiles ( |
370 | maprect *rects = pl->viewpoint->map->split_to_tiles ( |
|
|
371 | mapwalk_buf, |
371 | pl->viewpoint->x - half_x - MAX_LIGHT_RADIUS, |
372 | pl->viewpoint->x - half_x - MAX_LIGHT_RADIUS, |
372 | pl->viewpoint->y - half_y - MAX_LIGHT_RADIUS, |
373 | pl->viewpoint->y - half_y - MAX_LIGHT_RADIUS, |
373 | pl->viewpoint->x + half_x + MAX_LIGHT_RADIUS + 1, |
374 | pl->viewpoint->x + half_x + MAX_LIGHT_RADIUS + 1, |
374 | pl->viewpoint->y + half_y + MAX_LIGHT_RADIUS + 1 |
375 | pl->viewpoint->y + half_y + MAX_LIGHT_RADIUS + 1 |
375 | ); |
376 | ); |