… | |
… | |
22 | */ |
22 | */ |
23 | |
23 | |
24 | #include <global.h> |
24 | #include <global.h> |
25 | #include <cmath> |
25 | #include <cmath> |
26 | |
26 | |
27 | #define SEE_IN_DARK_RADIUS 3 |
27 | #define SEE_IN_DARK_RADIUS 2 |
28 | |
28 | |
29 | // los flags |
29 | // los flags |
30 | enum { |
30 | enum { |
31 | FLG_XI = 0x01, // we have an x-parent |
31 | FLG_XI = 0x01, // we have an x-parent |
32 | FLG_YI = 0x02, // we have an y-parent |
32 | FLG_YI = 0x02, // we have an y-parent |
… | |
… | |
266 | if (dx <= 0) enqueue (dx - 1, dy, FLG_XI); |
266 | if (dx <= 0) enqueue (dx - 1, dy, FLG_XI); |
267 | if (dy >= 0) enqueue (dx, dy + 1, FLG_YI); |
267 | if (dy >= 0) enqueue (dx, dy + 1, FLG_YI); |
268 | if (dy <= 0) enqueue (dx, dy - 1, FLG_YI); |
268 | if (dy <= 0) enqueue (dx, dy - 1, FLG_YI); |
269 | } |
269 | } |
270 | } |
270 | } |
271 | } |
|
|
272 | |
|
|
273 | /* returns true if op carries one or more lights |
|
|
274 | * This is a trivial function now days, but it used to |
|
|
275 | * be a bit longer. Probably better for callers to just |
|
|
276 | * check the op->glow_radius instead of calling this. |
|
|
277 | */ |
|
|
278 | int |
|
|
279 | has_carried_lights (const object *op) |
|
|
280 | { |
|
|
281 | /* op may glow! */ |
|
|
282 | if (op->glow_radius > 0) |
|
|
283 | return 1; |
|
|
284 | |
|
|
285 | return 0; |
|
|
286 | } |
271 | } |
287 | |
272 | |
288 | /* radius, distance => lightness adjust */ |
273 | /* radius, distance => lightness adjust */ |
289 | static sint8 light_atten[MAX_LIGHT_RADIUS * 2 + 1][MAX_LIGHT_RADIUS * 3 / 2 + 1]; |
274 | static sint8 light_atten[MAX_LIGHT_RADIUS * 2 + 1][MAX_LIGHT_RADIUS * 3 / 2 + 1]; |
290 | static sint8 vision_atten[MAX_DARKNESS + SEE_IN_DARK_RADIUS + 1][(MAX_DARKNESS + SEE_IN_DARK_RADIUS) * 3 / 2 + 1]; |
275 | static sint8 vision_atten[MAX_DARKNESS + SEE_IN_DARK_RADIUS + 1][(MAX_DARKNESS + SEE_IN_DARK_RADIUS) * 3 / 2 + 1]; |