//
// LevelEditorLayer::rotationForSlopeNearObject from 0x1003fa67c to 0x1003fa80c (400 bytes)
//
// 3 xrefs:
// > EditorUI::getSnapAngle @ 0x10015d810
// > EditorUI::getSnapAngle @ 0x10015d850
// > EditorUI::transformObject @ 0x10015e148
//
// 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 11:04:35 +0000
//
float __fastcall LevelEditorLayer::rotationForSlopeNearObject(__int64 a1, __int64 a2)
{
double v4; // d0
__int64 v5; // x21
float v6; // s8
unsigned int v7; // w22
_BYTE *v8; // x20
int v9; // w8
signed int v10; // w21
_QWORD v12[2]; // [xsp+0h] [xbp-50h] BYREF
_QWORD v13[2]; // [xsp+10h] [xbp-40h] BYREF
GameObject::updateStartPos(a2);
(*(void (__fastcall **)(_QWORD *__return_ptr, __int64, float, float))(*(_QWORD *)a2 + 1336LL))(v13, a2, 1.0, 1.0);
v4 = sub_1000264D4(v12, (__int64)v13);
v5 = LevelEditorLayer::objectsInRect(a1, v12, 1, v4);
v6 = -1.0;
if ( (unsigned int)sub_1002E757C(v5) )
{
v7 = 0;
while ( 1 )
{
v8 = (_BYTE *)sub_1002E75A0(v5, v7);
if ( (*(unsigned int (__fastcall **)(_BYTE *))(*(_QWORD *)v8 + 1800LL))(v8) == 25 )
break;
if ( ++v7 >= (unsigned int)sub_1002E757C(v5) )
return v6;
}
GameObject::determineSlopeDirection((__int64)v8);
v9 = (int)(float)(sub_1002FA3D4((__int64)v8) * 57.296);
if ( v8[1080] )
v10 = -v9;
else
v10 = v9;
if ( (unsigned int)sub_1002FE9C0((__int64)v8)
&& !(*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 1432LL))(a2)
|| (sub_1002FE9C0((__int64)v8) & 1) == 0 && (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 1432LL))(a2) )
{
if ( v10 < 1 )
return (float)(signed int)(v10 - 180 + 360 * ((180 - v10) / 0x168u));
else
return (float)((v10 + 180) % 0x168u);
}
return (float)v10;
}
return v6;
}