… | |
… | |
94 | |
94 | |
95 | void |
95 | void |
96 | init_block (void) |
96 | init_block (void) |
97 | { |
97 | { |
98 | int x, y, dx, dy, i; |
98 | int x, y, dx, dy, i; |
99 | static int block_x[3] = { -1, -1, 0 }, block_y[3] = |
99 | static int block_x[3] = { -1, -1, 0 }, |
100 | { |
100 | block_y[3] = { -1, 0, -1 }; |
101 | -1, 0, -1}; |
|
|
102 | |
101 | |
103 | for (x = 0; x < MAP_CLIENT_X; x++) |
102 | for (x = 0; x < MAP_CLIENT_X; x++) |
104 | for (y = 0; y < MAP_CLIENT_Y; y++) |
103 | for (y = 0; y < MAP_CLIENT_Y; y++) |
105 | { |
|
|
106 | block[x][y].index = 0; |
104 | block[x][y].index = 0; |
107 | } |
|
|
108 | |
105 | |
109 | |
106 | |
110 | /* The table should be symmetric, so only do the upper left |
107 | /* The table should be symmetric, so only do the upper left |
111 | * quadrant - makes the processing easier. |
108 | * quadrant - makes the processing easier. |
112 | */ |
109 | */ |
… | |
… | |
129 | /* For simplicity, we mirror the coordinates to block the other |
126 | /* For simplicity, we mirror the coordinates to block the other |
130 | * quadrants. |
127 | * quadrants. |
131 | */ |
128 | */ |
132 | set_block (x, y, dx, dy); |
129 | set_block (x, y, dx, dy); |
133 | if (x == MAP_CLIENT_X / 2) |
130 | if (x == MAP_CLIENT_X / 2) |
134 | { |
|
|
135 | set_block (x, MAP_CLIENT_Y - y - 1, dx, MAP_CLIENT_Y - dy - 1); |
131 | set_block (x, MAP_CLIENT_Y - y - 1, dx, MAP_CLIENT_Y - dy - 1); |
136 | } |
|
|
137 | else if (y == MAP_CLIENT_Y / 2) |
132 | else if (y == MAP_CLIENT_Y / 2) |
138 | { |
|
|
139 | set_block (MAP_CLIENT_X - x - 1, y, MAP_CLIENT_X - dx - 1, dy); |
133 | set_block (MAP_CLIENT_X - x - 1, y, MAP_CLIENT_X - dx - 1, dy); |
140 | } |
|
|
141 | } |
134 | } |
142 | else |
135 | else |
143 | { |
136 | { |
144 | float d1, r, s, l; |
137 | float d1, r, s, l; |
145 | |
138 | |
… | |
… | |
179 | * that if some particular space is blocked, it blocks |
172 | * that if some particular space is blocked, it blocks |
180 | * the view of the spaces 'behind' it, and those blocked |
173 | * the view of the spaces 'behind' it, and those blocked |
181 | * spaces behind it may block other spaces, etc. |
174 | * spaces behind it may block other spaces, etc. |
182 | * In this way, the chain of visibility is set. |
175 | * In this way, the chain of visibility is set. |
183 | */ |
176 | */ |
184 | |
|
|
185 | static void |
177 | static void |
186 | set_wall (object *op, int x, int y) |
178 | set_wall (object *op, int x, int y) |
187 | { |
179 | { |
188 | int i; |
180 | int i; |
189 | |
181 | |