//
// EditorUI::findSnapObject from 0x48501c to 0x4851e6 (458 bytes)
//
// 1 xrefs:
// > EditorUI::findSnapObject @ 0x48528a
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:49:24 +0000
//
unsigned int __fastcall EditorUI::findSnapObject(EditorUI *this, cocos2d::CCArray *a2, float a3)
{
float v6; // s18
unsigned int i; // r6
unsigned int result; // r0
GameObject *v9; // r9
float v10; // r1
float v11; // r2
int v12; // r3
float v13; // s15
float v14; // s16
float v15; // s16
int v16; // r0
int v17; // r1
int v18; // r9
float v19; // [sp+14h] [bp-20h] BYREF
float v20; // [sp+18h] [bp-1Ch]
float v21; // [sp+1Ch] [bp-18h] BYREF
float v22; // [sp+20h] [bp-14h]
float v23[2]; // [sp+24h] [bp-10h] BYREF
if ( a2 && cocos2d::CCArray::count(a2) )
{
v6 = 999.0;
for ( i = 0; ; ++i )
{
result = cocos2d::CCArray::count(a2);
if ( i >= result )
break;
v9 = (GameObject *)cocos2d::CCArray::objectAtIndex(a2, i);
GameObject::updateStartPos(v9, v10, v11, v12);
EditorUI::positionWithoutOffset((EditorUI *)&v21, this);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v23, (const cocos2d::CCPoint *)&flt_D2B938);
EditorUI::applySpecialOffset(&v19, this, &v21, v9, v23);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v23, (const cocos2d::CCPoint *)&v19);
result = EditorUI::getGridSnappedPos((int)&v21, (int)this, v23);
v13 = fabsf(v21 - v19);
v14 = fabsf(v22 - v20);
if ( a3 <= 0.0 || v13 <= a3 && v14 <= a3 )
{
v15 = v13 + v14;
if ( v15 < v6 )
{
*((_DWORD *)this + 250) = v9;
result = EditorUI::shouldSnap(this, v9);
if ( result )
v6 = v15;
}
}
if ( v6 == 0.0 )
break;
}
}
else
{
result = *((_DWORD *)this + 249);
if ( result )
{
v16 = (int)(*(float (__fastcall **)(unsigned int))(*(_DWORD *)result + 184))(result);
v17 = v16 % 90;
result = v16 / 90;
if ( !v17 )
{
EditorUI::positionWithoutOffset((EditorUI *)&v21, this);
v18 = *((_DWORD *)this + 249);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v23, (const cocos2d::CCPoint *)&flt_D2B938);
EditorUI::applySpecialOffset(&v19, this, &v21, v18, v23);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v23, (const cocos2d::CCPoint *)&v19);
result = EditorUI::getGridSnappedPos((int)&v21, (int)this, v23);
if ( a3 <= 0.0 || fabsf(v21 - v19) <= a3 && fabsf(v22 - v20) <= a3 )
*((_DWORD *)this + 250) = *((_DWORD *)this + 249);
}
}
}
return result;
}