//
// GauntletLayer::unlockActiveItem from 0x100233ae4 to 0x100233e38 (852 bytes)
//
// 1 xrefs:
// > GauntletLayer::setupGauntlet @ 0x100233360
//
// 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 __fastcall GauntletLayer::unlockActiveItem(GauntletLayer *a1)
{
GauntletSprite *v2; // x20
float v3; // s8
__n128 v4; // q0
__n128 v5; // q1
__int64 v6; // x21
__int64 i; // x22
__int64 v8; // x0
__int64 j; // x21
__int64 v10; // x0
int v11; // w25
void **v12; // x0
cocos2d::CCSprite *v13; // x24
cocos2d::CCSprite *v14; // x23
float v15; // s9
__int64 v16; // x0
__n128 v17; // q0
__n128 v18; // q1
cocos2d::CCFadeOut *v19; // x0
cocos2d::CCFadeTo *v20; // x0
float v21; // s8
cocos2d::CCScaleTo *v22; // x0
cocos2d::CCEaseBounceOut *v23; // x0
cocos2d::CCArray *m_levels; // x20
__int64 v25; // x0
GJGameLevel *v26; // x19
GameLevelManager *v27; // x0
GJGameLevel *SavedLevel_1; // x0
__int64 v29; // [xsp+0h] [xbp-80h] BYREF
__int64 v30; // [xsp+8h] [xbp-78h] BYREF
int v31; // [xsp+10h] [xbp-70h] BYREF
void *__p[2]; // [xsp+18h] [xbp-68h] BYREF
char v33; // [xsp+2Fh] [xbp-51h]
if ( a1->m_activeItemButton )
{
GauntletNode::frameForType(a1->m_gauntletType, __p);
v2 = (GauntletSprite *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_activeItemButton->getNormalImage)(a1->m_activeItemButton);
((void (__fastcall *)(GauntletSprite *))v2->removeAllChildren)(v2);
GauntletSprite::addNormalSprite(v2);
((void (__fastcall *)(__int64 *__return_ptr, GauntletSprite *))v2->getScaledContentSize)(&v30, v2);
v3 = *(float *)&v30;
((void (__fastcall *)(__int64 *__return_ptr, GauntletSprite *))v2->getScaledContentSize)(&v29, v2);
v4.n128_f32[0] = v3 * 0.5;
v5.n128_f32[0] = *((float *)&v29 + 1) * 0.5;
sub_100022980(v4, v5, &v31);
v6 = ((__int64 (__fastcall *)(GauntletSprite *))v2->getChildren)(v2);
for ( i = 0; (unsigned int)i < (unsigned int)sub_10024A36C(v6); i = (unsigned int)(i + 1) )
{
v8 = sub_10024A388(v6, i);
(*(void (__fastcall **)(__int64, int *))(*(_QWORD *)v8 + 184LL))(v8, &v31);
}
for ( j = 0; (unsigned int)j < (unsigned int)sub_10024A36C(a1->m_activeObjects); j = (unsigned int)(j + 1) )
{
v10 = sub_10024A388(a1->m_activeObjects, j);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v10 + 328LL))(v10, 1);
}
v11 = 3;
do
{
if ( v33 >= 0 )
v12 = __p;
else
v12 = (void **)__p[0];
v13 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v12);
v14 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletLock_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSprite *, __int64))v13->addChild_0)(v13, v14, 1);
v15 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v13->getContentSize)(v13);
v16 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))v13->getContentSize)(v13);
v17.n128_f32[0] = v15 * 0.5;
v18.n128_f32[0] = *(float *)(v16 + 4) * 0.5;
sub_100022980(v17, v18, &v30);
((void (__fastcall *)(cocos2d::CCSprite *, __int64 *))v14->setPosition)(v14, &v30);
((void (__fastcall *)(GauntletSprite *, cocos2d::CCSprite *, __int64))v2->addChild_0)(v2, v13, 2);
((void (__fastcall *)(cocos2d::CCSprite *, int *))v13->setPosition)(v13, &v31);
((void (__fastcall *)(cocos2d::CCSprite *, void *))v13->setColor)(v13, &unk_10063A9EF);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v13->setBlendFunc)(v13, 0x100000302LL);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v14->setBlendFunc)(v14, 0x100000302LL);
v19 = cocos2d::CCFadeOut::create(0.5);
cocos2d::CCNode::runAction(v13, v19);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v14->setOpacity)(v14, 200);
v20 = cocos2d::CCFadeTo::create(0.5, 0);
cocos2d::CCNode::runAction(v14, v20);
--v11;
}
while ( v11 );
v21 = ((float (__fastcall *)(GauntletSprite *))v2->getScale)(v2);
((void (__fastcall *)(GauntletSprite *, float))v2->setScale)(v2, 1.6);
v22 = cocos2d::CCScaleTo::create_1(0.5, v21);
v23 = cocos2d::CCEaseBounceOut::create(v22);
cocos2d::CCNode::runAction(v2, v23);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_activeItemButton->setEnabled)(
a1->m_activeItemButton,
1);
m_levels = a1->m_levels;
v25 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_activeItemButton->getTag)(a1->m_activeItemButton);
v26 = (GJGameLevel *)sub_10024A388(m_levels, v25);
v26->m_gauntletLevel2 = 1;
v27 = GameLevelManager::sharedState();
SavedLevel_1 = GameLevelManager::getSavedLevel_1(v27, v26);
if ( SavedLevel_1 )
SavedLevel_1->m_gauntletLevel2 = 1;
if ( v33 < 0 )
operator delete(__p[0]);
}
}