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,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 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. |
10 | * |
10 | * |
11 | * This program is distributed in the hope that it will be useful, |
11 | * This program is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. |
14 | * GNU General Public License for more details. |
15 | * |
15 | * |
16 | * You should have received a copy of the Affero GNU General Public License |
16 | * You should have received a copy of the Affero GNU General Public License |
17 | * and the GNU General Public License along with this program. If not, see |
17 | * and the GNU General Public License along with this program. If not, see |
18 | * <http://www.gnu.org/licenses/>. |
18 | * <http://www.gnu.org/licenses/>. |
19 | * |
19 | * |
20 | * The authors can be reached via e-mail to <support@deliantra.net> |
20 | * The authors can be reached via e-mail to <support@deliantra.net> |
21 | */ |
21 | */ |
22 | |
22 | |
23 | #include <global.h> |
23 | #include <global.h> |
24 | #include <cmath> |
24 | #include <cmath> |
… | |
… | |
51 | |
51 | |
52 | // temporary storage for the los algorithm, |
52 | // temporary storage for the los algorithm, |
53 | // one los_info for each lightable map space |
53 | // one los_info for each lightable map space |
54 | static los_info los[MAP_CLIENT_X][MAP_CLIENT_Y]; |
54 | static los_info los[MAP_CLIENT_X][MAP_CLIENT_Y]; |
55 | |
55 | |
56 | struct point |
56 | struct point8 |
57 | { |
57 | { |
58 | sint8 x, y; |
58 | sint8 x, y; |
59 | }; |
59 | }; |
60 | |
60 | |
61 | // minimum size, but must be a power of two |
61 | // minimum size, but must be a power of two |
62 | #define QUEUE_LENGTH ((MAP_CLIENT_X + MAP_CLIENT_Y) * 2) |
62 | #define QUEUE_LENGTH ((MAP_CLIENT_X + MAP_CLIENT_Y) * 2) |
63 | |
63 | |
64 | // a queue of spaces to calculate |
64 | // a queue of spaces to calculate |
65 | static point queue [QUEUE_LENGTH]; |
65 | static point8 queue [QUEUE_LENGTH]; |
66 | static int q1, q2; // queue start, end |
66 | static int q1, q2; // queue start, end |
67 | |
67 | |
68 | /* |
68 | /* |
69 | * Clears/initialises the los-array associated to the player |
69 | * Clears/initialises the los-array associated to the player |
70 | * controlling the object. |
70 | * controlling the object. |