//
// GJWorldNode::unlockActiveItem from 0x95ede0 to 0x95f2d0 (1264 bytes)
//
// 4 xrefs:
// > ??> @ 0xb7858
// > WorldSelectLayer::animateInActiveIsland @ 0x95f46c
// > GJWorldNode::init @ 0x9609fc
// > ??> @ 0x122e5a0
//
// 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 GJWorldNode::unlockActiveItem(GJWorldNode *a1)
{
cocos2d::CCNode *v2; // x21
void (__fastcall *setSkewY)(cocos2d::CCNode *__hidden, float); // x20
cocos2d::CCSpriteFrameCache *v4; // x0
cocos2d::CCSpriteFrame *v5; // x0
unsigned int i; // w20
__int64 v7; // x0
cocos2d::CCSprite *m_arrowSprite; // x0
int v9; // w24
cocos2d::CCSprite *v10; // x20
float v11; // s8
cocos2d::CCFadeOut *v12; // x0
float v13; // s8
cocos2d::CCScaleTo *v14; // x0
cocos2d::CCActionInterval *v15; // x0
cocos2d::CCEaseBounceOut *v16; // x0
GameLevelManager *v17; // x20
int v18; // w0
bool v19; // w2
cocos2d::CCNode *v20; // x20
int b; // w3
float r; // s0
cocos2d::CCNode *(__fastcall *getChildByTag)(cocos2d::CCNode *__hidden, int); // x2
float v24; // s2
int v25; // w3
float v26; // s0
cocos2d::CCNode *(__fastcall *getParent)(cocos2d::CCNode *__hidden); // x2
float v28; // s2
__int64 v29; // x0
GLubyte g; // w4
cocos2d::CCNode *v31; // x20
GLubyte v32; // w3
__int64 v33; // x2
CCCircleWave *v34; // x0
GLubyte v35; // w4
cocos2d::CCNode *v36; // x20
GLubyte v37; // w3
CCCircleWave_vtbl *v38; // x2
char *v39; // x0
unsigned int *v40; // x2
int v41; // w1
char *v42; // [xsp+80h] [xbp+80h] BYREF
cocos2d::CCPoint v43; // [xsp+88h] [xbp+88h] BYREF
cocos2d::CCPoint v44; // [xsp+90h] [xbp+90h] BYREF
__int64 v45; // [xsp+98h] [xbp+98h] BYREF
float v46; // [xsp+A0h] [xbp+A0h]
float v47; // [xsp+A4h] [xbp+A4h]
if ( a1->m_activeButton )
{
sub_D153B8((int)&v42, "worldLevelBtn_001.png");
v2 = a1->m_activeButton->getNormalImage(a1->m_activeButton);
setSkewY = v2->__vftable[1].setSkewY;
v4 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v5 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v4, v42);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSpriteFrame *))setSkewY)(v2, v5);
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(a1->m_activeObjects); ++i )
{
v7 = cocos2d::CCArray::objectAtIndex(a1->m_activeObjects, i);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v7 + 328LL))(v7, 1);
}
m_arrowSprite = a1->m_arrowSprite;
if ( m_arrowSprite )
m_arrowSprite->setVisible(m_arrowSprite, 1);
v9 = 3;
do
{
v10 = cocos2d::CCSprite::createWithSpriteFrameName(v42);
v2->addChild_0(v2, v10, 2);
((void (__fastcall *)(cocos2d::CCPoint *__return_ptr, cocos2d::CCNode *))v2->getScaledContentSize)(&v44, v2);
v11 = v44.x * 0.5;
((void (__fastcall *)(__int64 *__return_ptr, cocos2d::CCNode *))v2->getScaledContentSize)(&v45, v2);
cocos2d::CCPoint::CCPoint(&v43, v11, *((float *)&v45 + 1) * 0.5);
v10->setPosition(v10, &v43);
v10->setColor(v10, (const cocos2d::ccColor3B *)&off_EFA740);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v10->setBlendFunc)(v10, 0x100000302LL);
v12 = cocos2d::CCFadeOut::create(0.5);
cocos2d::CCNode::runAction(v10, v12);
--v9;
}
while ( v9 );
v13 = v2->getScale(v2);
v14 = (cocos2d::CCScaleTo *)((__int64 (__fastcall *)(cocos2d::CCNode *, float))v2->setScale)(v2, 1.6);
v15 = (cocos2d::CCActionInterval *)cocos2d::CCScaleTo::create(v14, 0.5, v13);
v16 = cocos2d::CCEaseBounceOut::create(v15);
cocos2d::CCNode::runAction(v2, v16);
a1->m_activeButton->setEnabled(a1->m_activeButton, 1);
v17 = GameLevelManager::sharedState();
v18 = a1->m_activeButton->getTag(a1->m_activeButton);
GameLevelManager::getMainLevel(v17, v18, 0)->m_gauntletLevel2 = 1;
cocos2d::CCPoint::CCPoint(&v44, &a1->m_levelPosition);
v20 = (cocos2d::CCNode *)cocos2d::CCParticleSystemQuad::create(
(cocos2d::CCParticleSystemQuad *)"coinPickupEffect.plist",
nullptr,
v19);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v20->__vftable[1].onEnter)(v20, 1);
a1->addChild_0(a1, v20, 10);
v20->setPosition(v20, &v44);
b = a1->m_particleColor.b;
r = (float)a1->m_particleColor.r;
getChildByTag = v20->__vftable[1].getChildByTag;
v24 = (float)a1->m_particleColor.g / 255.0;
v47 = 1.0;
*((float *)&v45 + 1) = v24;
v46 = (float)b / 255.0;
*(float *)&v45 = r / 255.0;
getChildByTag(v20, (int)&v45);
v25 = a1->m_particleColor.b;
v26 = (float)a1->m_particleColor.r;
getParent = v20->__vftable[1].getParent;
v28 = (float)a1->m_particleColor.g / 255.0;
v47 = 1.0;
*((float *)&v45 + 1) = v28;
v46 = (float)v25 / 255.0;
*(float *)&v45 = v26 / 255.0;
((void (__fastcall *)(cocos2d::CCNode *, __int64 *))getParent)(v20, &v45);
v20->setScale(v20, 0.8);
v29 = CCCircleWave::create(nullptr, 16.0, 4.0, 0.3, 0);
g = a1->m_particleColor.g;
v31 = (cocos2d::CCNode *)v29;
v32 = a1->m_particleColor.b;
v33 = *(_QWORD *)v29;
*(_BYTE *)(v29 + 340) = a1->m_particleColor.r;
*(_BYTE *)(v29 + 341) = g;
*(_BYTE *)(v29 + 342) = v32;
(*(void (__fastcall **)(__int64, cocos2d::CCPoint *))(v33 + 184))(v29, &v44);
a1->addChild_0(a1, v31, 0);
v34 = CCCircleWave::create(4.0, 40.0, 0.3, 0);
v35 = a1->m_particleColor.g;
v36 = v34;
v37 = a1->m_particleColor.b;
v38 = v34->__vftable;
v34->m_color.r = a1->m_particleColor.r;
v34->m_color.g = v35;
v34->m_color.b = v37;
v38->setPosition(v34, &v44);
a1->addChild_0(a1, v36, 10);
v36[1].m_uIndexInArray = 1;
v36[1].m_uUnknown = 4;
v39 = v42 - 24;
if ( v42 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v40 = (unsigned int *)(v42 - 8);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *((_DWORD *)v42 - 2);
*((_DWORD *)v42 - 2) = v41 - 1;
}
if ( v41 <= 0 )
operator delete(v39);
}
}
}