//
// LevelEditorLayer::breakApartTextObject from 0x1402df5b0 to 0x1402df8bb (779 bytes)
//
// 2 xrefs:
// > CustomizeObjectLayer::onBreakApart @ 0x1400a9b88
// > ??> @ 0x1406d3530
//
// 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=1
void LevelEditorLayer::breakApartTextObject(LevelEditorLayer *a1, TextGameObject *a2)
{
float v2; // xmm0_4
LevelEditorLayer *v4; // r13
EditorUI *m_editorUI; // rcx
cocos2d::CCArray *v6; // r15
__int64 v7; // rcx
cocos2d::CCArray *v8; // rdi
signed int v9; // ebx
unsigned __int64 v10; // rdi
unsigned __int64 v11; // rbp
unsigned __int64 v12; // rsi
_QWORD *v13; // r12
float *v14; // rax
__int64 v15; // rcx
float *v16; // r13
_QWORD *v17; // rcx
float v18; // xmm8_4
float *v19; // rax
cocos2d::CCPoint v20; // rax
GameObject *Object; // rbp
_QWORD *v22; // rdx
EditorUI *v23; // rcx
bool v24; // [rsp+20h] [rbp-108h]
cocos2d::CCArray *v25; // [rsp+28h] [rbp-100h]
struct cocos2d::CCPoint v27; // [rsp+38h] [rbp-F0h] BYREF
__int128 v28; // [rsp+40h] [rbp-E8h] BYREF
__int64 v29; // [rsp+50h] [rbp-D8h]
__int64 v30; // [rsp+58h] [rbp-D0h]
struct cocos2d::CCPoint v31; // [rsp+68h] [rbp-C0h] BYREF
cocos2d::CCPoint v32; // [rsp+70h] [rbp-B8h] BYREF
_QWORD v33[2]; // [rsp+80h] [rbp-A8h] BYREF
unsigned __int64 v34; // [rsp+90h] [rbp-98h]
unsigned __int64 v35; // [rsp+98h] [rbp-90h]
if ( a2 )
{
v4 = a1;
if ( a2->m_objectID == 914 )
{
m_editorUI = a1->m_editorUI;
if ( m_editorUI )
EditorUI::deselectAll(m_editorUI);
LevelEditorLayer::removeObject(v4, a2, 0);
v4->m_textLayerB1->addChild_1(v4->m_textLayerB1, a2);
sub_14003BDB0((__int64)v33, (__int64)&a2->m_text);
v6 = a2->getChildren(a2);
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
v25 = v8;
v9 = 0;
if ( cocos2d::CCArray::count(v6) )
{
v10 = 0;
v11 = v35;
v12 = v34;
v13 = (_QWORD *)v33[0];
do
{
v14 = (float *)cocos2d::CCArray::objectAtIndex(v6, v9);
v16 = v14;
if ( v12 <= v10 )
sub_14003BCC0(v15);
v17 = v33;
v24 = v11 > 0xF;
if ( v11 > 0xF )
v17 = v13;
if ( *((_BYTE *)v17 + v10) == 32 )
{
v4 = a1;
}
else
{
v18 = v14[150];
(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v14 + 304LL))(v14);
v19 = (float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v16 + 200LL))(v16);
cocos2d::CCPoint::CCPoint(v2, *v19 - v18);
cocos2d::CCNode::convertToWorldSpace(a2, &v31);
v4 = a1;
cocos2d::CCNode::convertToNodeSpace(a1->m_textLayerB1, &v27);
cocos2d::CCPoint::CCPoint(&v32);
Object = LevelEditorLayer::createObject(a1, 914, v20, 0);
GameObject::duplicateValues(Object);
v2 = 0.0;
v28 = 0;
v29 = 0;
v30 = 0;
if ( v12 < v9 )
sub_14003BCC0(v9);
v22 = v33;
if ( v24 )
v22 = v13;
sub_14003A930(&v28, (char *)v22 + v9, v12 != v9);
TextGameObject::updateTextObject((__int64 *)Object, (struct cocos2d::CCPoint)&v28, 0);
Object->m_updateEditorColor = 1;
cocos2d::CCArray::addObject(v25, Object);
v11 = v35;
v12 = v34;
v13 = (_QWORD *)v33[0];
}
++v9;
++v10;
}
while ( v9 < cocos2d::CCArray::count(v6) );
v8 = v25;
}
a2->removeFromParentAndCleanup(a2, 0);
v23 = v4->m_editorUI;
if ( v23 )
EditorUI::selectObjects(v23, v8, 1);
sub_14003A830((__int64)v33);
}
}
}