| 342 | } |
| 343 | |
| 344 | static bool find_drop_off() |
| 345 | { |
| 346 | S32 idx = -1; |
| 347 | F32 closest = SQR(shared.hook->asset->detach.dist); |
| 348 | for (S32 i = 0; i < shared.drop_cache_size; ++i) |
| 349 | { |
| 350 | xVec3 d = shared.drop_marker_cache[i]->pos - shared.hook_loc; |
| 351 | F32 len2 = d.length2(); |
| 352 | if (len2 >= closest) |
| 353 | { |
| 354 | continue; |
| 355 | } |
| 356 | idx = i; |
| 357 | closest = len2; |
| 358 | } |
| 359 | |
| 360 | if (idx != -1) |
| 361 | { |
| 362 | shared.drop_loc = shared.drop_marker_cache[idx]->pos; |
| 363 | shared.drop_set_view_angle = shared.drop_cache[idx]->set_view_angle; |
| 364 | shared.drop_view_angle = shared.drop_cache[idx]->view_angle; |
| 365 | return true; |
| 366 | } |
| 367 | return false; |
| 368 | } |
| 369 | static void trigger(U32 toEvent) |
| 370 | { |
| 371 | zEntEvent(shared.hook, shared.hook, toEvent); |