| 410 | } |
| 411 | |
| 412 | bool collide_downward(xVec3& loc, xEnt*& hit, xScene& s, xEnt& ent, F32 max_dist) |
| 413 | { |
| 414 | xRay3 ray; |
| 415 | U8 old_bound_type; |
| 416 | F32 old_bound_radius; |
| 417 | xCollis coll; |
| 418 | |
| 419 | F32 f31 = get_lower_extent(ent.bound); |
| 420 | xVec3* r30 = xBoundCenter(&ent.bound); |
| 421 | |
| 422 | ray.origin = *r30; |
| 423 | ray.dir.assign(0.0f, -1.0f, 0.0f); |
| 424 | ray.min_t = 0.0f; |
| 425 | ray.max_t = max_dist + f31; |
| 426 | ray.flags = 0xC00; |
| 427 | |
| 428 | old_bound_type = ent.bound.type; |
| 429 | old_bound_radius = ent.bound.sph.r; |
| 430 | |
| 431 | ent.bound.type = XBOUND_TYPE_SPHERE; |
| 432 | ent.bound.sph.r = 0.0f; |
| 433 | |
| 434 | r30->y = FLOAT_MAX; |
| 435 | |
| 436 | coll.flags = 0x100; |
| 437 | |
| 438 | xRayHitsSceneFlags(&s, &ray, &coll, XENT_COLLTYPE_PLYR, 0x26); |
| 439 | |
| 440 | ent.bound.type = old_bound_type; |
| 441 | ent.bound.sph.r = old_bound_radius; |
| 442 | |
| 443 | r30->y = ray.origin.y; |
| 444 | |
| 445 | if (!(coll.flags & 0x1)) |
| 446 | { |
| 447 | return false; |
| 448 | } |
| 449 | |
| 450 | loc = *(xVec3*)&ent.model->Mat->pos; |
| 451 | loc.y -= coll.dist - f31; |
| 452 | |
| 453 | hit = (xEnt*)coll.optr; |
| 454 | |
| 455 | return true; |
| 456 | } |
| 457 | |
| 458 | void drop_stacked_entity(xEnt&); |
| 459 |
no test coverage detected