| 1631 | } |
| 1632 | |
| 1633 | void xEntCollideFloor(xEnt* p, xScene* sc, F32 dt) |
| 1634 | { |
| 1635 | xCollis* coll = &p->collis->colls[0]; |
| 1636 | U8 idx; |
| 1637 | xCollis* ml = coll; |
| 1638 | xVec3 motion; |
| 1639 | F32 mlen; |
| 1640 | S32 stepping = 0; |
| 1641 | F32 sbr; |
| 1642 | |
| 1643 | if (p->bound.type == XBOUND_TYPE_SPHERE) |
| 1644 | { |
| 1645 | sbr = p->bound.sph.r; |
| 1646 | } |
| 1647 | else |
| 1648 | { |
| 1649 | sbr = 0.7f; |
| 1650 | } |
| 1651 | |
| 1652 | xVec3Copy(&motion, &p->frame->mat.pos); |
| 1653 | xVec3SubFrom(&motion, &p->frame->oldmat.pos); |
| 1654 | |
| 1655 | motion.y = 0.0f; |
| 1656 | mlen = xVec3Length(&motion); |
| 1657 | |
| 1658 | for (idx = 6; idx < p->collis->idx; idx++) |
| 1659 | { |
| 1660 | xCollis* mf = &p->collis->colls[idx]; |
| 1661 | |
| 1662 | if (mf->flags & 0x1) |
| 1663 | { |
| 1664 | xEnt* fent = (xEnt*)mf->optr; |
| 1665 | |
| 1666 | if (fent) |
| 1667 | { |
| 1668 | if ((fent->collType == XENT_COLLTYPE_DYN || fent->collType == XENT_COLLTYPE_STAT) || |
| 1669 | (fent->pflags & 0x20 && 0.0f == mf->hdng.x && 0.0f == mf->hdng.z)) |
| 1670 | { |
| 1671 | if (!((p->collis->depenq) ? |
| 1672 | p->collis->depenq(p, fent, sc, dt, mf) : |
| 1673 | (fent->collType & p->collis->pen && fent->penby & p->collType))) |
| 1674 | { |
| 1675 | continue; |
| 1676 | } |
| 1677 | } |
| 1678 | else |
| 1679 | { |
| 1680 | continue; |
| 1681 | } |
| 1682 | } |
| 1683 | else if (!(p->collis->pen & 0x20)) |
| 1684 | { |
| 1685 | continue; |
| 1686 | } |
| 1687 | |
| 1688 | if (mf->dist < ml->dist) |
| 1689 | { |
| 1690 | if (mf->hdng.y < -icos(PI / 3) && |
no test coverage detected