1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * |
5 | * |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
7 | * the terms of the Affero GNU General Public License as published by the |
7 | * the terms of the Affero GNU General Public License as published by the |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
9 | * option) any later version. |
9 | * option) any later version. |
… | |
… | |
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 | ); |