//
// EditorUI::spriteFromObjectString from 0x100033f30 to 0x1000345a3 (1651 bytes)
//
// 3 xrefs:
// > EditorUI::menuItemFromObjectString @ 0x100031a5c
// > KeyframeGameObject::updateShadowObjects @ 0x1001c69c2
// > GJSmartBlockPreview::addPreview @ 0x100429313
//
// 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
//
const cocos2d::CCPoint *__fastcall EditorUI::spriteFromObjectString(
EditorUI *a1,
__int64 a2,
__int64 a3,
char a4,
int a5,
__int64 a6,
__int64 a7,
__int64 a8)
{
unsigned __int8 v8; // bl
__int64 v9; // r13
cocos2d::CCArray *ObjectsFromString; // r14
unsigned int v11; // r12d
__int64 v12; // r13
GameObject *v13; // r15
int MainColorMode; // ebx
ColorAction *ColorAction; // rbx
__int16 v16; // ax
int SecondaryColorMode; // eax
ColorAction *v18; // rbx
__int16 v19; // ax
cocos2d::CCPoint v20; // xmm0_8
EditorUI *v21; // rbx
GameObject *v22; // rax
unsigned int v23; // r13d
char *v24; // r15
__m128 v25; // xmm0
unsigned int v26; // ebx
cocos2d::CCSprite *v27; // r15
cocos2d::CCSprite *v28; // r15
cocos2d::CCSprite *v29; // r15
cocos2d::CCSprite *v30; // r15
__int64 v31; // rax
__int64 v32; // rax
__int64 v33; // rbx
__m128 inserted; // xmm6
__m128 v35; // xmm7
unsigned int v36; // eax
GameObject *v37; // r12
__int64 v38; // rax
char *v39; // r14
int ObjectZOrder; // ebx
ZLayer ObjectZLayer; // eax
__int64 v42; // rsi
cocos2d::CCSprite *m_colorSprite; // rdi
__int64 v44; // rsi
ZLayer v45; // ebx
__m128 v46; // xmm0
const cocos2d::CCPoint *v47; // r13
unsigned int v48; // ebx
unsigned __int8 *v49; // r12
__m128 v51; // [rsp+0h] [rbp-B0h]
unsigned __int32 v52; // [rsp+10h] [rbp-A0h]
cocos2d::CCArray *v54; // [rsp+28h] [rbp-88h]
__m128 v55; // [rsp+30h] [rbp-80h]
__m128 v57; // [rsp+40h] [rbp-70h]
char v58; // [rsp+58h] [rbp-58h] BYREF
cocos2d::CCSprite *v59; // [rsp+60h] [rbp-50h]
EditorUI *v60; // [rsp+68h] [rbp-48h]
__m128 v61; // [rsp+70h] [rbp-40h]
__int16 v62; // [rsp+80h] [rbp-30h] BYREF
GLubyte b; // [rsp+82h] [rbp-2Eh]
double v64; // 0:xmm0_8.8
v8 = a4 ^ 1;
v9 = a7;
v59 = cocos2d::CCSprite::create_2();
v60 = a1;
ObjectsFromString = (cocos2d::CCArray *)LevelEditorLayer::createObjectsFromString(a1->m_editorLayer, a2, 1, 1);
if ( !(v8 | (a7 == 0)) )
{
v61.i64[0] = (__int64)v60->m_editorLayer->m_levelSettings;
if ( (unsigned int)sub_100720070(ObjectsFromString) )
{
v11 = 0;
do
{
if ( v11 >= (unsigned int)sub_100720070(v9) )
break;
v12 = sub_1007200C0(v9, v11);
v13 = (GameObject *)sub_1007200C0(ObjectsFromString, v11);
MainColorMode = GameObject::getMainColorMode(v13);
if ( GJEffectManager::colorExists(*(GJEffectManager **)(v61.i64[0] + 320), MainColorMode) )
{
ColorAction = GJEffectManager::getColorAction(*(GJEffectManager **)(v61.i64[0] + 320), MainColorMode);
v16 = *(_WORD *)&ColorAction->m_fromColor.r;
b = ColorAction->m_fromColor.b;
v62 = v16;
((void (__fastcall *)(GameObject *, __int16 *))v13->updateMainColor)(v13, &v62);
v13->m_baseColor->m_opacity = ColorAction->m_fromOpacity;
}
if ( *(_QWORD *)(v12 + 888) )
{
SecondaryColorMode = GameObject::getSecondaryColorMode(v13);
v18 = GJEffectManager::getColorAction(*(GJEffectManager **)(v61.i64[0] + 320), SecondaryColorMode);
v19 = *(_WORD *)&v18->m_fromColor.r;
b = v18->m_fromColor.b;
v62 = v19;
((void (__fastcall *)(GameObject *, __int16 *))v13->updateSecondaryColor)(v13, &v62);
v13->m_detailColor->m_opacity = v18->m_fromOpacity;
}
((void (__fastcall *)(GameObject *, __int64))v13->setOpacity)(v13, 255);
if ( a8 )
v13->m_hasGroupParent = v12 == a8;
++v11;
v9 = a7;
}
while ( v11 < (unsigned int)sub_100720070(ObjectsFromString) );
}
}
sub_10028CBE0(&v62, 1000.0, 1000.0);
*(double *)&v20 = sub_10028CC60(&v58, &v62);
v21 = v60;
EditorUI::repositionObjectsToCenter(v60, ObjectsFromString, v20, (bool)&v58);
EditorUI::deleteSmartBlocksFromObjects(v21, ObjectsFromString);
EditorUI::deleteTypeFromObjects(v21, 2065, ObjectsFromString);
if ( a5 > 0 && (unsigned int)sub_100720070(ObjectsFromString) > a5 )
{
do
{
v22 = (GameObject *)sub_1007200E0(ObjectsFromString);
LevelEditorLayer::removeObject(v21->m_editorLayer, v22, 1);
sub_100720200(ObjectsFromString, 1);
}
while ( (unsigned int)sub_100720070(ObjectsFromString) > a5 );
}
if ( (unsigned int)sub_100720070(ObjectsFromString) )
{
v23 = 0;
v24 = &v58;
v25 = 0;
v61 = 0;
v57 = 0;
v54 = ObjectsFromString;
do
{
v37 = (GameObject *)sub_1007200C0(ObjectsFromString, v23);
LevelEditorLayer::removeObject(v21->m_editorLayer, v37, 1);
v38 = ((__int64 (__fastcall *)(GameObject *))v37->getPosition)(v37);
sub_10028CD00(v24, v38, &v62);
v39 = v24;
((void (__fastcall *)(GameObject *, char *))v37->setPosition)(v37, v24);
ObjectZOrder = GameObject::getObjectZOrder(v37);
ObjectZLayer = GameObject::getObjectZLayer(v37);
((void (__fastcall *)(cocos2d::CCSprite *, GameObject *, _QWORD))v59->addChild_0)(
v59,
v37,
(unsigned int)(ObjectZOrder + 10000 * ObjectZLayer));
if ( a6 )
sub_10071FCD0(a6, v37);
GameObject::updateBlendMode(v37);
v42 = 0x30300000001LL;
if ( v37->m_shouldBlendBase )
v42 = 0x100000302LL;
((void (__fastcall *)(GameObject *, __int64))v37->setBlendFunc)(v37, v42);
m_colorSprite = v37->m_colorSprite;
if ( m_colorSprite && !v37->m_unk28c )
{
v44 = 0x30300000001LL;
if ( v37->m_shouldBlendDetail )
v44 = 0x100000302LL;
((void (__fastcall *)(cocos2d::CCSprite *, __int64))m_colorSprite->setBlendFunc)(m_colorSprite, v44);
if ( v37->m_shouldBlendBase == v37->m_shouldBlendDetail )
{
GameObject::addColorSpriteToSelf(v37);
}
else
{
v45 = GameObject::getObjectZLayer(v37);
if ( v37->m_shouldBlendDetail )
v45 += v37->m_colorZLayerRelated;
v26 = GameObject::getObjectZOrder(v37) + 10000 * v45;
v37->m_colorSpriteLocked = 0;
v27 = v37->m_colorSprite;
((void (__fastcall *)(GameObject *))v37->getScaleX)(v37);
((void (__fastcall *)(cocos2d::CCSprite *))v27->setScaleX)(v27);
v28 = v37->m_colorSprite;
((void (__fastcall *)(GameObject *))v37->getScaleY)(v37);
((void (__fastcall *)(cocos2d::CCSprite *))v28->setScaleY)(v28);
v29 = v37->m_colorSprite;
((void (__fastcall *)(GameObject *))v37->getRotation)(v37);
((void (__fastcall *)(cocos2d::CCSprite *))v29->setRotation)(v29);
v30 = v37->m_colorSprite;
v31 = ((__int64 (__fastcall *)(GameObject *))v37->getPosition)(v37);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v30->setPosition)(v30, v31);
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))v37->m_colorSprite->removeFromParentAndCleanup)(
v37->m_colorSprite,
0);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSprite *, _QWORD))v59->addChild_0)(
v59,
v37->m_colorSprite,
v26);
v24 = v39;
}
}
v32 = ((__int64 (__fastcall *)(GameObject *))v37->getPosition)(v37);
*(double *)v25.i64 = sub_10028CC60(v24, v32);
((void (__fastcall *)(GameObject *, char *, double))v37->setStartPos)(v37, v24, *(double *)v25.i64);
v33 = ((__int64 (__fastcall *)(GameObject *))v37->getObjectTextureRect)(v37);
*(double *)v25.i64 = sub_10028D270(v33);
v51 = v25;
*(double *)v25.i64 = sub_10028D230(v33);
v55 = v25;
*(double *)v25.i64 = sub_10028D2C0(v33);
v52 = v25.i32[0];
*(double *)v25.i64 = sub_10028D280(v33);
inserted = _mm_insert_ps(v51, (__m128)v52, 16);
v35 = _mm_insert_ps(v55, v25, 16);
v57 = _mm_blendv_ps(v57, inserted, _mm_or_ps(_mm_cmplt_ps(inserted, v57), _mm_cmpeq_ps(v57, (__m128)0LL)));
v25 = _mm_or_ps(_mm_cmplt_ps(v61, v35), _mm_cmpeq_ps(v61, (__m128)0LL));
v61 = _mm_blendv_ps(v61, v35, v25);
++v23;
ObjectsFromString = v54;
v36 = sub_100720070(v54);
v21 = v60;
}
while ( v23 < v36 );
v46 = _mm_sub_ps(v61, v57);
}
else
{
v46 = 0;
}
sub_10028CBF0(&v58, v46.f32[0], _mm_movehdup_ps(v46).f32[0]);
v47 = (const cocos2d::CCPoint *)v59;
((void (__fastcall *)(cocos2d::CCSprite *, char *))v59->setContentSize)(v59, &v58);
if ( (unsigned int)sub_100720070(ObjectsFromString) )
{
v48 = 0;
do
{
v49 = (unsigned __int8 *)sub_1007200C0(ObjectsFromString, v48);
(*(void (__fastcall **)(unsigned __int8 *))(*(_QWORD *)v49 + 192LL))(v49);
*(cocos2d::CCPoint *)&v64 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v58, v47);
(*(void (__fastcall **)(unsigned __int8 *, char *, double))(*(_QWORD *)v49 + 184LL))(v49, &v58, v64);
(*(void (__fastcall **)(unsigned __int8 *, _QWORD))(*(_QWORD *)v49 + 328LL))(v49, v49[1294] ^ 1u);
++v48;
}
while ( v48 < (unsigned int)sub_100720070(ObjectsFromString) );
}
return v47;
}