//
// EditorUI::findSnapObject from 0x7c75e8 to 0x7c7858 (624 bytes)
//
// 3 xrefs:
// > EditorUI::findSnapObject @ 0x7c7938
// > EditorUI::findSnapObject @ 0x7c798c
// > ??> @ 0x5be88
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:54:09 +0000
//
__int64 __fastcall EditorUI::findSnapObject(GameObject **this, cocos2d::CCArray *a2, float a3)
{
unsigned int v6; // w22
float v7; // s10
GameObject *v8; // x24
float v9; // s0
float v10; // s1
float v11; // s8
__int64 v13; // x0
__int64 v14; // [xsp+78h] [xbp+78h]
__int64 v15; // [xsp+80h] [xbp+80h] BYREF
__int64 v16; // [xsp+88h] [xbp+88h] BYREF
float v17; // [xsp+90h] [xbp+90h] BYREF
if ( a2 && (unsigned int)cocos2d::CCArray::count(a2) )
{
v6 = 0;
v7 = 999.0;
while ( v6 < (unsigned int)cocos2d::CCArray::count(a2) )
{
v8 = (GameObject *)cocos2d::CCArray::objectAtIndex(a2, v6);
GameObject::updateStartPos(v8);
((void (__fastcall *)(EditorUI *__hidden, GameObject *))EditorUI::positionWithoutOffset)((EditorUI *)this, v8);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, (const cocos2d::CCPoint *)&dword_155C778);
EditorUI::applySpecialOffset(&v15, this, &v16, v8, &v17);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, (const cocos2d::CCPoint *)&v15);
EditorUI::getGridSnappedPos((__int64)this, &v17, (__int64)&v16);
v9 = vabds_f32(*(float *)&v16, *(float *)&v15);
v10 = vabds_f32(*((float *)&v16 + 1), *((float *)&v15 + 1));
if ( (a3 <= 0.0 || a3 >= v9 && a3 >= v10)
&& (v11 = v9 + v10, v7 > (float)(v9 + v10))
&& (*(this + 188) = v8, EditorUI::shouldSnap((EditorUI *)this, v8)) )
{
v7 = v11;
if ( v11 == 0.0 )
return _stack_chk_guard;
}
else if ( v7 == 0.0 )
{
return _stack_chk_guard;
}
++v6;
}
}
else
{
v13 = (__int64)*(this + 187);
if ( v13 )
{
if ( !((int)(*(float (__fastcall **)(__int64))(*(_QWORD *)v13 + 368LL))(v13) % 90) )
{
EditorUI::positionWithoutOffset(&v16, (EditorUI *)this, *(this + 187));
v14 = (__int64)*(this + 187);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, (const cocos2d::CCPoint *)&dword_155C778);
EditorUI::applySpecialOffset(&v15, this, &v16, v14, &v17);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, (const cocos2d::CCPoint *)&v15);
EditorUI::getGridSnappedPos((__int64)this, &v17, (__int64)&v16);
if ( a3 <= 0.0
|| a3 >= vabds_f32(*(float *)&v16, *(float *)&v15)
&& a3 >= vabds_f32(*((float *)&v16 + 1), *((float *)&v15 + 1)) )
{
*(this + 188) = *(this + 187);
}
}
}
}
return _stack_chk_guard;
}