//
// LevelEditorLayer::rotationForSlopeNearObject from 0x460f50 to 0x46104e (254 bytes)
//
// 2 xrefs:
// > EditorUI::getSnapAngle @ 0x70dd10
// > EditorUI::getSnapAngle @ 0x70dd3e
//
// 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:48:52 +0000
//
int __fastcall LevelEditorLayer::rotationForSlopeNearObject(LevelEditorLayer *this, GameObject *a2, float a3)
{
unsigned int v5; // r4
cocos2d::CCArray *v6; // r8
unsigned __int8 *v7; // r7
int v8; // r4
int v9; // r0
float v10; // s15
_BYTE v12[16]; // [sp+4h] [bp-24h] BYREF
float v13[4]; // [sp+14h] [bp-14h] BYREF
GameObject::updateStartPos(a2, *(float *)&a2, a3, _stack_chk_guard);
(*(void (__fastcall **)(_BYTE *, GameObject *, int, int))(*(_DWORD *)a2 + 668))(v12, a2, 1065353216, 1065353216);
v5 = 0;
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v13, (const cocos2d::CCRect *)v12);
v6 = LevelEditorLayer::objectsInRect((int)this, v13, 1);
while ( 1 )
{
if ( v5 >= cocos2d::CCArray::count(v6) )
{
v10 = -1.0;
return LODWORD(v10);
}
v7 = (unsigned __int8 *)cocos2d::CCArray::objectAtIndex(v6, v5);
if ( (*(int (__fastcall **)(unsigned __int8 *))(*(_DWORD *)v7 + 900))(v7) == 25 )
break;
++v5;
}
GameObject::determineSlopeDirection((GameObject *)v7);
v8 = (-v7[944] ^ (int)(float)(GameObject::getSlopeAngle((GameObject *)v7) * 57.296)) + v7[944];
if ( GameObject::slopeFloorTop((GameObject *)v7) && !(*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 716))(a2)
|| !GameObject::slopeFloorTop((GameObject *)v7) && (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 716))(a2) )
{
if ( v8 <= 0 )
v9 = v8 - 180;
else
v9 = v8 + 180;
v8 = v9 % 360;
}
v10 = (float)v8;
return LODWORD(v10);
}