//
// EditorUI::doPasteObjects from 0x10003e170 to 0x10003e422 (690 bytes)
//
// 3 xrefs:
// > EditorUI::onPaste @ 0x10002ae17
// > EditorUI::keyDown @ 0x1000505eb
// > EditorPauseLayer::onPasteWColor @ 0x100293e78
//
// 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
//
void __fastcall EditorUI::doPasteObjects(EditorUI *a1, bool a2)
{
double v2; // xmm0_8
GameManager *v3; // rax
unsigned int sizex2; // ecx
int v5; // r15d
int v6; // r15d
GJGameLevel *m_level; // rax
GameManager *v8; // rax
cocos2d::CCArray *v9; // r14
cocos2d::CCLayer *m_objectLayer; // r12
float m_gridSize; // xmm2_4
__m128 v12; // xmm0
__m128 v13; // xmm1
__m128 v14; // xmm0
cocos2d::CCPoint v15; // xmm0_8
char v16; // [rsp+0h] [rbp-70h] BYREF
_BYTE v17[8]; // [rsp+8h] [rbp-68h] BYREF
std::string m_editorClipboard; // [rsp+10h] [rbp-60h] BYREF
float v19[2]; // [rsp+30h] [rbp-40h] BYREF
float v20; // [rsp+38h] [rbp-38h] BYREF
float v21; // [rsp+3Ch] [rbp-34h]
double v22[6]; // [rsp+40h] [rbp-30h] BYREF
v3 = GameManager::sharedState();
sizex2 = v3->m_editorClipboard.m_data.m_short.sizex2;
if ( (sizex2 & 1) != 0 )
{
if ( !v3->m_editorClipboard.m_data.m_long.size )
return;
}
else if ( !(sizex2 >> 1) )
{
return;
}
v5 = a1->m_editorLayer->m_objectCount.random - a1->m_editorLayer->m_objectCount.seed;
v6 = GameManager::sharedState()->m_copiedObjectCount + v5;
if ( v6 >= 80001 )
{
m_level = a1->m_editorLayer->m_level;
if ( !m_level->m_unlimitedObjectsEnabled )
{
EditorUI::showMaxError(a1);
return;
}
LABEL_10:
if ( !m_level->m_highObjectsEnabled )
{
EditorUI::showMaxBasicError(a1);
return;
}
goto LABEL_11;
}
if ( v6 >= 40001 )
{
m_level = a1->m_editorLayer->m_level;
goto LABEL_10;
}
LABEL_11:
v8 = GameManager::sharedState();
if ( (v8->m_editorClipboard.m_data.m_short.sizex2 & 1) != 0 )
sub_100006B70(
&m_editorClipboard,
v8->m_editorClipboard.m_data.m_long.longStorage,
v8->m_editorClipboard.m_data.m_long.size,
v2);
else
m_editorClipboard = v8->m_editorClipboard;
v9 = EditorUI::pasteObjects(a1, (std::string *)&m_editorClipboard, a2, 0);
if ( (m_editorClipboard.m_data.m_short.sizex2 & 1) != 0 )
operator delete(m_editorClipboard.m_data.m_long.longStorage);
if ( v9 && (unsigned int)sub_100720070(v9) )
{
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v19);
m_objectLayer = a1->m_editorLayer->m_objectLayer;
sub_10028CBE0(v22, v19[0] * 0.5, (float)(a1->m_toolbarHeight * 0.5) + (float)(v19[1] * 0.5));
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v16, (const cocos2d::CCPoint *)m_objectLayer);
sub_10028CC60(&v20);
m_gridSize = a1->m_editorLayer->m_drawGridLayer->m_gridSize;
v12 = (__m128)LODWORD(v20);
v13 = (__m128)LODWORD(v21);
v12.f32[0] = v20 / m_gridSize;
v13.f32[0] = v21 / m_gridSize;
sub_10028CBE0(
v22,
(float)(_mm_round_ss(v12, v12, 9).f32[0] + 0.5) * m_gridSize,
(float)(_mm_round_ss(v13, v13, 9).f32[0] + 0.5) * m_gridSize);
if ( a1->m_editorLayer->m_levelSettings->m_dynamicLevelHeight )
v14 = (__m128)0x46EB1400u;
else
v14 = (__m128)0x451BA000u;
_mm_storel_ps(
v22,
_mm_min_ps(
_mm_max_ps((__m128)*(unsigned __int64 *)&v22[0], (__m128)xmmword_100815470),
_mm_insert_ps((__m128)xmmword_100815490, v14, 16)));
sub_10028CC60(v17);
sub_10028CC90(&v16, v17);
*(double *)&v15 = sub_10028CC60(v22);
EditorUI::repositionObjectsToCenter(a1, v9, v15, (bool)v22);
}
EditorUI::updateButtons(a1);
EditorUI::updateObjectInfoLabel(a1);
}