//
// LevelEditorLayer::updateLevelFont from 0x3683dc to 0x36869c (704 bytes)
//
// 1 xrefs:
// > SelectFontLayer::onChangeFont @ 0x4aa356
//
// 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 LevelEditorLayer::updateLevelFont(LevelEditorLayer *a1, int a2)
{
unsigned int v4; // r5
cocos2d::CCArray *v5; // r7
cocos2d::CCArray *v6; // r6
cocos2d::CCArray *AllObjects; // r9
cocos2d::CCObject *v8; // r0
cocos2d::CCObject_vtbl *v9; // r3
cocos2d::CCObject *v10; // r1
cocos2d::CCArray *v11; // r0
cocos2d::CCTextureCache *v12; // r0
unsigned int v13; // r9
cocos2d::CCTexture2D *v14; // r10
int v15; // r0
int v16; // r5
unsigned int i; // r5
LabelGameObject *v18; // r0
cocos2d::CCSpriteBatchNode *m_textBlendingLayerT3; // r0
cocos2d::CCSpriteBatchNode *m_textLayerT2; // r0
cocos2d::CCSpriteBatchNode *m_textBlendingLayerT2; // r0
cocos2d::CCSpriteBatchNode *m_textLayerT1; // r0
cocos2d::CCSpriteBatchNode *m_textBlendingLayerT1; // r0
cocos2d::CCSpriteBatchNode *m_textLayerB1; // r0
cocos2d::CCSpriteBatchNode *m_textBlendingLayerB1; // r0
cocos2d::CCSpriteBatchNode *m_textLayerB2; // r0
cocos2d::CCSpriteBatchNode *m_textBlendingLayerB2; // r0
cocos2d::CCSpriteBatchNode *m_textLayerB3; // r0
cocos2d::CCSpriteBatchNode *m_textBlendingLayerB3; // r0
cocos2d::CCSpriteBatchNode *m_textLayerB4; // r0
cocos2d::CCSpriteBatchNode *m_textBlendingLayerB4; // r0
LevelSettingsObject *m_levelSettings; // r3
GameManager *v33; // r0
char *FontTexture; // r0
cocos2d::CCTextureCache *v35; // r0
cocos2d::CCTexture2D *v36; // r11
unsigned int j; // r9
int v38; // r4
unsigned int k; // r4
LabelGameObject *v40; // r7
char *v41; // [sp+8h] [bp-14h] BYREF
const char *v42; // [sp+Ch] [bp-10h] BYREF
char v43[4]; // [sp+10h] [bp-Ch] BYREF
if ( a2 != a1->m_levelSettings->m_fontIndex )
{
v4 = 0;
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)a1);
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
AllObjects = LevelEditorLayer::getAllObjects(a1);
while ( 1 )
{
if ( v4 >= cocos2d::CCArray::count(AllObjects) )
{
v12 = cocos2d::CCTextureCache::sharedTextureCache();
v13 = 0;
v14 = cocos2d::CCTextureCache::addImage(v12, "bigFont.png", 0);
while ( v13 < cocos2d::CCArray::count(v5) )
{
v15 = cocos2d::CCArray::objectAtIndex(v5, v13++);
v16 = v15;
(*(void (__fastcall **)(int, int))(*(_DWORD *)v15 + 648))(v15, 1);
(*(void (__fastcall **)(int))(*(_DWORD *)v16 + 280))(v16);
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v16 + 552))(v16, 0);
(*(void (__fastcall **)(int, cocos2d::CCTexture2D *))(*(_DWORD *)v16 + 524))(v16, v14);
}
for ( i = 0; i < cocos2d::CCArray::count(v6); ++i )
{
v18 = (LabelGameObject *)cocos2d::CCArray::objectAtIndex(v6, i);
LabelGameObject::removeLabel(v18);
}
a1->m_textLayerT3->removeFromParent(a1->m_textLayerT3);
m_textBlendingLayerT3 = a1->m_textBlendingLayerT3;
a1->m_textLayerT3 = nullptr;
m_textBlendingLayerT3->removeFromParent(m_textBlendingLayerT3);
m_textLayerT2 = a1->m_textLayerT2;
a1->m_textBlendingLayerT3 = nullptr;
m_textLayerT2->removeFromParent(m_textLayerT2);
m_textBlendingLayerT2 = a1->m_textBlendingLayerT2;
a1->m_textLayerT2 = nullptr;
m_textBlendingLayerT2->removeFromParent(m_textBlendingLayerT2);
m_textLayerT1 = a1->m_textLayerT1;
a1->m_textBlendingLayerT2 = nullptr;
m_textLayerT1->removeFromParent(m_textLayerT1);
m_textBlendingLayerT1 = a1->m_textBlendingLayerT1;
a1->m_textLayerT1 = nullptr;
m_textBlendingLayerT1->removeFromParent(m_textBlendingLayerT1);
m_textLayerB1 = a1->m_textLayerB1;
a1->m_textBlendingLayerT1 = nullptr;
m_textLayerB1->removeFromParent(m_textLayerB1);
m_textBlendingLayerB1 = a1->m_textBlendingLayerB1;
a1->m_textLayerB1 = nullptr;
m_textBlendingLayerB1->removeFromParent(m_textBlendingLayerB1);
m_textLayerB2 = a1->m_textLayerB2;
a1->m_textBlendingLayerB1 = nullptr;
m_textLayerB2->removeFromParent(m_textLayerB2);
m_textBlendingLayerB2 = a1->m_textBlendingLayerB2;
a1->m_textLayerB2 = nullptr;
m_textBlendingLayerB2->removeFromParent(m_textBlendingLayerB2);
m_textLayerB3 = a1->m_textLayerB3;
a1->m_textBlendingLayerB2 = nullptr;
m_textLayerB3->removeFromParent(m_textLayerB3);
m_textBlendingLayerB3 = a1->m_textBlendingLayerB3;
a1->m_textLayerB3 = nullptr;
m_textBlendingLayerB3->removeFromParent(m_textBlendingLayerB3);
m_textLayerB4 = a1->m_textLayerB4;
a1->m_textBlendingLayerB3 = nullptr;
m_textLayerB4->removeFromParent(m_textLayerB4);
m_textBlendingLayerB4 = a1->m_textBlendingLayerB4;
a1->m_textLayerB4 = nullptr;
m_textBlendingLayerB4->removeFromParent(m_textBlendingLayerB4);
m_levelSettings = a1->m_levelSettings;
a1->m_textBlendingLayerB4 = nullptr;
m_levelSettings->m_fontIndex = a2;
v33 = GameManager::sharedState();
FontTexture = (char *)GameManager::getFontTexture(v33, a2);
sub_776584((int)&v41, FontTexture);
v35 = cocos2d::CCTextureCache::sharedTextureCache();
v36 = cocos2d::CCTextureCache::addImage(v35, v41, 0);
GJBaseGameLayer::createTextLayers(a1);
for ( j = 0; j < cocos2d::CCArray::count(v5); ++j )
{
v38 = cocos2d::CCArray::objectAtIndex(v5, j);
(*(void (__fastcall **)(int, cocos2d::CCTexture2D *))(*(_DWORD *)v38 + 524))(v38, v36);
sub_775C20(&v42, v38 + 1160);
TextGameObject::updateTextObject((int *)v38, &v42, 0);
sub_774008(&v42);
*(_BYTE *)(v38 + 997) = 1;
(*(void (__fastcall **)(int, __int16 *))(*(_DWORD *)v38 + 740))(v38, &word_9AA6C0);
}
for ( k = 0; k < cocos2d::CCArray::count(v6); ++k )
{
v40 = (LabelGameObject *)cocos2d::CCArray::objectAtIndex(v6, k);
sub_775C20(v43, &v40->m_labelString);
LabelGameObject::createLabel(v40, (std::string)v43);
sub_774008(v43);
}
sub_774008(&v41);
return;
}
v8 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(AllObjects, v4);
v9 = v8[17].__vftable;
v10 = v8;
if ( v9 == (cocos2d::CCObject_vtbl *)((char *)&stru_38C.st_value + 2) )
{
v11 = v5;
}
else
{
if ( v9 != (cocos2d::CCObject_vtbl *)((char *)&stru_64C.st_name + 3) )
goto LABEL_9;
v11 = v6;
}
cocos2d::CCArray::addObject(v11, v10);
LABEL_9:
++v4;
}
}
}