//
// EditorUI::convertKeyBasedOnNeighbors from 0x66b5b0 to 0x66b8b2 (770 bytes)
//
// 2 xrefs:
// > EditorUI::processSmartObjectsFromType @ 0x482af4
// > EditorUI::processSmartObjectsFromType @ 0x482b84
//
// 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:55:45 +0000
//
int __fastcall EditorUI::convertKeyBasedOnNeighbors(
EditorUI *a1,
int a2,
int a3,
const cocos2d::CCPoint *a4,
cocos2d::CCArray *a5)
{
int v8; // r4
_BOOL4 v9; // r6
_BOOL4 v10; // r5
_BOOL4 v11; // r7
int result; // r0
int v13; // r2
float v14; // r0
_BOOL4 v15; // r2
_BOOL4 v16; // [sp+Ch] [bp-8h]
_BYTE v17[8]; // [sp+14h] [bp+0h] BYREF
v8 = EditorUI::convertToBaseKey(a1, a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v17, a4);
v16 = EditorUI::getNeighbor((int)a1, a3, (int)v17, 1, a5) != 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v17, a4);
v9 = EditorUI::getNeighbor((int)a1, a3, (int)v17, 2, a5) != 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v17, a4);
v10 = EditorUI::getNeighbor((int)a1, a3, (int)v17, 3, a5) != 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v17, a4);
v11 = EditorUI::getNeighbor((int)a1, a3, (int)v17, 4, a5) != 0;
if ( v8 == 2838 )
{
if ( v16 )
{
if ( v9 )
return v8;
result = 2846;
}
else
{
result = 2842;
}
goto LABEL_100;
}
if ( v8 > 2838 )
{
if ( v8 != 2840 )
{
if ( v8 < 2840 )
{
if ( v16 && v9 || v11 )
{
return 2839;
}
else if ( v16 )
{
result = 2847;
if ( v9 )
return 2839;
}
else
{
return 2843;
}
}
else
{
if ( v8 != 2841 || v16 && v9 )
return v8;
if ( v11 )
{
return 2841;
}
else if ( v16 )
{
result = 2849;
if ( v9 )
return 2841;
}
else
{
return 2845;
}
}
return result;
}
if ( v16 )
{
if ( !v9 )
{
if ( v10 )
return 2840;
else
return 2848;
}
return v8;
}
result = 2844;
LABEL_100:
if ( v10 )
return v8;
return result;
}
if ( v8 == 2703 )
{
if ( v16 )
{
if ( v9 )
{
if ( v10 )
{
result = 2811;
if ( v11 )
return 2703;
return result;
}
result = 2812;
v13 = 2810;
}
else
{
if ( !v10 )
{
result = 2819;
if ( v11 )
return 2816;
return result;
}
result = 2817;
v13 = 2809;
}
}
else if ( v9 )
{
if ( v10 )
{
result = 2815;
v13 = 2808;
}
else
{
result = 2818;
v13 = 2814;
}
}
else if ( v10 )
{
result = 2821;
v13 = 2813;
}
else
{
result = 2822;
v13 = 2820;
}
LABEL_49:
if ( v11 )
return v13;
return result;
}
if ( v8 == 2704 )
{
if ( v16 )
{
if ( v9 )
{
if ( v10 )
{
result = 2826;
if ( v11 )
return 2704;
return result;
}
result = 2827;
v13 = 2825;
}
else
{
if ( v10 )
{
result = 2824;
if ( !v11 )
return 2832;
return result;
}
result = 2834;
v13 = 2831;
}
}
else if ( v9 )
{
if ( v10 )
{
result = 2830;
v13 = 2823;
}
else
{
result = 2833;
v13 = 2829;
}
}
else if ( v10 )
{
result = 2836;
v13 = 2828;
}
else
{
result = 2837;
v13 = 2835;
}
goto LABEL_49;
}
if ( v8 != 869 )
return v8;
v14 = (float)sub_66ACA0();
v15 = (float)(v14 / 32767.0) > 0.5;
if ( v16 )
{
if ( v9 )
{
if ( v10 )
{
if ( v11 )
return v8;
goto LABEL_88;
}
goto LABEL_84;
}
goto LABEL_83;
}
if ( v9 )
{
LABEL_83:
if ( !v10 )
{
LABEL_84:
result = 1266;
if ( v15 )
return 871;
return result;
}
goto LABEL_87;
}
if ( !v10 )
{
if ( !v11 )
{
if ( (float)(v14 / 32767.0) <= 0.5 )
return 868;
else
return 867;
}
goto LABEL_84;
}
LABEL_87:
if ( !v11 )
{
LABEL_88:
if ( (float)(v14 / 32767.0) <= 0.5 )
return 1267;
else
return 872;
}
result = 870;
if ( v15 )
return 869;
return result;
}