//
// LevelEditorLayer::updateLevelFont from 0x100361f88 to 0x1003623a4 (1052 bytes)
//
// 1 xrefs:
// > SelectFontLayer::onChangeFont @ 0x1002d229c
//
// 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::updateLevelFont(LevelEditorLayer *a1, int a2)
{
cocos2d::CCObject *v4; // x20
cocos2d::CCObject *v5; // x19
cocos2d::CCArray *m_objects; // x23
unsigned int v7; // w24
int v8; // w8
__int64 v9; // x0
cocos2d::CCTextureCache *v10; // x0
cocos2d::CCTexture2D *v11; // x23
unsigned int v12; // w24
__int64 v13; // x25
unsigned int v14; // w23
LabelGameObject *v15; // x0
GameManager *v16; // x0
char *FontTexture; // x0
cocos2d::CCTextureCache *v18; // x0
void **v19; // x1
cocos2d::CCTexture2D *v20; // x22
unsigned int i; // w21
__int64 v22; // x24
unsigned int j; // w20
__int64 v24; // x0
__int64 v25; // x21
void *v26[2]; // [xsp+0h] [xbp-90h] BYREF
__int64 v27; // [xsp+10h] [xbp-80h]
std::string __p; // [xsp+20h] [xbp-70h] BYREF
void *v29[2]; // [xsp+38h] [xbp-58h] BYREF
char v30; // [xsp+4Fh] [xbp-41h]
if ( a1->m_levelSettings->m_fontIndex != a2 )
{
v4 = sub_10024A15C();
v5 = sub_10024A15C();
m_objects = a1->m_objects;
if ( (unsigned int)sub_10024A36C((__int64)m_objects) )
{
v7 = 0;
while ( 1 )
{
v8 = *(_DWORD *)(sub_10024A388((__int64)m_objects, v7) + 1028);
v9 = (__int64)v4;
if ( v8 == 914 )
goto LABEL_7;
if ( v8 == 1615 )
break;
LABEL_8:
if ( ++v7 >= (unsigned int)sub_10024A36C((__int64)m_objects) )
goto LABEL_9;
}
v9 = (__int64)v5;
LABEL_7:
sub_10024A2D0(v9);
goto LABEL_8;
}
LABEL_9:
v10 = cocos2d::CCTextureCache::sharedTextureCache();
v11 = cocos2d::CCTextureCache::addImage(v10, "bigFont.png", 0);
if ( (unsigned int)sub_10024A36C((__int64)v4) )
{
v12 = 0;
do
{
v13 = sub_10024A388((__int64)v4, v12);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v13 + 1296LL))(v13, 1);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v13 + 560LL))(v13);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v13 + 1104LL))(v13, 0);
(*(void (__fastcall **)(__int64, cocos2d::CCTexture2D *))(*(_QWORD *)v13 + 1048LL))(v13, v11);
++v12;
}
while ( v12 < (unsigned int)sub_10024A36C((__int64)v4) );
}
if ( (unsigned int)sub_10024A36C((__int64)v5) )
{
v14 = 0;
do
{
v15 = (LabelGameObject *)sub_10024A388((__int64)v5, v14);
LabelGameObject::removeLabel(v15);
++v14;
}
while ( v14 < (unsigned int)sub_10024A36C((__int64)v5) );
}
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *))a1->m_textLayerT3->removeFromParent)(a1->m_textLayerT3);
a1->m_textLayerT3 = nullptr;
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *))a1->m_textBlendingLayerT3->removeFromParent)(a1->m_textBlendingLayerT3);
a1->m_textBlendingLayerT3 = nullptr;
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *))a1->m_textLayerT2->removeFromParent)(a1->m_textLayerT2);
a1->m_textLayerT2 = nullptr;
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *))a1->m_textBlendingLayerT2->removeFromParent)(a1->m_textBlendingLayerT2);
a1->m_textBlendingLayerT2 = nullptr;
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *))a1->m_textLayerT1->removeFromParent)(a1->m_textLayerT1);
a1->m_textLayerT1 = nullptr;
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *))a1->m_textBlendingLayerT1->removeFromParent)(a1->m_textBlendingLayerT1);
a1->m_textBlendingLayerT1 = nullptr;
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *))a1->m_textLayerB1->removeFromParent)(a1->m_textLayerB1);
a1->m_textLayerB1 = nullptr;
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *))a1->m_textBlendingLayerB1->removeFromParent)(a1->m_textBlendingLayerB1);
a1->m_textBlendingLayerB1 = nullptr;
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *))a1->m_textLayerB2->removeFromParent)(a1->m_textLayerB2);
a1->m_textLayerB2 = nullptr;
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *))a1->m_textBlendingLayerB2->removeFromParent)(a1->m_textBlendingLayerB2);
a1->m_textBlendingLayerB2 = nullptr;
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *))a1->m_textLayerB3->removeFromParent)(a1->m_textLayerB3);
a1->m_textLayerB3 = nullptr;
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *))a1->m_textBlendingLayerB3->removeFromParent)(a1->m_textBlendingLayerB3);
a1->m_textBlendingLayerB3 = nullptr;
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *))a1->m_textLayerB4->removeFromParent)(a1->m_textLayerB4);
a1->m_textLayerB4 = nullptr;
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *))a1->m_textBlendingLayerB4->removeFromParent)(a1->m_textBlendingLayerB4);
a1->m_textBlendingLayerB4 = nullptr;
a1->m_levelSettings->m_fontIndex = a2;
v16 = GameManager::sharedState();
FontTexture = (char *)GameManager::getFontTexture(v16, a2);
sub_100009900(v29, FontTexture);
v18 = cocos2d::CCTextureCache::sharedTextureCache();
if ( v30 >= 0 )
v19 = v29;
else
v19 = (void **)v29[0];
v20 = cocos2d::CCTextureCache::addImage(v18, (const char *)v19, 0);
GJBaseGameLayer::createTextLayers(a1);
for ( i = 0; i < (unsigned int)sub_10024A36C((__int64)v4); ++i )
{
v22 = sub_10024A388((__int64)v4, i);
(*(void (__fastcall **)(__int64, cocos2d::CCTexture2D *))(*(_QWORD *)v22 + 1048LL))(v22, v20);
if ( *(char *)(v22 + 1375) < 0 )
sub_1000097D0(&__p, *(void **)(v22 + 1352), *(_QWORD *)(v22 + 1360));
else
__p = *(std::string *)(v22 + 1352);
TextGameObject::updateTextObject(v22, &__p, 0);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
*(_BYTE *)(v22 + 1149) = 1;
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v22 + 1480LL))(v22, &unk_100645673);
}
for ( j = 0; j < (unsigned int)sub_10024A36C((__int64)v5); ++j )
{
v24 = sub_10024A388((__int64)v5, j);
v25 = v24;
if ( *(char *)(v24 + 1879) < 0 )
{
sub_1000097D0(v26, *(void **)(v24 + 1856), *(_QWORD *)(v24 + 1864));
}
else
{
*(_OWORD *)v26 = *(_OWORD *)(v24 + 1856);
v27 = *(_QWORD *)(v24 + 1872);
}
LabelGameObject::createLabel(v25, v26);
if ( SHIBYTE(v27) < 0 )
operator delete(v26[0]);
}
if ( v30 < 0 )
operator delete(v29[0]);
}
}