| 250 | |
| 251 | #ifdef DEBUG |
| 252 | void CLevelGraph::draw_covers() |
| 253 | { |
| 254 | float half_size = ai().level_graph().header().cell_size() * .5f; |
| 255 | xr_vector<CCoverPoint*> nearest; |
| 256 | nearest.reserve(1000); |
| 257 | ai().cover_manager().covers().nearest(Device.vCameraPosition, 5.f, nearest); |
| 258 | xr_vector<CCoverPoint*>::const_iterator I = nearest.begin(); |
| 259 | xr_vector<CCoverPoint*>::const_iterator E = nearest.end(); |
| 260 | for (; I != E; ++I) |
| 261 | { |
| 262 | // high |
| 263 | Fvector position = (*I)->position(); |
| 264 | position.y += 1.f; |
| 265 | Level().debug_renderer().draw_aabb(position, half_size - .01f, 1.f, ai().level_graph().header().cell_size() * .5f - .01f, D3DCOLOR_XRGB(0 * 255, 255, 0 * 255)); |
| 266 | |
| 267 | CVertex* v = vertex((*I)->level_vertex_id()); |
| 268 | Fvector direction; |
| 269 | float best_value = -1.f; |
| 270 | |
| 271 | for (u32 i = 0, j = 0; i < 36; ++i) |
| 272 | { |
| 273 | float value = high_cover_in_direction(float(10 * i) / 180.f * PI, v); |
| 274 | direction.setHP(float(10 * i) / 180.f * PI, 0); |
| 275 | direction.normalize(); |
| 276 | direction.mul(value * half_size); |
| 277 | direction.add(position); |
| 278 | direction.y = position.y; |
| 279 | Level().debug_renderer().draw_line(Fidentity, position, direction, D3DCOLOR_XRGB(0, 0, 255)); |
| 280 | value = compute_high_square(float(10 * i) / 180.f * PI, PI / 2.f, v); |
| 281 | if (value > best_value) |
| 282 | { |
| 283 | best_value = value; |
| 284 | j = i; |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | direction.set(position.x - half_size * float(v->high_cover(0)) / 15.f, position.y, position.z); |
| 289 | Level().debug_renderer().draw_line(Fidentity, position, direction, D3DCOLOR_XRGB(255, 0, 0)); |
| 290 | |
| 291 | direction.set(position.x, position.y, position.z + half_size * float(v->high_cover(1)) / 15.f); |
| 292 | Level().debug_renderer().draw_line(Fidentity, position, direction, D3DCOLOR_XRGB(255, 0, 0)); |
| 293 | |
| 294 | direction.set(position.x + half_size * float(v->high_cover(2)) / 15.f, position.y, position.z); |
| 295 | Level().debug_renderer().draw_line(Fidentity, position, direction, D3DCOLOR_XRGB(255, 0, 0)); |
| 296 | |
| 297 | direction.set(position.x, position.y, position.z - half_size * float(v->high_cover(3)) / 15.f); |
| 298 | Level().debug_renderer().draw_line(Fidentity, position, direction, D3DCOLOR_XRGB(255, 0, 0)); |
| 299 | |
| 300 | float value = high_cover_in_direction(float(10 * j) / 180.f * PI, v); |
| 301 | direction.setHP(float(10 * j) / 180.f * PI, 0); |
| 302 | direction.normalize(); |
| 303 | direction.mul(value * half_size); |
| 304 | direction.add(position); |
| 305 | direction.y = position.y; |
| 306 | Level().debug_renderer().draw_line(Fidentity, position, direction, D3DCOLOR_XRGB(0, 0, 0)); |
| 307 | |
| 308 | // low |
| 309 | position = (*I)->position(); |
nothing calls this directly
no test coverage detected