//
// LabelGameObject::createLabel from 0x1404b3530 to 0x1404b36c5 (405 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::updateLevelFont @ 0x1402df555
// > LabelGameObject::setupCustomSprites @ 0x1404b3505
// > ??> @ 0x1406dcaa0
//
// 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=3
void __fastcall LabelGameObject::createLabel(LabelGameObject *a1, const char *a2)
{
float v2; // xmm0_4
GameManager *v5; // rcx
GameManager *v6; // rbx
int m_loadedFont; // eax
int v8; // ebx
cocos2d::CCString *v9; // rax
__int64 *CString; // rax
const char *v11; // rcx
struct cocos2d::CCLabelBMFont *v12; // rax
cocos2d::CCLabelBMFont_vtbl *v13; // rbx
const cocos2d::CCPoint *v14; // rax
void *v15; // [rsp+20h] [rbp-28h]
void *v16; // [rsp+20h] [rbp-28h]
if ( a1->m_label )
LabelGameObject::removeLabel(a1);
v5 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v15 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = (GameManager *)qword_1406C2ED8;
}
v6 = v5;
if ( !v5 )
{
v16 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = (GameManager *)qword_1406C2ED8;
}
m_loadedFont = v6->m_loadedFont;
v8 = 59;
if ( m_loadedFont < 59 )
v8 = m_loadedFont;
if ( v8 <= 0 )
{
GameManager::loadFont(v5, 0);
CString = &qword_14052A4D8;
}
else
{
GameManager::loadFont(v5, v8);
v9 = cocos2d::CCString::createWithFormat("gjFont%02d.fnt", v8);
CString = (__int64 *)cocos2d::CCString::getCString(v9);
}
v11 = a2;
if ( *((_QWORD *)a2 + 3) > 0xFu )
v11 = *(const char **)a2;
v12 = cocos2d::CCLabelBMFont::create(v11, CString);
a1->m_label = v12;
v13 = v12->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v2, a1->m_obRect.size.width * 0.5);
v13->setPosition_0(a1->m_label, v14);
a1->addChild_1(a1, a1->m_label);
LabelGameObject::updateLabelAlign(a1, a1->m_alignment);
a1->m_labelDirty = 0;
sub_14003A830((__int64)a2);
}