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

Function xEntCollideCeiling

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

Source from the content-addressed store, hash-verified

1732}
1733
1734void xEntCollideCeiling(xEnt* p, xScene* sc, F32 dt)
1735{
1736 xCollis* coll = &p->collis->colls[1];
1737 U8 idx;
1738 xCollis* ml = coll;
1739 F32 sbr;
1740
1741 if (p->bound.type == XBOUND_TYPE_SPHERE)
1742 {
1743 sbr = p->bound.sph.r;
1744 }
1745 else
1746 {
1747 sbr = 0.7f;
1748 }
1749
1750 for (idx = 6; idx < p->collis->idx; idx++)
1751 {
1752 xCollis* mf = &p->collis->colls[idx];
1753 xEnt* fent = (xEnt*)mf->optr;
1754
1755 if (fent)
1756 {
1757 if (!((p->collis->depenq) ?
1758 p->collis->depenq(p, fent, sc, dt, mf) :
1759 (fent->collType & p->collis->pen && fent->penby & p->collType)))
1760 {
1761 continue;
1762 }
1763 }
1764 else if (!(p->collis->pen & 0x20))
1765 {
1766 continue;
1767 }
1768
1769 if (mf->hdng.y > icos(0.78539819f) && mf->dist < ml->dist)
1770 {
1771 ml = mf;
1772 }
1773 }
1774
1775 if (ml != coll)
1776 {
1777 F32 ceil_dist = ml->dist * (F32)iabs(ml->hdng.y);
1778
1779 *coll = *ml;
1780
1781 ml->flags |= 0xA;
1782
1783 if (ceil_dist < sbr)
1784 {
1785 p->frame->mat.pos.y -= sbr - ceil_dist;
1786 p->frame->vel.y = 0.0f;
1787 }
1788 }
1789}
1790
1791void xEntCollideWalls(xEnt* p, xScene* sc, F32 dt)

Callers 1

xEntCollideFunction · 0.70

Calls 1

icosFunction · 0.85

Tested by

no test coverage detected