//
// SetupSmartBlockLayer::onPasteTemplate from 0x6739a4 to 0x673b22 (382 bytes)
//
// 0 xrefs:
//
// 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:54 +0000
//
int __fastcall SetupSmartBlockLayer::onPasteTemplate(SetupSmartBlockLayer *this, cocos2d::CCObject *a2)
{
GameManager *v3; // r0
int v4; // r6
cocos2d::CCArray *v5; // r5
GameManager *v6; // r0
int v7; // r0
cocos2d::CCDirector *v8; // r0
GameManager *WinSize; // r0
GameManager *v10; // r0
float v11; // s18
float v12; // s16
const cocos2d::CCPoint *v13; // r10
int v14; // r0
GameManager *v15; // r0
int v16; // r11
GameManager *v17; // r0
int v18; // r10
GameLevelManager *v19; // r0
GameLevelManager *v20; // r0
GameManager *ActiveSmartTemplate; // r0
GJSmartTemplate *v22; // r4
int v23; // r0
float v25[2]; // [sp+10h] [bp-34h] BYREF
_BYTE v26[8]; // [sp+18h] [bp-2Ch] BYREF
float v27[2]; // [sp+20h] [bp-24h] BYREF
_BYTE v28[8]; // [sp+28h] [bp-1Ch] BYREF
int v29[3]; // [sp+30h] [bp-14h] BYREF
v3 = (GameManager *)GameManager::sharedState(this);
if ( *((_DWORD *)v3 + 102) )
{
memset(v29, 0, sizeof(v29));
v4 = *(_DWORD *)(*(_DWORD *)(GameManager::sharedState(v3) + 408) + 11856);
std::string::__init(v29, a12895236453195, 0x175Fu);
v5 = (cocos2d::CCArray *)EditorUI::pasteObjects(v4, (int)v29);
v6 = (GameManager *)std::string::~string((int)v29);
v7 = GameManager::sharedState(v6);
EditorBuildStats::noteAction(*(_DWORD *)(v7 + 408) + 12104);
if ( v5 )
{
v8 = (cocos2d::CCDirector *)cocos2d::CCArray::count(v5);
if ( v8 )
{
cocos2d::CCDirector::sharedDirector(v8);
WinSize = (GameManager *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v25);
v10 = (GameManager *)GameManager::sharedState(WinSize);
v11 = v25[0] * 0.5;
v12 = v25[1] * 0.5;
v13 = *(const cocos2d::CCPoint **)(*((_DWORD *)v10 + 102) + 2436);
v14 = GameManager::sharedState(v10);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v28,
v11,
v12 + (float)(*(float *)(*(_DWORD *)(*(_DWORD *)(v14 + 408) + 11856) + 632) * 0.5));
v15 = (GameManager *)cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v26, v13);
v16 = *(_DWORD *)(*(_DWORD *)(GameManager::sharedState(v15) + 408) + 11856);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v27, (const cocos2d::CCPoint *)v26);
EditorUI::getGridSnappedPos((int)v28, v16, v27);
v17 = (GameManager *)cocos2d::CCPoint::operator=(v26, v28);
v18 = *(_DWORD *)(*(_DWORD *)(GameManager::sharedState(v17) + 408) + 11856);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v28, (const cocos2d::CCPoint *)v26);
v19 = (GameLevelManager *)EditorUI::repositionObjectsToCenter(v18, v5, v28, 0);
v20 = (GameLevelManager *)GameLevelManager::sharedState(v19);
ActiveSmartTemplate = (GameManager *)GameLevelManager::getActiveSmartTemplate(v20);
v22 = ActiveSmartTemplate;
if ( ActiveSmartTemplate )
{
v23 = GameManager::sharedState(ActiveSmartTemplate);
EditorUI::createSmartObjectsFromTemplate(
*(cocos2d::CCArray ****)(*(_DWORD *)(v23 + 408) + 11856),
v22,
v5,
0,
1,
1,
0);
}
}
}
}
return SetupSmartBlockLayer::onClose((cocos2d::CCArray **)this, nullptr);
}