//
// LevelEditorLayer::getObjectRect from 0x365ee4 to 0x366210 (812 bytes)
//
// 8 xrefs:
// > LevelEditorLayer::addObjectsAtPosition @ 0x3664d4
// > LevelEditorLayer::addObjectsInRect @ 0x366588
// > LevelEditorLayer::objectAtPosition @ 0x366a42
// > LevelEditorLayer::objectsAtPosition @ 0x366c50
// > LevelEditorLayer::objectsInRect @ 0x366fc2
// > EditorUI::findSnapObject @ 0x386064
// > EditorUI::findSnapObject @ 0x386076
// > EditorUI::getCreateBtn @ 0x3864a2
//
// 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(
cocos2d::CCRect *__return_ptr retstr,
LevelEditorLayer *a2,
GameObject *a3,
bool a4,
bool a5)
{
float x; // s17
float v9; // s17
float y; // s16
const cocos2d::CCRect *v11; // r0
const cocos2d::CCSize *v12; // r0
float width; // s17
float v14; // s17
float v15; // r0
float v16; // r0
float v17; // s15
float height; // s15
int v19; // r2
float v20; // r2
const cocos2d::CCPoint *v21; // r0
float v22; // s16
const cocos2d::CCPoint *v23; // r0
bool m_hasCustomChild; // r3
int v25; // r2
bool v26; // r3
float v27; // r11
float v28; // r9
float v29; // r0
cocos2d::CCPoint v30; // r1
int v31; // r2
bool v32; // r3
float v34; // [sp+4h] [bp-10h]
_BOOL4 v35; // [sp+Ch] [bp-8h]
OBB2D *m_currentOBB2D; // [sp+Ch] [bp-8h]
cocos2d::CCSize v37; // [sp+14h] [bp+0h] BYREF
cocos2d::CCSize v38; // [sp+1Ch] [bp+8h] BYREF
cocos2d::CCPoint v39; // [sp+24h] [bp+10h] BYREF
cocos2d::CCPoint v40; // [sp+2Ch] [bp+18h] BYREF
cocos2d::CCPoint v41; // [sp+34h] [bp+20h] BYREF
v35 = a4;
a2->m_nonSquareRotation = 0;
cocos2d::CCSize::CCSize(&v37);
cocos2d::CCSize::CCSize(&v38);
if ( a3->m_hasContentSize )
{
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v41, &a3->m_lastSize);
cocos2d::CCSize::operator=(&v38, &v41);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v39, &a3->m_lastSize);
x = v39.x;
v9 = x * a3->getRScaleX(a3);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v40, &a3->m_lastSize);
y = v40.y;
}
else
{
if ( a3->m_updateCustomContentSize )
{
v11 = a3->getObjectRect(a3);
cocos2d::CCRect::CCRect(retstr, v11);
return retstr;
}
if ( !a3->m_unk4F8 && (a3->m_colorSprite || a3->m_hasCustomChild || a3->m_unk367) )
{
v12 = a3->getContentSize(a3);
cocos2d::CCSize::operator=(&v38, v12);
width = a3->getContentSize(a3)->width;
v9 = width * COERCE_FLOAT(((int (__fastcall *)(GameObject *))a3->getRScaleX)(a3));
y = a3->getContentSize(a3)->height;
}
else
{
cocos2d::CCSize::operator=(&v38, &a3->m_obRect.size);
v14 = a3->m_obRect.size.width;
v15 = a3->getRScaleX(a3);
y = a3->m_obRect.size.height;
v9 = v14 * v15;
}
}
v16 = a3->getRScaleY(a3);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v41, v9, y * v16);
cocos2d::CCSize::operator=(&v37, &v41);
if ( !a5 )
{
v17 = v37.width;
if ( v37.width < 15.0 )
v17 = 15.0;
v37.width = v17;
height = v37.height;
if ( v37.height < 15.0 )
height = 15.0;
v37.height = height;
}
cocos2d::CCPoint::CCPoint(&v39, (const cocos2d::CCPoint *)&flt_AC5CF0);
if ( a3->m_hasContentSize )
goto LABEL_23;
if ( v35 || !((int)a3->getRotation(a3) % 90) || !a3->getParent(a3) )
{
if ( a3->m_isRotationAligned )
{
v20 = v37.height;
v37.height = v37.width;
v37.width = v20;
}
LABEL_23:
if ( !a3->m_colorSprite && !a3->m_hasCustomChild || a3->m_unk4F8 )
{
LevelEditorLayer::getRelativeOffset(&v41, a2, a3);
cocos2d::CCPoint::operator=((PlayerObject *)&v39, COERCE_FLOAT(&v41), v31, v32);
}
v21 = a3->getPosition(a3);
v22 = (float)(v21->x + v39.x) - (float)(v37.width * 0.5);
v23 = a3->getPosition(a3);
cocos2d::CCRect::CCRect(retstr, v22, (float)(v23->y + v39.y) - (float)(v37.height * 0.5), v37.width, v37.height);
return retstr;
}
if ( !a3->m_colorSprite && !(m_hasCustomChild = a3->m_hasCustomChild) || (m_hasCustomChild = a3->m_unk4F8) )
cocos2d::CCPoint::operator=(
(PlayerObject *)&v39,
COERCE_FLOAT((GameObject *)&a3->m_obOffsetPosition),
v19,
m_hasCustomChild);
cocos2d::CCPoint::CCPoint(&v41, v39.x + (float)(v38.width * 0.5), v39.y + (float)(v38.height * 0.5));
cocos2d::CCNode::convertToWorldSpace(&v40, a3, &v41);
cocos2d::CCNode::convertToNodeSpace(&v41, a2->m_objectLayer, &v40);
cocos2d::CCPoint::operator=((PlayerObject *)&v40, COERCE_FLOAT(&v41), v25, v26);
m_currentOBB2D = a2->m_currentOBB2D;
cocos2d::CCPoint::CCPoint(&v41, &v40);
v27 = v37.width;
v28 = v37.height;
v29 = COERCE_FLOAT(((int (__fastcall *)(GameObject *))a3->getRotation)(a3));
LODWORD(v30.x) = &v41;
v30.y = v27;
OBB2D::calculateWithCenter(m_currentOBB2D, v30, v28, -(float)(v29 * 0.017453), v34);
a2->m_nonSquareRotation = 1;
OBB2D::getBoundingRect(retstr, a2->m_currentOBB2D);
return retstr;
}