//
// LevelEditorLayer::getObjectRect from 0x65d0d8 to 0x65d544 (1132 bytes)
//
// 11 xrefs:
// > LevelEditorLayer::addObjectsAtPosition @ 0x65d91c
// > LevelEditorLayer::addObjectsInRect @ 0x65da00
// > LevelEditorLayer::addObjectsInRect @ 0x65da9c
// > LevelEditorLayer::objectAtPosition @ 0x65e1cc
// > LevelEditorLayer::objectsAtPosition @ 0x65e570
// > LevelEditorLayer::objectsInRect @ 0x65ea28
// > LevelEditorLayer::objectsInRect @ 0x65ea98
// > EditorUI::findSnapObject @ 0x69438c
// > EditorUI::findSnapObject @ 0x6943a4
// > EditorUI::getCreateBtn @ 0x694948
// > ??> @ 0x566e8
//
// 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 LevelEditorLayer::getObjectRect(LevelEditorLayer *a1, GameObject *a2, bool a3, bool a4)
{
cocos2d::CCRect *v4; // x8
_BOOL4 v6; // w27
float *v7; // x26
cocos2d::CCPoint v8; // x1
cocos2d::CCRect *v10; // x21
float v11; // s9
float v12; // s0
float height; // s8
GameObject_vtbl *v14; // x1
float v15; // s9
GameObject *v16; // x0
float v17; // s0
float v18; // s1
float v19; // s0
const cocos2d::CCPoint *v20; // x0
const cocos2d::CCPoint *v21; // x0
const cocos2d::CCSize *v26; // x0
float width; // s9
const cocos2d::CCSize *v28; // x0
float x; // s9
float v30; // w1
const cocos2d::CCRect *v31; // x0
float v32; // s0
float v33; // s1
OBB2D *m_currentOBB2D; // x24
float v35; // s8
float v36; // s3
float v37; // s4
OBB2D *v38; // x0
_BOOL4 v39; // [xsp+80h] [xbp+80h]
float v40; // [xsp+80h] [xbp+80h]
float v41; // [xsp+80h] [xbp+80h]
cocos2d::CCSize v42; // [xsp+90h] [xbp+90h] BYREF
cocos2d::CCSize v43; // [xsp+98h] [xbp+98h] BYREF
cocos2d::CCPoint v44; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::CCSize v45; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::CCPoint v46[2]; // [xsp+B0h] [xbp+B0h] BYREF
cocos2d::CCPoint RelativeOffset; // 0:kr00_8.8
cocos2d::CCPoint v48; // 0:kr10_8.8
cocos2d::CCRect BoundingRect; // 0:kr20_16.16
cocos2d::CCPoint v50; // 0:s0.4,4:s1.4
cocos2d::CCRect result; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v39 = a3;
v6 = a4;
v7 = &a1->m_varianceValues.__elems_[1975];
v8 = (cocos2d::CCPoint)_stack_chk_guard;
a1->m_nonSquareRotation = 0;
v10 = v4;
v46[1] = v8;
cocos2d::CCSize::CCSize(&v42);
cocos2d::CCSize::CCSize(&v43);
if ( a2->m_hasContentSize )
{
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v46, &a2->m_lastSize);
cocos2d::CCSize::operator=(&v43, v46);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v44, &a2->m_lastSize);
x = v44.x;
v15 = x * a2->getRScaleX(a2);
cocos2d::CCSize::CCSize(&v45, &a2->m_lastSize);
v14 = a2->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v16 = a2;
height = v45.height;
}
else
{
if ( a2->m_updateCustomContentSize )
{
v31 = a2->getObjectRect(a2);
cocos2d::CCRect::CCRect(v10, v31);
return result;
}
if ( !a2->m_unk4F8 && (a2->m_colorSprite || a2->m_hasCustomChild || a2->m_unk367) )
{
v26 = a2->getContentSize(a2);
cocos2d::CCSize::operator=(&v43, v26);
width = a2->getContentSize(a2)->width;
v15 = width * a2->getRScaleX(a2);
v28 = a2->getContentSize(a2);
v14 = a2->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
height = v28->height;
v16 = a2;
}
else
{
cocos2d::CCSize::operator=(&v43, &a2->m_obRect.size);
v11 = a2->m_obRect.size.width;
v12 = a2->getRScaleX(a2);
height = a2->m_obRect.size.height;
v14 = a2->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v15 = v11 * v12;
v16 = a2;
}
}
v17 = v14->getRScaleY(v16);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v46, v15, height * v17);
cocos2d::CCSize::operator=(&v42, v46);
if ( !v6 )
{
v18 = v42.width;
if ( v42.width < 15.0 )
v18 = 15.0;
v19 = v42.height;
v42.width = v18;
if ( v42.height < 15.0 )
v19 = 15.0;
v42.height = v19;
}
cocos2d::CCPoint::CCPoint(&v44, (const cocos2d::CCPoint *)&dword_12420B0);
if ( !a2->m_hasContentSize )
{
if ( !v39 && (int)a2->getRotation(a2) % 90 && a2->getParent(a2) )
{
if ( !a2->m_colorSprite && !a2->m_hasCustomChild || a2->m_unk4F8 )
cocos2d::CCPoint::operator=(&v44, v32, v33);
cocos2d::CCPoint::CCPoint(v46, v44.x + (float)(v43.width * 0.5), v44.y + (float)(v43.height * 0.5));
cocos2d::CCNode::convertToWorldSpace(a2, v46);
v48 = cocos2d::CCNode::convertToNodeSpace(a1->m_objectLayer, (const cocos2d::CCPoint *)&v45);
cocos2d::CCPoint::operator=(&v45, v48.x, v48.y);
m_currentOBB2D = a1->m_currentOBB2D;
cocos2d::CCPoint::CCPoint(v46, (const cocos2d::CCPoint *)&v45);
v35 = v42.width;
v41 = v42.height;
v36 = -a2->getRotation(a2);
v50.y = v41;
v50.x = v35;
OBB2D::calculateWithCenter(m_currentOBB2D, v50, v36 * 0.017453, v36, v37);
v38 = a1->m_currentOBB2D;
*((_BYTE *)v7 + 2173) = 1;
BoundingRect = OBB2D::getBoundingRect(v38);
result.origin.x = BoundingRect.origin.x;
result.origin.y = BoundingRect.origin.y;
result.size.width = BoundingRect.size.width;
result.size.height = BoundingRect.size.height;
return result;
}
if ( a2->m_isRotationAligned )
{
v30 = v42.width;
v42.width = v42.height;
v42.height = v30;
}
}
if ( !a2->m_colorSprite && !a2->m_hasCustomChild || a2->m_unk4F8 )
{
RelativeOffset = LevelEditorLayer::getRelativeOffset(a1, a2);
cocos2d::CCPoint::operator=(&v44, RelativeOffset.x, RelativeOffset.y);
}
v20 = a2->getPosition(a2);
v40 = (float)(v20->x + v44.x) - (float)(v42.width * 0.5);
v21 = a2->getPosition(a2);
cocos2d::CCRect::CCRect(v10, v40, (float)(v21->y + v44.y) - (float)(v42.height * 0.5), v42.width, v42.height);
return result;
}