//
// LevelEditorLayer::rotationForSlopeNearObject from 0x1403f1050 to 0x1403f11e9 (409 bytes)
//
// 10 xrefs:
// > EditorUI::handleEditorAction @ 0x1401c4015
// > EditorUI::handleEditorAction @ 0x1401c4044
// > EditorUI::handleEditorAction @ 0x1401c40d5
// > EditorUI::handleEditorAction @ 0x1401c4104
// > EditorUI::transformObjectCall_1 @ 0x1401ff4a5
// > EditorUI::transformObjectCall_1 @ 0x1401ff4d8
// > EditorUI::transformObjectCall_1 @ 0x1401ff6f5
// > EditorUI::transformObjectCall_1 @ 0x1401ff780
// > EditorUI::transformObject @ 0x1401ffc2d
// > ??> @ 0x14092534c
//
// This function is hookable on this platform (idp: pc, 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:31:47 +0000
//
float __fastcall LevelEditorLayer::rotationForSlopeNearObject(__int64 a1, __int64 a2)
{
__int64 v4; // rax
__int64 v5; // r8
cocos2d::CCArray *v6; // rsi
unsigned int v7; // ebx
struct cocos2d::CCObject *v8; // rdi
const struct cocos2d::CCRect *v10; // rax
float v11; // xmm0_4
int v12; // ecx
int v13; // ebx
int v14; // ecx
int v15; // ebx
_BYTE v16[8]; // [rsp+20h] [rbp-28h] BYREF
float v17; // [rsp+28h] [rbp-20h]
float v18; // [rsp+2Ch] [rbp-1Ch]
_BYTE v19[24]; // [rsp+30h] [rbp-18h] BYREF
GameObject::updateStartPos(a2);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)a2 + 1176LL))(a2, v19);
v4 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)v16, (const struct cocos2d::CCRect *)v19);
LOBYTE(v5) = 1;
v6 = (cocos2d::CCArray *)LevelEditorLayer::objectsInRect(a1, v4, v5);
v7 = 0;
if ( !cocos2d::CCArray::count(v6) )
return -1.0;
while ( 1 )
{
v8 = cocos2d::CCArray::objectAtIndex(v6, v7);
if ( (*(unsigned int (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v8 + 1648LL))(v8) == 25 )
break;
if ( ++v7 >= cocos2d::CCArray::count(v6) )
return -1.0;
}
GameObject::determineSlopeDirection((__int64)v8);
v10 = (const struct cocos2d::CCRect *)(*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v8 + 1184LL))(v8);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v16, v10);
v11 = atanf(v18 / v17);
v12 = *((_DWORD *)v8 + 273);
v13 = -(int)(float)(v11 * 57.29578);
if ( !*((_BYTE *)v8 + 1088) )
v13 = (int)(float)(v11 * 57.29578);
if ( (v12 == 1 || ((v12 - 3) & 0xFFFFFFFC) == 0 && v12 != 4)
&& !(*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)a2 + 1280LL))(a2)
|| (v14 = *((_DWORD *)v8 + 273), v14 != 1)
&& (((v14 - 3) & 0xFFFFFFFC) != 0 || v14 == 4)
&& (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)a2 + 1280LL))(a2) )
{
if ( v13 <= 0 )
v15 = v13 - 180;
else
v15 = v13 + 180;
return (float)(v15 % 360);
}
return (float)v13;
}