MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / xEntCollideFloor

Function xEntCollideFloor

src/SB/Core/x/xEnt.cpp:1633–1732  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1631}
1632
1633void 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) &&

Callers 1

xEntCollideFunction · 0.70

Calls 4

xVec3CopyFunction · 0.85
xVec3SubFromFunction · 0.85
xVec3LengthFunction · 0.85
icosFunction · 0.85

Tested by

no test coverage detected