//
// LevelEditorLayer::rotationForSlopeNearObject from 0x65ec04 to 0x65edb8 (436 bytes)
//
// 3 xrefs:
// > EditorUI::getSnapAngle @ 0x68f0a0
// > EditorUI::getSnapAngle @ 0x68f0f4
// > ??> @ 0x4dd60
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
float LevelEditorLayer::rotationForSlopeNearObject(LevelEditorLayer *a1, GameObject *a2)
{
unsigned int v4; // w19
cocos2d::CCArray *v5; // x21
GameObject *v6; // x20
int v8; // w19
int v9; // w1
cocos2d::CCRect v10; // [xsp+58h] [xbp+58h] BYREF
cocos2d::CCRect v11; // [xsp+68h] [xbp+68h] BYREF
cocos2d::CCRect v12; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v4 = 0;
GameObject::updateStartPos(a2);
((void (__fastcall *)(cocos2d::CCRect *__return_ptr, GameObject *, float, float))a2->getObjectRect_0)(
&v10,
a2,
1.0,
1.0);
cocos2d::CCRect::CCRect(&v11, &v10);
v5 = LevelEditorLayer::objectsInRect(a1, v12, (bool)&v11);
while ( 1 )
{
if ( v4 >= (unsigned int)cocos2d::CCArray::count(v5) )
return -1.0;
v6 = (GameObject *)cocos2d::CCArray::objectAtIndex(v5, v4);
if ( v6->getType(v6) == Slope )
break;
++v4;
}
GameObject::determineSlopeDirection(v6);
v8 = (-v6->m_slopeUphill ^ (int)(float)(GameObject::getSlopeAngle(v6) * 57.296)) + v6->m_slopeUphill;
if ( GameObject::slopeFloorTop(v6) && !a2->isFlipY(a2) )
goto LABEL_9;
if ( GameObject::slopeFloorTop(v6) )
return (float)v8;
if ( a2->isFlipY(a2) )
{
LABEL_9:
if ( v8 <= 0 )
v9 = v8 - 180;
else
v9 = v8 + 180;
return (float)(v9 % 360);
}
return (float)v8;
}