//
// LevelEditorLayer::breakApartTextObject from 0x1000f16c0 to 0x1000f1951 (657 bytes)
//
// 1 xrefs:
// > CustomizeObjectLayer::onBreakApart @ 0x1001f804e
//
// 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 LevelEditorLayer::breakApartTextObject(LevelEditorLayer *a1, TextGameObject *longStorage)
{
double v2; // xmm0_8
TextGameObject *v3; // r14
EditorUI *m_editorUI; // rdi
__int64 v5; // r12
std::string::size_type i; // r13
float *v7; // r15
cocos2d::CCSpriteBatchNode *m_textLayerB1; // rbx
__int64 v9; // rax
cocos2d::CCPoint v10; // xmm0_8
GameObject *Object; // rbx
std::string::size_type size; // rax
std::string::pointer data; // rsi
_BOOL8 v14; // r15
EditorUI *v15; // rdi
char v16; // [rsp+0h] [rbp-90h] BYREF
_BYTE v17[8]; // [rsp+8h] [rbp-88h] BYREF
bool v18; // [rsp+10h] [rbp-80h] BYREF
_BYTE __dst[15]; // [rsp+11h] [rbp-7Fh] BYREF
void *__p; // [rsp+20h] [rbp-70h]
cocos2d::CCArray *v21; // [rsp+28h] [rbp-68h]
char v22; // [rsp+30h] [rbp-60h] BYREF
float v23; // [rsp+38h] [rbp-58h]
float v24; // [rsp+3Ch] [rbp-54h]
std::string m_text; // [rsp+40h] [rbp-50h] BYREF
LevelEditorLayer *v26; // [rsp+60h] [rbp-30h]
v26 = a1;
if ( longStorage )
{
v3 = longStorage;
if ( longStorage->m_objectID == 914 )
{
m_editorUI = v26->m_editorUI;
if ( m_editorUI )
EditorUI::deselectAll(m_editorUI);
LevelEditorLayer::removeObject(v26, longStorage, 0);
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *, TextGameObject *))v26->m_textLayerB1->addChild)(
v26->m_textLayerB1,
longStorage);
if ( (longStorage->m_text.m_data.m_short.sizex2 & 1) != 0 )
{
longStorage = (TextGameObject *)longStorage->m_text.m_data.m_long.longStorage;
sub_100006B70(&m_text, longStorage, v3->m_text.m_data.m_long.size, v2);
}
else
{
m_text = (std::string)longStorage->m_text;
}
v5 = ((__int64 (__fastcall *)(TextGameObject *))v3->getChildren)(v3);
v21 = (cocos2d::CCArray *)sub_10071F9E0(v3, longStorage);
for ( i = 0; i < (unsigned int)sub_100720070(v5); ++i )
{
v7 = (float *)sub_1007200C0(v5, (unsigned int)i);
if ( *std::string::at(&m_text, i) != 32 )
{
m_textLayerB1 = v26->m_textLayerB1;
v23 = *(float *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v7 + 192LL))(v7);
v24 = v7[149];
v9 = (*(__int64 (__fastcall **)(float *))(*(_QWORD *)v7 + 312LL))(v7);
sub_10028CBE0(v17, v23 - v24, (float)(*(float *)(v9 + 4) * 0.5) + v7[150]);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v22, (const cocos2d::CCPoint *)v3);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v16, (const cocos2d::CCPoint *)m_textLayerB1);
*(double *)&v10 = sub_10028CC60(&v22);
Object = LevelEditorLayer::createObject(v26, 914, v10, (bool)&v22);
GameObject::duplicateValues(Object);
if ( (*(_BYTE *)&m_text.__r_.__value_.__s.0 & 1) != 0 )
{
size = m_text.__r_.__value_.__l.__size_;
if ( m_text.__r_.__value_.__l.__size_ < i )
LABEL_27:
sub_1000547C0();
data = m_text.__r_.__value_.__l.__data_;
}
else
{
size = *(_BYTE *)&m_text.__r_.__value_.__l.0 >> 1;
data = m_text.__r_.__value_.__s.__data_;
if ( i > size )
goto LABEL_27;
}
v14 = i != size;
v18 = 2 * v14;
if ( i != size )
memmove(__dst, &data[i], i != size);
__dst[v14] = 0;
TextGameObject::updateTextObject(Object, &v18, 0);
if ( v18 )
operator delete(__p);
Object->m_updateEditorColor = 1;
sub_10071FCD0(v21, Object);
}
}
((void (__fastcall *)(TextGameObject *, _QWORD))v3->removeFromParentAndCleanup)(v3, 0);
v15 = v26->m_editorUI;
if ( v15 )
EditorUI::selectObjects(v15, v21, 1);
if ( (*(_BYTE *)&m_text.__r_.__value_.__s.0 & 1) != 0 )
operator delete(m_text.__r_.__value_.__l.__data_);
}
}
}