//
// OBB2D::orderCorners from 0x58d44c to 0x58d670 (548 bytes)
//
// 2 xrefs:
// > OBB2D::calculateWithCenter @ 0x58d800
// > ??> @ 0x33000
//
// 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; // x19
std::array *p_m_positions; // x22
std::array *v4; // x20
float v5; // s0
float v6; // s1
float v7; // s0
float v8; // s1
float y; // s0
float x; // s1
float v11; // s0
float v12; // s1
float v13; // s0
float v14; // s1
float v15; // s0
float v16; // s1
float v17; // s0
float v18; // s1
float v19; // s0
float v20; // s1
float v21; // s0
float v22; // s1
float v23; // s0
float v24; // s1
cocos2d::CCPoint v25; // [xsp+58h] [xbp+58h] BYREF
cocos2d::CCPoint v26; // [xsp+60h] [xbp+60h] BYREF
cocos2d::CCPoint v27; // [xsp+68h] [xbp+68h] BYREF
cocos2d::CCPoint v28; // [xsp+70h] [xbp+70h] BYREF
p_m_corners = &a1->m_corners;
p_m_positions = &a1->m_positions;
v4 = &a1->m_corners;
cocos2d::CCPoint::CCPoint(&v25);
cocos2d::CCPoint::CCPoint(&v26);
cocos2d::CCPoint::operator=(&v26, v5, v6);
cocos2d::CCPoint::operator=(&v25, v7, v8);
do
{
y = v4->__elems_[0].y;
if ( y > v25.y )
{
cocos2d::CCPoint::operator=(&v26, y, v25.y);
cocos2d::CCPoint::operator=(&v25, v21, v22);
}
else
{
x = v26.y;
if ( y > v26.y || y == v26.y && (x = v4->__elems_[0].x, y = v26.x, v4->__elems_[0].x < v26.x) )
cocos2d::CCPoint::operator=(&v26, y, x);
}
v4 = (std::array *)((char *)v4 + 8);
}
while ( v4 != p_m_positions );
cocos2d::CCPoint::operator=(&a1->m_positions, v26.x, v25.x);
cocos2d::CCPoint::operator=(&a1->m_positions.__elems_[1], v11, v12);
cocos2d::CCPoint::CCPoint(&v27);
cocos2d::CCPoint::CCPoint(&v28);
cocos2d::CCPoint::operator=(&v28, v13, v14);
cocos2d::CCPoint::operator=(&v27, v15, v16);
do
{
v17 = p_m_corners->__elems_[0].y;
if ( v17 < v27.y )
{
cocos2d::CCPoint::operator=(&v28, v17, v27.y);
cocos2d::CCPoint::operator=(&v27, v23, v24);
}
else
{
v18 = v28.y;
if ( v17 < v28.y
|| v17 == v28.y && (v18 = p_m_corners->__elems_[0].x, v17 = v28.x, p_m_corners->__elems_[0].x > v28.x) )
{
cocos2d::CCPoint::operator=(&v28, v17, v18);
}
}
p_m_corners = (std::array *)((char *)p_m_corners + 8);
}
while ( p_m_corners != p_m_positions );
cocos2d::CCPoint::operator=(&a1->m_positions.__elems_[2], v28.x, v27.x);
cocos2d::CCPoint::operator=(&a1->m_positions.__elems_[3], v19, v20);
}