// // MultilineBitmapFont::initWithFont from 0x2f14ec to 0x2f1a0a (1310 bytes) // // 1 xrefs: // > MultilineBitmapFont::createWithFont @ 0x2f1aca // // 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 // int __fastcall MultilineBitmapFont::initWithFont( MultilineBitmapFont *a1, const char *a2, _DWORD *a3, float a4, float a5, float *a6, int a7, char a8) { float *p_m_fTextureTop; // r6 int v11; // r4 cocos2d::CCDirector *v12; // r0 float v13; // r0 float v14; // s16 cocos2d::CCObject *v15; // r0 cocos2d::CCArray *v16; // r0 cocos2d::CCObject *v17; // r0 cocos2d::CCArray *v18; // r0 cocos2d::CCObject *v19; // r0 BitmapFontCache *v20; // r0 FontObject *v21; // r7 int FontWidth; // r0 int v23; // r11 int v24; // r10 float v25; // s15 int v26; // r2 int v27; // r7 float v28; // s14 bool v29; // zf cocos2d::CCLabelBMFont *v31; // r4 void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7 float m_maxWidth; // s18 float width; // s17 float v35; // s17 float v36; // s15 void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r7 int v38; // r0 void (__fastcall *v39)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7 int v40; // r8 int v41; // r0 void (__fastcall *v42)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r7 float *v43; // r0 void (__fastcall *v44)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7 float x; // r8 int v46; // r0 int v47; // r0 int v48; // r6 int v49; // r7 char *v50; // r3 unsigned int i; // r6 cocos2d::CCArray *m_characters; // r7 cocos2d::CCArray *v53; // r0 cocos2d::CCObject *v54; // r0 char *v55; // r8 int v56; // r6 char *v57; // r8 int v58; // r0 int v59; // r0 int v60; // r3 char v61; // r2 char v62; // lr void (__fastcall *v63)(int, cocos2d::CCPoint *); // r3 int v64; // r3 float v65; // s15 int v66; // [sp+Ch] [bp-38h] int v67; // [sp+10h] [bp-34h] cocos2d::CCArray *m_pTargetArray; // [sp+14h] [bp-30h] int v70; // [sp+1Ch] [bp-28h] cocos2d::CCLabelBMFont *v72; // [sp+30h] [bp-14h] BYREF cocos2d::CCPoint v73; // [sp+34h] [bp-10h] BYREF v70 = ((int (__fastcall *)(MultilineBitmapFont *))a1->init)(a1); if ( v70 ) { p_m_fTextureTop = &a1->m_fTextureTop; v11 = 0; a1->m_disableColor = a8; v12 = cocos2d::CCDirector::sharedDirector(); v13 = COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v12)); v14 = a5 * v13; v15 = (cocos2d::CCObject *)cocos2d::CCArray::create((cocos2d::CCArray *)LODWORD(v13)); a1->m_specialDescriptors = (cocos2d::CCArray *)v15; cocos2d::CCObject::retain(v15); v17 = (cocos2d::CCObject *)cocos2d::CCArray::create(v16); a1->m_characters = (cocos2d::CCArray *)v17; cocos2d::CCObject::retain(v17); v19 = (cocos2d::CCObject *)cocos2d::CCArray::create(v18); a1->m_lines = (cocos2d::CCArray *)v19; cocos2d::CCObject::retain(v19); v20 = BitmapFontCache::sharedFontCache(); v21 = BitmapFontCache::fontWithConfigFile(v20, a2, a4); do { FontWidth = FontObject::getFontWidth(v21, v11++); *((_DWORD *)p_m_fTextureTop++ + 1) = FontWidth; } while ( v11 != 300 ); if ( !a1->m_disableColor ) { sub_775C20(&v72, a3); MultilineBitmapFont::readColorInfo(&v73, a1, &v72); sub_774794(a3, &v73); sub_774008(&v73); sub_774008(&v72); } v23 = 0; v24 = 0; v66 = 0; while ( *(_DWORD *)(*a3 - 12) ) { sub_775C20(&v73, a3); MultilineBitmapFont::stringWithMaxWidth((int)&v72, (int)a1, &v73, v14, a4); sub_774008(&v73); v31 = cocos2d::CCLabelBMFont::create(); setPosition = v31->setPosition; cocos2d::CCPoint::CCPoint(&v73, 0.0, (float)v23); setPosition(v31, &v73); v31->setScale(v31, COERCE_FLOAT(LODWORD(a4))); cocos2d::CCArray::addObject(a1->m_lines, v31); m_maxWidth = a1->m_maxWidth; width = v31->getContentSize(v31)->width; if ( m_maxWidth >= (float)(width * v31->getScale(v31)) ) { v36 = a1->m_maxWidth; } else { v35 = v31->getContentSize(v31)->width; v36 = v35 * v31->getScale(v31); } a1->m_maxWidth = v36; v31->setAnchorPoint(v31, (const cocos2d::CCPoint *)a6); if ( v31->getAnchorPoint(v31)->x == 0.5 ) { setAnchorPoint = v31->setAnchorPoint; v38 = (int)v31->getAnchorPoint(v31); cocos2d::CCPoint::CCPoint(&v73, 0.0, *(float *)(v38 + 4)); setAnchorPoint(v31, &v73); v39 = v31->setPosition; v31->getPosition(v31); v31->getContentSize(v31); v40 = roundf(); v41 = (int)v31->getPosition(v31); cocos2d::CCPoint::CCPoint(&v73, *(float *)&v40, *(float *)(v41 + 4)); v39(v31, &v73); } if ( v31->getAnchorPoint(v31)->y == 0.5 ) { v42 = v31->setAnchorPoint; v43 = (float *)v31->getAnchorPoint(v31); cocos2d::CCPoint::CCPoint(&v73, *v43, 0.0); v42(v31, &v73); v44 = v31->setPosition; x = v31->getPosition(v31)->x; v31->getPosition(v31); v31->getContentSize(v31); v46 = roundf(); cocos2d::CCPoint::CCPoint(&v73, x, *(float *)&v46); v44(v31, &v73); } m_pTargetArray = v72[-1].m_pTargetArray; qsort(a1->m_specialDescriptors->data->arr, a1->m_specialDescriptors->data->num, 4u, textSectionCompare); v67 = 0; while ( cocos2d::CCArray::count(a1->m_specialDescriptors) ) { v47 = cocos2d::CCArray::objectAtIndex(a1->m_specialDescriptors, 0); v48 = *(_DWORD *)(v47 + 56); v49 = v47; if ( v48 < v24 ) break; v50 = (char *)m_pTargetArray + v24; if ( v48 > (int)m_pTargetArray + v24 ) break; v55 = *(char **)(v47 + 60); if ( v55 == (char *)-1 || (int)v55 <= (int)v50 ) { cocos2d::CCArray::removeObjectAtIndex(a1->m_specialDescriptors, 0, 1); } else { v55 = (char *)m_pTargetArray + v24; *(_DWORD *)(v47 + 56) = v50 + 1; } v56 = v48 - v24; v57 = &v55[-v24]; if ( v56 == 1 ) v56 = 0; if ( !v31->getChildByTag(v31, v56) ) --v56; ++v67; if ( *(_DWORD *)(v49 + 60) == -1 ) { v58 = (int)v31->getChildByTag(v31, v56); if ( v58 && *(_DWORD *)(v49 + 52) == 4 ) *(_DWORD *)(v58 + 524) = *(_DWORD *)(v49 + 72); } else { while ( v56 <= (int)v57 ) { v59 = (int)v31->getChildByTag(v31, v56); if ( v59 ) { v60 = *(_DWORD *)(v49 + 52); switch ( v60 ) { case 2: *(_BYTE *)(v59 + 516) = 1; *(_DWORD *)(v59 + 520) = *(_DWORD *)(v49 + 68); break; case 3: v64 = *(int *)(v49 + 80); *(float *)(v59 + 532) = (float)*(int *)(v49 + 76); if ( v64 <= 0 ) v65 = 0.0; else v65 = *(float *)&v64; *(_DWORD *)(v59 + 540) = v67; if ( v64 > 0 ) v65 = 1.0 / (float)SLODWORD(v65); *(float *)(v59 + 528) = v65; break; case 1: v61 = *(_BYTE *)(v49 + 66); v62 = *(_BYTE *)(v49 + 64); v63 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v59 + 472); BYTE1(v73.x) = *(_BYTE *)(v49 + 65); LOBYTE(v73.x) = v62; BYTE2(v73.x) = v61; v63(v59, &v73); break; } } ++v56; } } } a1->addChild(a1, v31); for ( i = 0; i < v31->getChildrenCount(v31); ++i ) { m_characters = a1->m_characters; v53 = v31->getChildren(v31); v54 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v53, i); cocos2d::CCArray::addObject(m_characters, v54); } sub_7751B8(a3, 0, m_pTargetArray); v24 += (int)m_pTargetArray; ++v66; sub_774008(&v72); v23 -= a7; } cocos2d::CCObject::release(a1->m_specialDescriptors); v25 = 0.0; a1->m_specialDescriptors = nullptr; v26 = (v66 - 1) * a7; a1->m_height = v26; v27 = (int)(float)(v14 + 0.0); v28 = *a6; v29 = *a6 == 0.0; a1->m_width = v27; if ( !v29 ) { if ( v28 != 1.0 ) v27 /= 2; v25 = (float)-v27; } cocos2d::CCPoint::CCPoint(&v73, -v25, (float)v26); cocos2d::CCPoint::operator=(&a1->m_position, &v73); } return v70; }
GD Web Decomp Icon

GD Web Decomp

Raw Source