//
// AchievementBar::init from 0x42a1ec to 0x42ad38 (2892 bytes)
//
// 1 xrefs:
// > AchievementBar::create @ 0x42ad86
//
// 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
//
bool AchievementBar::init(AchievementBar *a1, const char *a2, const char *a3, const char *a4, bool a5)
{
cocos2d::CCDirector *v7; // r0
cocos2d::CCLayerColor *v8; // r0
AchievementBar_vtbl *v9; // r3
cocos2d::CCLayerColor *m_layerColor; // r6
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r5
char *v12; // r1
cocos2d::extension::CCScale9Sprite *v13; // r6
cocos2d::extension::CCScale9Sprite *v14; // r6
void (__fastcall *setContentSize)(cocos2d::extension::CCScale9Sprite *__hidden, const cocos2d::CCSize *); // r7
cocos2d::CCSprite *v16; // r0
cocos2d::CCSprite_vtbl *v17; // r3
cocos2d::extension::CCScale9Sprite *v18; // r5
void (__fastcall *v19)(cocos2d::extension::CCScale9Sprite *__hidden, const cocos2d::CCSize *); // r7
void (__fastcall *v20)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r4
int v21; // r0
GJItemIcon *v22; // r6
void (__fastcall *setScale)(cocos2d::CCSprite *__hidden, float); // r4
float *v24; // r0
const char *v25; // r7
float v26; // r5
cocos2d::CCArray *v27; // r0
cocos2d::CCArray *v28; // r5
int v29; // r6
int v30; // r4
const std::string *v31; // r1
cocos2d::CCObject *v32; // r0
cocos2d::CCString *v33; // r0
char *CString; // r4
cocos2d::CCString *v35; // r0
int v36; // r6
int v37; // r8
int v38; // r8
int v39; // r8
int v40; // r8
int v41; // r8
int v42; // r8
int v43; // r8
int v44; // r8
int v45; // r8
int v46; // r8
int v47; // r8
int v48; // r8
int v49; // r7
UnlockType v50; // r4
const char *v51; // r1
cocos2d::CCString *v52; // r0
cocos2d::CCNode *v53; // r8
float v54; // s16
char *v55; // r1
cocos2d::CCLabelBMFont *v56; // r4
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCLabelBMFont_vtbl *v58; // r3
void (__fastcall *v59)(cocos2d::CCLabelBMFont *__hidden, float); // r9
void (__fastcall *v60)(cocos2d::CCLabelBMFont *__hidden, float); // r9
float *v61; // r0
int v62; // r1
char *v63; // r3
TextArea *v64; // r7
void (__fastcall *v65)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
void (__fastcall *v66)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCLabelBMFont_vtbl *v67; // r3
float height; // s16
int v69; // r0
float v70; // s14
float v71; // s18
float v72; // s15
float v73; // s18
float v74; // s16
float x; // r10
float v76; // s15
float v77; // s16
void (__fastcall *v78)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
float v79; // s19
float width; // s18
float v81; // s18
float v82; // s16
float v83; // r0
float m_maxWidth; // s15
float v85; // s19
float v86; // s16
void (__fastcall *v87)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r4
void (__fastcall *v88)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r4
float *v89; // r0
float v91; // r2
float v92; // r3
cocos2d::ccColor3B v93; // [sp+Ch] [bp-D8h]
cocos2d::CCSprite *v94; // [sp+10h] [bp-D4h]
_BOOL4 v95; // [sp+18h] [bp-CCh]
void (__fastcall *v97)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+1Ch] [bp-C8h]
int v98; // [sp+20h] [bp-C4h]
cocos2d::ccColor3B v99; // [sp+28h] [bp-BCh]
cocos2d::ccColor3B v100; // [sp+2Ch] [bp-B8h]
cocos2d::extension::CCScale9Sprite *v101; // [sp+30h] [bp-B4h] BYREF
int v102; // [sp+34h] [bp-B0h] BYREF
char v103[4]; // [sp+38h] [bp-ACh] BYREF
char v104[4]; // [sp+3Ch] [bp-A8h] BYREF
char v105[4]; // [sp+40h] [bp-A4h] BYREF
char v106[4]; // [sp+44h] [bp-A0h] BYREF
char v107[4]; // [sp+48h] [bp-9Ch] BYREF
char v108[4]; // [sp+4Ch] [bp-98h] BYREF
char v109[4]; // [sp+50h] [bp-94h] BYREF
char v110[4]; // [sp+54h] [bp-90h] BYREF
char v111[4]; // [sp+58h] [bp-8Ch] BYREF
char v112[4]; // [sp+5Ch] [bp-88h] BYREF
char v113[4]; // [sp+60h] [bp-84h] BYREF
char v114[4]; // [sp+64h] [bp-80h] BYREF
char v115[4]; // [sp+68h] [bp-7Ch] BYREF
char v116[4]; // [sp+6Ch] [bp-78h] BYREF
char v117[4]; // [sp+70h] [bp-74h] BYREF
char v118[4]; // [sp+74h] [bp-70h] BYREF
char v119[4]; // [sp+78h] [bp-6Ch] BYREF
char v120[4]; // [sp+7Ch] [bp-68h] BYREF
char v121[4]; // [sp+80h] [bp-64h] BYREF
char v122[4]; // [sp+84h] [bp-60h] BYREF
char v123[4]; // [sp+88h] [bp-5Ch] BYREF
char v124[4]; // [sp+8Ch] [bp-58h] BYREF
char v125[4]; // [sp+90h] [bp-54h] BYREF
char v126[4]; // [sp+94h] [bp-50h] BYREF
char v127[4]; // [sp+98h] [bp-4Ch] BYREF
char v128[4]; // [sp+9Ch] [bp-48h] BYREF
char *v129; // [sp+A0h] [bp-44h] BYREF
cocos2d::CCSize v130; // [sp+A4h] [bp-40h] BYREF
_DWORD v131[2]; // [sp+ACh] [bp-38h] BYREF
cocos2d::CCPoint v132; // [sp+B4h] [bp-30h] BYREF
cocos2d::CCPoint v133; // [sp+BCh] [bp-28h] BYREF
cocos2d::CCPoint v134; // [sp+C4h] [bp-20h] BYREF
cocos2d::CCRect v135; // [sp+CCh] [bp-18h] BYREF
cocos2d::CCSize v136; // 0:^0.8
cocos2d::CCRect v137; // 0:kr00_16.16
cocos2d::CCRect v138; // 0:r2.8,8:^0.8
v95 = cocos2d::CCNodeRGBA::init(a1);
if ( !v95 )
return v95;
v7 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v130, v7);
v135.origin.x = 0.0;
v8 = (cocos2d::CCLayerColor *)cocos2d::CCLayerColor::create((cocos2d::CCLayerColor *)&v135, nullptr, 0.0, 0.0);
v9 = a1->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_layerColor = v8;
v9->addChild(a1, v8);
m_layerColor = a1->m_layerColor;
setPosition = m_layerColor->setPosition;
cocos2d::CCPoint::CCPoint(&v135.origin, v130.width * 0.5, 40.0);
setPosition(m_layerColor, &v135.origin);
if ( a5 )
v12 = "GJ_square02.png";
else
v12 = "GJ_square01.png";
sub_776584((int)&v101, v12);
v13 = v101;
cocos2d::CCRect::CCRect(&v135, 0.0, 0.0, 80.0, 80.0);
v137.origin.x = v91;
v137.origin.y = v92;
v137.size = v136;
v14 = (cocos2d::extension::CCScale9Sprite *)cocos2d::extension::CCScale9Sprite::create(v13, (const char *)&v135, v137);
setContentSize = v14->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v135, 300.0, 80.0);
setContentSize(v14, (const cocos2d::CCSize *)&v135);
a1->m_layerColor->addChild_0(a1->m_layerColor, v14, 1);
a1->m_bg = v14;
v16 = cocos2d::CCSprite::createWithSpriteFrameName("achievementGlow_001.png");
v17 = v16->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_achievementGlowSprite = v16;
((void (__fastcall *)(cocos2d::CCSprite *, int))v17->setScale)(v16, 1082130432);
a1->m_layerColor->addChild_0(a1->m_layerColor, a1->m_achievementGlowSprite, -1);
v131[0] = 770;
v131[1] = 1;
((void (__fastcall *)(cocos2d::CCSprite *, int, int, _DWORD *))a1->m_achievementGlowSprite->setBlendFunc)(
a1->m_achievementGlowSprite,
770,
1,
v131);
cocos2d::CCPoint::CCPoint(&v132, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v135, 0.0, 0.0, 80.0, 80.0);
v18 = (cocos2d::extension::CCScale9Sprite *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02b_001.png",
(const char *)&v135,
v138);
v19 = v18->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v135, 300.0, 80.0);
v19(v18, (const cocos2d::CCSize *)&v135);
a1->m_layerColor->addChild_0(a1->m_layerColor, v18, 100);
v20 = v18->setPosition;
v21 = (int)v14->getPosition(v14);
v20(v18, (const cocos2d::CCPoint *)v21);
v18->setOpacity(v18, 0);
cocos2d::extension::CCScale9Sprite::setBlendAdditive(v18, 1);
a1->m_bg2 = v18;
v94 = cocos2d::CCSprite::createWithSpriteFrameName("playerSquare_001.png");
if ( !a5 )
{
if ( !a4 )
goto LABEL_64;
v27 = (cocos2d::CCArray *)sub_776584((int)&v102, (char *)a4);
v28 = (cocos2d::CCArray *)cocos2d::CCArray::create(v27);
v29 = sub_774A78((int)&v102, "_");
v30 = 0;
v98 = *(_DWORD *)(v102 - 12);
while ( 1 )
{
sub_776158(&v134, &v102, v30, v29 - v30);
if ( *(_DWORD *)(LODWORD(v134.x) - 12) || v30 != v98 )
{
sub_776584((int)&v135, (char *)LODWORD(v134.x));
v32 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v135, v31);
cocos2d::CCArray::addObject(v28, v32);
sub_774008(&v135);
}
if ( v29 == -1 )
break;
v30 = v29 + 1;
v29 = sub_774A78((int)&v102, "_");
sub_774008(&v134);
}
sub_774008(&v134);
sub_774008(&v102);
if ( cocos2d::CCArray::count(v28) <= 1u )
{
LABEL_64:
v26 = 0.0;
v25 = nullptr;
goto LABEL_44;
}
v33 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v28, 0);
CString = (char *)cocos2d::CCString::getCString(v33);
v35 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v28, 1u);
v36 = cocos2d::CCString::intValue(v35);
sub_776584((int)v103, CString);
sub_776584((int)v104, "ship");
v37 = sub_774DBC(v103, v104);
sub_774008(v104);
sub_774008(v103);
if ( v37 )
{
sub_776584((int)v105, CString);
sub_776584((int)v106, "ball");
v38 = sub_774DBC(v105, v106);
sub_774008(v106);
sub_774008(v105);
if ( v38 )
{
sub_776584((int)v107, CString);
sub_776584((int)v108, "bird");
v39 = sub_774DBC(v107, v108);
sub_774008(v108);
sub_774008(v107);
if ( !v39 )
{
v50 = Bird;
v26 = -8.0;
v52 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Unlocked new %s!", "UFO");
goto LABEL_43;
}
sub_776584((int)v109, CString);
sub_776584((int)v110, "dart");
v40 = sub_774DBC(v109, v110);
sub_774008(v110);
sub_774008(v109);
if ( v40 )
{
sub_776584((int)v111, CString);
sub_776584((int)v112, "robot");
v41 = sub_774DBC(v111, v112);
sub_774008(v112);
sub_774008(v111);
if ( v41 )
{
sub_776584((int)v113, CString);
sub_776584((int)v114, "spider");
v42 = sub_774DBC(v113, v114);
sub_774008(v114);
sub_774008(v113);
if ( v42 )
{
sub_776584((int)v115, CString);
sub_776584((int)v116, "death");
v43 = sub_774DBC(v115, v116);
sub_774008(v116);
sub_774008(v115);
if ( v43 )
{
sub_776584((int)v117, CString);
sub_776584((int)v118, "special");
v44 = sub_774DBC(v117, v118);
sub_774008(v118);
sub_774008(v117);
if ( v44 )
{
sub_776584((int)v119, CString);
sub_776584((int)v120, "color");
v45 = sub_774DBC(v119, v120);
sub_774008(v120);
sub_774008(v119);
if ( v45 )
{
sub_776584((int)v121, CString);
sub_776584((int)v122, "color2");
v46 = sub_774DBC(v121, v122);
sub_774008(v122);
sub_774008(v121);
if ( v46 )
{
sub_776584((int)v123, CString);
sub_776584((int)v124, "swing");
v47 = sub_774DBC(v123, v124);
sub_774008(v124);
sub_774008(v123);
if ( v47 )
{
sub_776584((int)v125, CString);
sub_776584((int)v126, "jetpack");
v48 = sub_774DBC(v125, v126);
sub_774008(v126);
sub_774008(v125);
if ( v48 )
{
sub_776584((int)v127, CString);
sub_776584((int)v128, "shipfire");
v49 = sub_774DBC(v127, v128);
sub_774008(v128);
sub_774008(v127);
if ( v49 )
{
v50 = 1;
v51 = "Icon";
}
else
{
v50 = GJItem|Col2;
v51 = "Ship Fire";
}
}
else
{
v50 = GJItem|Col1;
v51 = "Jetpack";
}
}
else
{
v50 = GJItem|0x1;
v51 = "Swing";
}
}
else
{
v50 = Col2;
v51 = "Secondary Color";
}
}
else
{
v50 = Col1;
v51 = "Main Color";
}
}
else
{
v50 = Streak;
v51 = "Trail";
}
}
else
{
v50 = Death;
v51 = "Death Effect";
}
}
else
{
v50 = 9;
v51 = "Spider";
}
}
else
{
v50 = 8;
v51 = "Robot";
}
}
else
{
v50 = Dart;
v51 = "Wave";
}
}
else
{
v50 = 5;
v51 = "Ball";
}
}
else
{
v50 = 4;
v51 = "Ship";
}
v26 = 0.0;
v52 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Unlocked new %s!", v51);
LABEL_43:
*(_WORD *)&v99.r = -20561;
v25 = cocos2d::CCString::getCString(v52);
v99.b = -81;
*(_WORD *)&v100.r = -1;
v100.b = -1;
*(_WORD *)&v93.r = -1;
v93.b = -1;
v22 = GJItemIcon::create(v50, v36, v99, v100, 0, 0, 1, v93);
if ( v22 )
goto LABEL_45;
LABEL_44:
v22 = (GJItemIcon *)cocos2d::CCSprite::createWithSpriteFrameName("GJ_achImage_001.png");
goto LABEL_45;
}
v22 = (GJItemIcon *)cocos2d::CCSprite::createWithSpriteFrameName(a4);
setScale = v22->setScale;
v24 = (float *)v22->getContentSize(v22);
((void (__fastcall *)(GJItemIcon *, _DWORD))setScale)(v22, 30.0 / *v24);
v25 = a3;
v26 = 0.0;
LABEL_45:
v22->setPosition(v22, &v132);
a1->m_layerColor->addChild_0(a1->m_layerColor, v22, 3);
a1->m_achievementSprite = v22;
v53 = cocos2d::CCNode::create();
a1->m_layerColor->addChild_0(a1->m_layerColor, v53, 2);
if ( a5 )
{
v54 = 0.8;
v55 = "goldFont.fnt";
}
else
{
v54 = 0.7;
v55 = "bigFont.fnt";
}
sub_776584((int)&v129, v55);
v56 = cocos2d::CCLabelBMFont::create();
v53->addChild(v53, v56);
setAnchorPoint = v56->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v135.origin, 0.0, 0.5);
setAnchorPoint(v56, &v135.origin);
v56->setScale(v56, COERCE_FLOAT(LODWORD(v54)));
v58 = v56->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_titleLabel = v56;
if ( v58->getContentSize(v56)->width > 200.0 )
{
v60 = v56->setScale;
v61 = (float *)v56->getContentSize(v56);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _DWORD))v60)(v56, 200.0 / *v61);
}
v59 = v56->setScale;
if ( v54 > v56->getScale(v56) )
v62 = ((int (__fastcall *)(cocos2d::CCLabelBMFont *))v56->getScale)(v56);
else
v62 = LODWORD(v54);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v59)(v56, v62);
v63 = (char *)a3;
if ( v25 )
v63 = (char *)v25;
sub_776584((int)&v133, v63);
cocos2d::CCPoint::CCPoint(&v135.origin, 0.0, 1.0);
v64 = (TextArea *)TextArea::create(
(TextArea *)&v133,
(std::string)"chatFont.fnt",
(const char *)0x3F800000,
1128792064,
&v135.origin,
(cocos2d::CCPoint)1101004800LL);
sub_774008(&v133);
v53->addChild(v53, v64);
v65 = v64->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v135.origin, 0.0, 0.5);
v65(v64, &v135.origin);
v66 = v64->setPosition;
cocos2d::CCPoint::CCPoint(&v135.origin, 0.0, 5.0);
v66(v64, &v135.origin);
v64->m_height = 16.0;
v67 = v56->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_achievementDescription = v64;
height = v67->getContentSize(v56)->height;
v69 = (int)v64->getContentSize(v64);
v97 = v56->setPosition;
v70 = *(float *)(v69 + 4) + 17.0;
v71 = (float)(height + v70) * 0.5;
v72 = v71 - (float)(height * 0.5);
v73 = v71 - (float)(v70 * 0.5);
v74 = v72;
cocos2d::CCPoint::CCPoint(&v133, 0.0, 1.0);
x = v133.x;
cocos2d::CCPoint::CCPoint(&v134, 0.0, 1.0);
v76 = 2.5;
v77 = (float)(v74 + v134.y) + 2.0;
if ( !a5 )
v76 = 0.0;
cocos2d::CCPoint::CCPoint(&v135.origin, x, v77 + v76);
v97(v56, &v135.origin);
v78 = v64->setPosition;
cocos2d::CCPoint::CCPoint(&v133, 0.0, -1.0);
v79 = v133.x + 1.0;
cocos2d::CCPoint::CCPoint(&v134, 0.0, -1.0);
cocos2d::CCPoint::CCPoint(&v135.origin, v79, (float)((float)(15.0 - v73) + v134.y) - 1.0);
v78(v64, &v135.origin);
v94->setScale(v94, 1.0);
if ( !a5 )
((void (__fastcall *)(GJItemIcon *, int))v22->setScale)(v22, 1065353216);
width = v94->m_obRect.size.width;
v81 = width * COERCE_FLOAT(((int (__fastcall *)(cocos2d::CCSprite *))v94->getScale)(v94));
v82 = v56->getContentSize(v56)->width;
v83 = v56->getScale(v56);
m_maxWidth = v64->m_maxWidth;
if ( (float)(v82 * v83) < m_maxWidth )
{
v86 = m_maxWidth + 5.0;
}
else
{
v85 = v56->getContentSize(v56)->width;
v86 = (float)(v85 * v56->getScale(v56)) + 5.0;
}
v87 = v22->setPosition;
cocos2d::CCPoint::CCPoint(
&v135.origin,
(float)(v81 * 0.5) - (float)((float)((float)((float)(v81 * 0.5) + v86) + 30.0) * 0.5),
v26);
v87(v22, &v135.origin);
v88 = v53->setPosition;
v89 = (float *)v22->getPosition(v22);
cocos2d::CCPoint::CCPoint(&v135.origin, *v89 + 30.0, 0.0);
v88(v53, &v135.origin);
a1->m_unkUnused = 1118568448;
sub_774008(&v129);
sub_774008(&v101);
return v95;
}