//
// SetupSmartBlockLayer::onCreate from 0x9dbf64 to 0x9dc050 (236 bytes)
//
// 3 xrefs:
// > ??> @ 0xb19d8
// > SetupSmartBlockLayer::init @ 0x9dcf78
// > ??> @ 0x122e278
//
// 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 SetupSmartBlockLayer::onCreate(SetupSmartBlockLayer *a1, cocos2d::CCObject *a2)
{
cocos2d::CCArray *v3; // x0
cocos2d::CCArray *v4; // x21
SmartGameObject *m_gameObject; // x1
int m_specialTemplate; // w0
bool v7; // w20
EditorUI *m_editorUI; // x22
int RandomStartKey; // w0
int v10; // w0
cocos2d::CCArray *m_gameObjects; // x1
GameLevelManager *v12; // x0
GameManager *v13; // x0
GJSmartTemplate *ActiveSmartTemplate; // [xsp+38h] [xbp+38h]
v3 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)a1);
v4 = v3;
m_gameObject = a1->m_gameObject;
if ( m_gameObject )
{
cocos2d::CCArray::addObject(v3, m_gameObject);
}
else
{
m_gameObjects = a1->m_gameObjects;
if ( m_gameObjects )
{
cocos2d::CCArray::addObjectsFromArray(v3, m_gameObjects);
m_specialTemplate = a1->m_specialTemplate;
if ( (m_specialTemplate & 0x80000000) == 0 )
goto LABEL_4;
LABEL_10:
v12 = GameLevelManager::sharedState();
ActiveSmartTemplate = GameLevelManager::getActiveSmartTemplate(v12);
v13 = GameManager::sharedState();
EditorUI::createSmartObjectsFromTemplate(
v13->m_levelEditorLayer->m_editorUI,
ActiveSmartTemplate,
v4,
a1->m_useNearby,
a1->m_dontDelete,
0,
0);
SetupSmartBlockLayer::onClose(a1, nullptr);
return;
}
}
m_specialTemplate = a1->m_specialTemplate;
if ( m_specialTemplate < 0 )
goto LABEL_10;
LABEL_4:
v7 = m_specialTemplate == 9;
if ( m_specialTemplate == 9 )
a1->m_specialTemplate = (unsigned int)byte_8;
m_editorUI = GameManager::sharedState()->m_levelEditorLayer->m_editorUI;
RandomStartKey = EditorUI::getRandomStartKey(a1->m_specialTemplate);
v10 = EditorUI::smartTypeForKey(RandomStartKey);
EditorUI::createSmartObjectsFromType(m_editorUI, v10, v4, v7, a1->m_dontDelete);
SetupSmartBlockLayer::onClose(a1, nullptr);
}