//
// GJSmartBlockPreview::addPreview from 0x100009164 to 0x1000092d4 (368 bytes)
//
// 2 xrefs:
// > BrowseSmartTemplateLayer::addPrefabMenuItem @ 0x100071ed0
// > BrowseSmartKeyLayer::init @ 0x100072e10
//
// 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 GJSmartBlockPreview::addPreview(__int64 a1, std::string *a2, __int64 a3, LevelEditorLayer *a4)
{
cocos2d::CCArray *v8; // x20
EditorUI *m_editorUI; // x24
__int64 v10; // x23
SmartBlockType v11; // w22
float v12; // s8
__n128 v13; // q1
__n128 v14; // q0
_BYTE v15[8]; // [xsp+8h] [xbp-78h] BYREF
_BYTE v16[8]; // [xsp+10h] [xbp-70h] BYREF
__int64 v17; // [xsp+18h] [xbp-68h] BYREF
void *__p[2]; // [xsp+20h] [xbp-60h] BYREF
__int64 v19; // [xsp+30h] [xbp-50h]
cocos2d::CCPoint v20; // 0:kr08_8.8
if ( (*(char *)(a3 + 23) & 0x8000000000000000LL) != 0 )
{
if ( !*(_QWORD *)(a3 + 8) )
return;
}
else if ( !*(_BYTE *)(a3 + 23) )
{
return;
}
v8 = (cocos2d::CCArray *)sub_10024A15C();
m_editorUI = a4->m_editorUI;
if ( *(char *)(a3 + 23) < 0 )
{
sub_1000097D0(__p, *(void **)a3);
}
else
{
*(_OWORD *)__p = *(_OWORD *)a3;
v19 = *(_QWORD *)(a3 + 16);
}
v10 = EditorUI::spriteFromObjectString(m_editorUI, __p, 0, 0, 0, v8, 0, 0);
if ( SHIBYTE(v19) < 0 )
operator delete(__p[0]);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 448LL))(a1, v10, 10);
v11 = *std::string::at(a2, 0);
v12 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 312LL))(a1) * 0.5;
v13.n128_f32[0] = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 312LL))(a1) + 4) * 0.5;
v14.n128_f32[0] = v12;
sub_100022980(v14, v13);
v20 = GJSmartTemplate::offsetForType(v11);
sub_1000229DC(&v17, v16, v15, v20.x, v20.y);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v10 + 184LL))(v10, &v17);
LevelEditorLayer::updateObjectColors(a4, v8);
}