//
// EditorUI::startFreeMoveTouch from 0x1401bfaf0 to 0x1401bfda8 (696 bytes)
//
// 3 xrefs:
// > EditorUI::finishTouchDelay @ 0x1401bfecd
// > EditorUI::ccTouchBegan @ 0x1401c0311
// > ??> @ 0x14091a660
//
// 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:28:02 +0000
//
void __fastcall EditorUI::startFreeMoveTouch(__int64 a1)
{
_BYTE *v2; // rbx
_QWORD *v3; // r15
__int64 *v4; // r14
unsigned int v5; // esi
__int64 v6; // rcx
__int64 v7; // rcx
__int64 v8; // rax
cocos2d::CCArray *v9; // rcx
const struct cocos2d::CCPoint *v10; // rax
__int64 v11; // rax
__int64 v12; // rbx
__int64 v13; // rax
cocos2d::CCArray *v14; // rbx
struct cocos2d::CCObject *v15; // rax
__int64 v16; // rax
const struct cocos2d::CCPoint *v17; // rax
__int64 v18; // rcx
__int64 v19; // rax
__int64 v20; // rdx
cocos2d::CCArray **UndoObject; // rax
cocos2d::CCArray **v22; // rbx
cocos2d::CCObject *v23; // rcx
char v24; // [rsp+50h] [rbp+8h] BYREF
char v25; // [rsp+58h] [rbp+10h] BYREF
v2 = (_BYTE *)(a1 + 914);
v3 = (_QWORD *)(a1 + 1576);
*(_BYTE *)(a1 + 914) = 0;
v4 = (__int64 *)(a1 + 1512);
v5 = 0;
v6 = *(_QWORD *)(a1 + 1512);
*v3 = 0;
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(v6 + 4296), &v24, a1 + 1520);
v8 = cocos2d::CCDirector::sharedDirector(v7);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v8 + 176LL))(v8) + 154) )
{
if ( !*(_QWORD *)(a1 + 1568) )
{
if ( !cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 944)) )
goto LABEL_6;
v2 = (_BYTE *)(a1 + 914);
v4 = (__int64 *)(a1 + 1512);
}
EditorUI::onDuplicate(a1, 0);
*(_BYTE *)(a1 + 737) = 1;
v3 = (_QWORD *)(a1 + 1576);
}
LABEL_6:
v9 = *(cocos2d::CCArray **)(a1 + 944);
*(_BYTE *)(a1 + 1586) = 0;
if ( cocos2d::CCArray::count(v9) )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, (const struct cocos2d::CCPoint *)&v24);
EditorUI::findSnapObject(a1, v10);
}
else if ( *(_QWORD *)(a1 + 1568) )
{
v12 = *v4;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, (const struct cocos2d::CCPoint *)&v24);
v14 = (cocos2d::CCArray *)LevelEditorLayer::objectsAtPosition(v12, v13);
if ( cocos2d::CCArray::count(v14) )
{
while ( 1 )
{
v15 = cocos2d::CCArray::objectAtIndex(v14, v5);
if ( *((_DWORD *)v15 + 231) == *(_DWORD *)(*(_QWORD *)(a1 + 1568) + 924LL) )
break;
if ( ++v5 >= cocos2d::CCArray::count(v14) )
goto LABEL_16;
}
*(_QWORD *)(a1 + 1576) = v15;
}
LABEL_16:
if ( !*(_QWORD *)(a1 + 1576) && (!*(_QWORD *)(a1 + 1568) || !*(_BYTE *)(a1 + 908)) )
{
*(_BYTE *)(a1 + 738) = 1;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, (const struct cocos2d::CCPoint *)(a1 + 1520));
EditorUI::clickOnPosition(a1, v16);
if ( *(_BYTE *)(a1 + 914) )
*(_QWORD *)(a1 + 1576) = *(_QWORD *)(a1 + 1568);
}
}
else
{
*(_BYTE *)(a1 + 738) = 1;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, (const struct cocos2d::CCPoint *)(a1 + 1520));
EditorUI::clickOnPosition(a1, v11);
if ( *v2 )
*v3 = *(_QWORD *)(a1 + 1568);
}
if ( *(_BYTE *)(a1 + 1586) && !*(_QWORD *)(a1 + 1576) && cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 944)) )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, (const struct cocos2d::CCPoint *)&v24);
EditorUI::findSnapObject(a1, v17);
}
v18 = *(_QWORD *)(a1 + 1576);
if ( v18 )
{
*(_BYTE *)(a1 + 913) = 1;
v19 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v18 + 200LL))(v18);
cocos2d::CCPoint::operator=(a1 + 936, v19);
}
cocos2d::CCPoint::operator=(a1 + 1552, &v24);
if ( !*(_BYTE *)(a1 + 737) )
{
UndoObject = EditorUI::createUndoObject(a1, v20, 1);
v22 = UndoObject;
if ( *(cocos2d::CCArray ***)(a1 + 728) != UndoObject )
{
if ( UndoObject )
cocos2d::CCObject::retain((cocos2d::CCObject *)UndoObject);
v23 = *(cocos2d::CCObject **)(a1 + 728);
if ( v23 )
cocos2d::CCObject::release(v23);
*(_QWORD *)(a1 + 728) = v22;
}
}
}