//
// EditorUI::doPasteObjects from 0x1401c5ea0 to 0x1401c60ff (607 bytes)
//
// 4 xrefs:
// > EditorCommandsPopup::onCommand @ 0x14017dcb8
// > EditorUI::handleEditorAction @ 0x1401c35a5
// > EditorUI::onPaste @ 0x1401c5e8d
// > ??> @ 0x14091a774
//
// 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:05 +0000
//
// Hidden C++ exception states: #wind=3
void __fastcall EditorUI::doPasteObjects(__int64 a1, unsigned __int8 a2)
{
__int64 v4; // r8
__int64 v5; // rdx
int v6; // r9d
__int64 v7; // rsi
__int64 v8; // rax
cocos2d::CCArray *v9; // rbp
__int64 v10; // r8
int v11; // eax
int v12; // ecx
int v13; // edx
__int64 v14; // rcx
__int64 v15; // rax
__int64 v16; // rbx
__int64 v17; // rax
float *v18; // rax
__int64 GridSnappedPos; // rax
__int64 v20; // rax
_BYTE v21[8]; // [rsp+20h] [rbp-48h] BYREF
_BYTE v22[8]; // [rsp+28h] [rbp-40h] BYREF
_BYTE v23[56]; // [rsp+30h] [rbp-38h] BYREF
void *v24; // [rsp+80h] [rbp+18h] BYREF
float v25; // [rsp+88h] [rbp+20h] BYREF
float v26; // [rsp+8Ch] [rbp+24h]
v4 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v24 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v24);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v4 = qword_14090BFD0;
}
if ( *(_QWORD *)(v4 + 536) )
{
v5 = *(_QWORD *)(a1 + 1512);
v6 = *(_DWORD *)(v4 + 552) + *(_DWORD *)(v5 + 14928) - *(_DWORD *)(v5 + 14932);
if ( v6 > 80000 && !*(_BYTE *)(*(_QWORD *)(v5 + 2168) + 1297LL) )
{
EditorUI::showMaxError(a1);
return;
}
v7 = a1 + 1512;
if ( v6 > 40000 )
{
if ( !*(_BYTE *)(*(_QWORD *)(v5 + 2168) + 1296LL) )
{
EditorUI::showMaxBasicError(a1);
return;
}
v7 = a1 + 1512;
}
v8 = sub_14003F4F0((__int64)v23, v4 + 520);
v9 = (cocos2d::CCArray *)EditorUI::pasteObjects(a1, v8, a2, 0);
v10 = *(_QWORD *)(a1 + 1512);
v11 = *(_DWORD *)(v10 + 15504);
if ( v11 >= 0 )
{
v12 = *(_DWORD *)(v10 + 15440) - v11;
v13 = 0;
if ( v12 > 1 )
{
do
{
if ( v13 >= 7 )
break;
v12 = (unsigned int)v12 >> 1;
++v13;
}
while ( (unsigned int)v12 > 1 );
}
++*(_DWORD *)(v10 + 4LL * v13 + 15472);
v7 = a1 + 1512;
}
*(_DWORD *)(v10 + 15504) = *(_DWORD *)(v10 + 15440);
if ( v9 )
{
if ( cocos2d::CCArray::count(v9) )
{
v15 = cocos2d::CCDirector::sharedDirector(v14);
cocos2d::CCDirector::getWinSize(v15, &v25);
v16 = *(_QWORD *)(*(_QWORD *)v7 + 4296LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v21,
v25 * 0.5,
(float)(*(float *)(a1 + 904) * 0.5) + (float)(v26 * 0.5));
cocos2d::CCNode::convertToNodeSpace(v16, &v24, v17);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v21, (const struct cocos2d::CCPoint *)&v24);
GridSnappedPos = EditorUI::getGridSnappedPos(a1, (__int64)v22, v18);
cocos2d::CCPoint::operator=(&v24, GridSnappedPos);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v22, (const struct cocos2d::CCPoint *)&v24);
EditorUI::repositionObjectsToCenter(a1, v9, v20, 0);
}
}
EditorUI::updateButtons(a1);
EditorUI::updateObjectInfoLabel(a1);
}
}