… | |
… | |
1794 | * other side of a wall (!). |
1794 | * other side of a wall (!). |
1795 | */ |
1795 | */ |
1796 | int |
1796 | int |
1797 | stand_in_light (object *op) |
1797 | stand_in_light (object *op) |
1798 | { |
1798 | { |
1799 | if (!op) |
1799 | if (op) |
1800 | return 0; |
1800 | { |
1801 | |
|
|
1802 | if (op->glow_radius > 0) |
1801 | if (op->glow_radius > 0) |
1803 | return 1; |
1802 | return 1; |
1804 | |
1803 | |
1805 | if (op->map) |
1804 | if (op->map) |
1806 | { |
1805 | unordered_mapwalk (op, -MAX_LIGHT_RADIUS, -MAX_LIGHT_RADIUS, MAX_LIGHT_RADIUS, MAX_LIGHT_RADIUS) |
|
|
1806 | { |
1807 | /* Check the spaces with the max light radius to see if any of them |
1807 | /* Check the spaces with the max light radius to see if any of them |
1808 | * have lights, and if any of them light the player enough, then return 1. |
1808 | * have lights, and if any of them light the player enough, then return 1. |
1809 | */ |
|
|
1810 | for (int x = op->x - MAX_LIGHT_RADIUS; x <= op->x + MAX_LIGHT_RADIUS; x++) |
|
|
1811 | { |
|
|
1812 | for (int y = op->y - MAX_LIGHT_RADIUS; y <= op->y + MAX_LIGHT_RADIUS; y++) |
|
|
1813 | { |
1809 | */ |
1814 | maptile *m = op->map; |
1810 | int light = m->at (nx, ny).light; |
1815 | sint16 nx = x; |
|
|
1816 | sint16 ny = y; |
|
|
1817 | |
1811 | |
1818 | if (xy_normalise (m, nx, ny)) |
1812 | if (expect_false (light > 0) && idistance (dx, dy) <= light) |
1819 | if (idistance (x - op->x, y - op->y) < m->at (nx, ny).light) |
|
|
1820 | return 1; |
1813 | return 1; |
1821 | } |
1814 | } |
1822 | } |
|
|
1823 | } |
1815 | } |
1824 | |
1816 | |
1825 | return 0; |
1817 | return 0; |
1826 | } |
1818 | } |
1827 | |
1819 | |