//
// OBB2D::orderCorners from 0x2f2538 to 0x2f26c0 (392 bytes)
//
// 1 xrefs:
// > OBB2D::calculateWithCenter @ 0x2f27d6
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void OBB2D::orderCorners(OBB2D *a1)
{
std::array *p_m_corners; // r10
std::array *p_m_positions; // r9
std::array *v4; // r5
std::array *v5; // r6
int v6; // r0
float y; // s15
cocos2d::CCPoint *v8; // r0
std::array *v9; // r0
cocos2d::CCPoint *v10; // r0
cocos2d::CCPoint *v11; // r1
int v12; // r0
float v13; // s15
cocos2d::CCPoint *v14; // r0
cocos2d::CCPoint *v15; // r0
cocos2d::CCPoint *v16; // r4
cocos2d::CCPoint *v17; // r0
cocos2d::CCPoint *v18; // r1
cocos2d::CCPoint v19; // [sp+4h] [bp+0h] BYREF
cocos2d::CCPoint v20; // [sp+Ch] [bp+8h] BYREF
cocos2d::CCPoint v21; // [sp+14h] [bp+10h] BYREF
cocos2d::CCPoint v22; // [sp+1Ch] [bp+18h] BYREF
p_m_corners = &a1->m_corners;
p_m_positions = &a1->m_positions;
v4 = &a1->m_corners;
v5 = &a1->m_corners;
cocos2d::CCPoint::CCPoint(&v19);
cocos2d::CCPoint::CCPoint(&v20);
v6 = cocos2d::CCPoint::operator=(&v20, p_m_corners);
cocos2d::CCPoint::operator=(&v19, v6);
do
{
y = v5->__elems_[0].y;
if ( y > v19.y )
{
cocos2d::CCPoint::operator=(&v20, &v19);
v8 = &v19;
LABEL_8:
cocos2d::CCPoint::operator=(v8, v5);
goto LABEL_9;
}
if ( y > v20.y || y == v20.y && v5->__elems_[0].x < v20.x )
{
v8 = &v20;
goto LABEL_8;
}
LABEL_9:
v5 = (std::array *)((char *)v5 + 8);
}
while ( v5 != p_m_positions );
v9 = &a1->m_positions;
if ( v19.x <= v20.x )
{
cocos2d::CCPoint::operator=(v9, &v19);
v10 = &a1->m_positions.__elems_[1];
v11 = &v20;
}
else
{
cocos2d::CCPoint::operator=(v9, &v20);
v10 = &a1->m_positions.__elems_[1];
v11 = &v19;
}
cocos2d::CCPoint::operator=(v10, v11);
cocos2d::CCPoint::CCPoint(&v21);
cocos2d::CCPoint::CCPoint(&v22);
v12 = cocos2d::CCPoint::operator=(&v22, p_m_corners);
cocos2d::CCPoint::operator=(&v21, v12);
while ( 2 )
{
v13 = v4->__elems_[0].y;
if ( v13 < v21.y )
{
cocos2d::CCPoint::operator=(&v22, &v21);
v14 = &v21;
goto LABEL_20;
}
if ( v13 < v22.y || v13 == v22.y && v4->__elems_[0].x > v22.x )
{
v14 = &v22;
LABEL_20:
cocos2d::CCPoint::operator=(v14, v4);
}
v4 = (std::array *)((char *)v4 + 8);
if ( v4 != p_m_positions )
continue;
break;
}
v15 = &a1->m_positions.__elems_[2];
v16 = &a1->m_positions.__elems_[3];
if ( v21.x <= v22.x )
{
cocos2d::CCPoint::operator=(v15, &v22);
v17 = v16;
v18 = &v21;
}
else
{
cocos2d::CCPoint::operator=(v15, &v21);
v17 = v16;
v18 = &v22;
}
cocos2d::CCPoint::operator=(v17, v18);
}