//
// GJSmartBlockPreview::addPreview from 0x1402b65f0 to 0x1402b6769 (377 bytes)
//
// 3 xrefs:
// > BrowseSmartTemplateLayer::addPrefabMenuItem @ 0x14045a637
// > BrowseSmartKeyLayer::init @ 0x14045b8ac
// > ??> @ 0x1406d2480
//
// 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
//
// Hidden C++ exception states: #wind=2
void __fastcall GJSmartBlockPreview::addPreview(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
float v4; // xmm0_4
cocos2d::CCArray *v9; // r12
__int64 v10; // rax
cocos2d::CCNode *v11; // r15
__int64 v12; // rcx
float *v13; // rax
__int64 v14; // rax
cocos2d::CCPoint v15; // [rsp+40h] [rbp-98h] BYREF
char v16; // [rsp+48h] [rbp-90h] BYREF
_BYTE v17[32]; // [rsp+58h] [rbp-80h] BYREF
__int64 v18; // [rsp+78h] [rbp-60h]
__int64 v19; // [rsp+80h] [rbp-58h]
v18 = a2;
v19 = a3;
if ( *(_QWORD *)(a3 + 16) )
{
v9 = (cocos2d::CCArray *)cocos2d::CCArray::create(a1);
v10 = sub_14003BDB0((__int64)v17, a3);
v11 = EditorUI::spriteFromObjectString(*(_QWORD *)(a4 + 14496), v10, 0, 0, 0, v9, nullptr, 0);
(*(void (__fastcall **)(__int64, cocos2d::CCNode *, __int64))(*(_QWORD *)a1 + 440LL))(a1, v11, 10);
if ( !*(_QWORD *)(a2 + 16) )
sub_14003BCC0(v12);
GJSmartTemplate::offsetForType((SmartBlockType)&v16);
(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 304LL))(a1);
v13 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 304LL))(a1);
cocos2d::CCPoint::CCPoint(v4, *v13 * 0.5);
cocos2d::CCPoint::operator+(v14, &v15);
v11->setPosition_0(v11, &v15);
LevelEditorLayer::updateObjectColors((LevelEditorLayer *)a4, v9);
}
sub_14003A830(a2);
sub_14003A830(a3);
}