Skip to content

Commit

Permalink
xCollide: clean up couple funcs to enable match (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
escape209 authored Aug 15, 2024
1 parent f910888 commit a377f7d
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions src/SB/Core/x/xCollide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

// extern F32 lbl_803CCAA8; // 0.0

#ifdef NON_MATCHING
// Will match once we can use float literals for this
_xCollsIdx xCollideGetCollsIdx(const xCollis* coll, const xVec3* tohit, const xMat3x3* mat)
{
if (tohit->y * tohit->y > tohit->x * tohit->x + tohit->z * tohit->z)
Expand Down Expand Up @@ -83,50 +81,52 @@ _xCollsIdx xCollideGetCollsIdx(const xCollis* coll, const xVec3* tohit, const xM
}
}
}
#endif

void xCollideInit(xScene* sc)
{
iCollideInit(sc);
}

#if 0
//WIP, very wrong but it compiles at least
// Need to figure out why it defines scale twice and why ghidra passes in wrong values to xVec3SMul
U32 xSphereHitsSphere(const xSphere* a, const xSphere* b, xCollis* coll)
{
U32 uVar1;

xIsect isx;
F32 scale;
// F32 scale;

iSphereIsectSphere(b, a, &isx);
if (scale <= 0.0f)

if (!(isx.penned <= 0.0f))
{
uVar1 = 0;
coll->flags &= 0xfffffffe;
}
else
{
if (scale <= 0.0f)
if (isx.contained <= 0.0f)
{
coll->flags = coll->flags | 0x10;
coll->flags |= 0x10;
}
coll->dist = (F32)((float)a->r + scale);
coll->dist = a->r + isx.penned;
if ((coll->flags & 0x1600) != 0)
{
if (0.0f == scale)
if (isx.dist == 0.0f)
{
xVec3Copy(&coll->tohit, &g_O3);
}
else
{
xVec3SMul(&coll->norm, &coll->tohit, scale);
xVec3SMul(&coll->tohit, &isx.norm, -coll->dist / isx.dist);
}
}
if ((coll->flags & 0x800) != 0)
{
if (0.0f == scale)
if (isx.dist == 0.0f)
{
xVec3Copy(&coll->depen, &g_O3);
}
else
{
xVec3SMul((xVec3*)&a->center, &coll->depen, scale);
xVec3SMul(&coll->depen, &isx.norm, -isx.penned / isx.dist);
}
}
if ((coll->flags & 0x1200) != 0)
Expand All @@ -137,16 +137,11 @@ U32 xSphereHitsSphere(const xSphere* a, const xSphere* b, xCollis* coll)
{
xVec3Inv(&coll->norm, &coll->hdng);
}
uVar1 = 1;
coll->flags |= 1;
return 1;
}
else
{
coll->flags &= 0xfffffffe;
return 0;
}
return uVar1;
}
#endif

void xMat3x3RMulVec(xVec3* o, const xMat3x3* m, const xVec3* v)
{
Expand All @@ -157,4 +152,4 @@ void xMat3x3RMulVec(xVec3* o, const xMat3x3* m, const xVec3* v)
o->x = x;
o->y = y;
o->z = z;
}
}

0 comments on commit a377f7d

Please sign in to comment.