//
// LevelEditorLayer::getObjectRect from 0x10035ae90 to 0x10035b26c (988 bytes)
//
// 6 xrefs:
// > LevelEditorLayer::objectsInRect @ 0x10035ab90
// > LevelEditorLayer::objectAtPosition @ 0x10035ae18
// > LevelEditorLayer::objectsAtPosition @ 0x10035b444
// > EditorUI::getCreateBtn @ 0x1003ea468
// > EditorUI::findSnapObject @ 0x1003f82bc
// > EditorUI::findSnapObject @ 0x1003f82d4
//
// 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
//
cocos2d::CCRect __fastcall LevelEditorLayer::getObjectRect(LevelEditorLayer *a1, GameObject *a2, bool a3, bool a4)
{
float *v4; // x8
float *v9; // x19
double v10; // d0
float v11; // s8
float v12; // s8
__n128 v13; // q0
float y; // s9
__int64 v15; // x0
double v16; // d0
double v20; // d0
float width; // s8
double *v22; // x0
double v23; // d0
float v24; // s8
float v25; // s0
__n128 v31; // q0
unsigned __int64 v32; // t2
__n128 v33; // q1
OBB2D *m_currentOBB2D; // x22
float v35; // s0
cocos2d::CCPoint v36; // kr28_8
float v37; // s2
float v38; // s3
float v39; // s4
float *v40; // x0
float v41; // s8
__int64 v42; // x0
cocos2d::CCPoint v43; // [xsp+8h] [xbp-68h] BYREF
__int64 v44; // [xsp+10h] [xbp-60h] BYREF
__int64 v45; // [xsp+18h] [xbp-58h] BYREF
int8x8_t v46; // [xsp+20h] [xbp-50h] BYREF
cocos2d::CCPoint v47; // [xsp+28h] [xbp-48h] BYREF
cocos2d::CCRect BoundingRect; // 0:kr10_16.16
cocos2d::CCPoint v49; // 0:s0.4,4:s1.4
cocos2d::CCRect result; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v9 = v4;
a1->m_nonSquareRotation = 0;
sub_100022AF4(&v46);
sub_100022AF4(&v45);
if ( a2->m_hasContentSize )
{
sub_100022AFC(&v47, (double *)&a2->m_lastSize);
sub_100022B14(&v45, (double *)&v47);
v10 = sub_100022AFC(&v44, (double *)&a2->m_lastSize);
v11 = *(float *)&v44;
v12 = v11 * ((float (__fastcall *)(GameObject *, double))a2->getRScaleX)(a2, v10);
v13.n128_f64[0] = sub_100022AFC(&v43, (double *)&a2->m_lastSize);
y = v43.y;
}
else
{
if ( a2->m_updateCustomContentSize )
{
v15 = ((__int64 (__fastcall *)(GameObject *))a2->getObjectRect)(a2);
v16 = sub_100022B98(v9, v15);
goto LABEL_29;
}
if ( !a2->m_unk4F8 && (a2->m_colorSprite || a2->m_hasCustomChild || a2->m_unk367) )
{
v22 = (double *)((__int64 (__fastcall *)(GameObject *))a2->getContentSize)(a2);
v23 = sub_100022B14(&v45, v22);
v24 = *(float *)((__int64 (__fastcall *)(GameObject *, double))a2->getContentSize)(a2, v23);
v12 = v24 * ((float (__fastcall *)(GameObject *))a2->getRScaleX)(a2);
y = *(float *)(((__int64 (__fastcall *)(GameObject *))a2->getContentSize)(a2) + 4);
}
else
{
v20 = sub_100022B14(&v45, (double *)&a2->m_obRect.size);
width = a2->m_obRect.size.width;
v13.n128_f32[0] = ((float (__fastcall *)(GameObject *, double))a2->getRScaleX)(a2, v20);
v12 = width * v13.n128_f32[0];
y = a2->m_obRect.size.height;
}
}
v25 = ((float (__fastcall *)(GameObject *, __n128))a2->getRScaleY)(a2, v13);
sub_100022988((float *)&v47, v12, y * v25);
sub_100022B14(&v46, (double *)&v47);
if ( !a4 )
{
__asm { FMOV V1.2S, #15.0 }
v46 = vbsl_s8((int8x8_t)vcgt_f32(_D1, (float32x2_t)v46), (int8x8_t)_D1, v46);
}
v31.n128_f32[0] = sub_1000229B8(&v44, (__int64 *)&dword_10086E330);
if ( !a2->m_hasContentSize )
{
if ( !a3 )
{
v31.n128_f32[0] = ((float (__fastcall *)(GameObject *, float))a2->getRotation)(a2, v31.n128_f32[0]);
HIDWORD(v32) = -1527099483 * (int)v31.n128_f32[0] + 47721858;
LODWORD(v32) = HIDWORD(v32);
if ( (unsigned int)(v32 >> 1) >= 0x2D82D83 )
{
if ( ((__int64 (__fastcall *)(GameObject *))a2->getParent)(a2) )
{
if ( !a2->m_colorSprite && !a2->m_hasCustomChild || a2->m_unk4F8 )
v31.n128_f64[0] = sub_1000229D0(&v44, (double *)&a2->m_obOffsetPosition);
v31.n128_f32[0] = (float)(*(float *)&v45 * 0.5) + *(float *)&v44;
v33.n128_f32[0] = (float)(*((float *)&v45 + 1) * 0.5) + *((float *)&v44 + 1);
sub_100022980(v31, v33, &v43);
cocos2d::CCNode::convertToWorldSpace(a2, &v43);
cocos2d::CCNode::convertToNodeSpace(a1->m_objectLayer, &v47);
sub_1000229D0(&v47, (double *)&v43);
m_currentOBB2D = a1->m_currentOBB2D;
v35 = sub_1000229B8((__int64 *)&v43, (__int64 *)&v47);
v36 = (cocos2d::CCPoint)v46;
v37 = ((float (__fastcall *)(GameObject *, float))a2->getRotation)(a2, v35) * -0.017453;
OBB2D::calculateWithCenter(m_currentOBB2D, v36, v37, v38, v39);
a1->m_nonSquareRotation = 1;
BoundingRect = OBB2D::getBoundingRect(a1->m_currentOBB2D);
*(float *)&v16 = BoundingRect.origin.x;
result.origin.y = BoundingRect.origin.y;
result.size.width = BoundingRect.size.width;
result.size.height = BoundingRect.size.height;
goto LABEL_29;
}
}
}
if ( a2->m_isRotationAligned )
{
v31.n128_u64[0] = (unsigned __int64)vrev64_s32((int32x2_t)v46);
v46 = (int8x8_t)v31.n128_u64[0];
}
}
if ( !a2->m_colorSprite && !a2->m_hasCustomChild || a2->m_unk4F8 )
{
v49.x = sub_1000229B8((__int64 *)&v47, (__int64 *)&a2->m_obUnflippedOffsetPositionFromCenter);
GameToolbox::getRelativeOffset(a2, v49);
v31.n128_f64[0] = sub_1000229D0(&v44, (double *)&v43);
}
v40 = (float *)((__int64 (__fastcall *)(GameObject *, __n128))a2->getPosition)(a2, v31);
v41 = (float)(*v40 + *(float *)&v44) - (float)(*(float *)v46.i32 * 0.5);
v42 = ((__int64 (__fastcall *)(GameObject *))a2->getPosition)(a2);
sub_100022990(
v9,
v41,
(float)(*(float *)(v42 + 4) + *((float *)&v44 + 1)) - (float)(*(float *)&v46.i32[1] * 0.5),
*(float *)v46.i32,
*(float *)&v46.i32[1]);
LABEL_29:
result.origin.x = *(float *)&v16;
return result;
}