//
// GauntletLayer::unlockActiveItem from 0x100394620 to 0x100394bad (1421 bytes)
//
// 1 xrefs:
// > GauntletLayer::setupGauntlet @ 0x100393c5e
//
// 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; // r14
__int64 v3; // r15
unsigned int i; // r12d
__int64 v5; // rax
unsigned int j; // r15d
__int64 v7; // rax
const char *v8; // r15
const char *v9; // rdi
cocos2d::CCSprite *v10; // r13
cocos2d::CCSprite *v11; // r12
__int64 v12; // rax
cocos2d::CCFadeOut *v13; // rax
cocos2d::CCFadeTo *v14; // rax
const char *v15; // rdi
cocos2d::CCSprite *v16; // r13
cocos2d::CCSprite *v17; // r12
__int64 v18; // rax
cocos2d::CCFadeOut *v19; // rax
cocos2d::CCFadeTo *v20; // rax
cocos2d::CCSprite *v21; // r12
cocos2d::CCSprite *v22; // r15
__int64 v23; // rax
cocos2d::CCFadeOut *v24; // rax
cocos2d::CCFadeTo *v25; // rsi
cocos2d::CCScaleTo *v26; // rax
cocos2d::CCEaseBounceOut *v27; // rax
cocos2d::CCArray *m_levels; // r14
unsigned int v29; // eax
GJGameLevel *v30; // rbx
GameLevelManager *v31; // rax
GJGameLevel *SavedLevel_1; // rax
_BYTE v33[4]; // [rsp+0h] [rbp-60h] BYREF
float v34; // [rsp+4h] [rbp-5Ch]
char v35; // [rsp+8h] [rbp-58h] BYREF
_BYTE v36[15]; // [rsp+9h] [rbp-57h] BYREF
void *__p; // [rsp+18h] [rbp-48h]
float v38[2]; // [rsp+24h] [rbp-3Ch] BYREF
float v39[2]; // [rsp+2Ch] [rbp-34h] BYREF
float v40; // [rsp+34h] [rbp-2Ch]
if ( a1->m_activeItemButton )
{
GauntletNode::frameForType(&v35, (unsigned int)a1->m_gauntletType);
v2 = (GauntletSprite *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_activeItemButton->getNormalImage)(a1->m_activeItemButton);
((void (__fastcall *)(GauntletSprite *))v2->removeAllChildren)(v2);
GauntletSprite::addNormalSprite(v2);
((void (__fastcall *)(float *, GauntletSprite *))v2->getScaledContentSize)(v39, v2);
v40 = v39[0];
((void (__fastcall *)(_BYTE *, GauntletSprite *))v2->getScaledContentSize)(v33, v2);
sub_10028CBE0(v38, v40 * 0.5, v34 * 0.5);
v3 = ((__int64 (__fastcall *)(GauntletSprite *))v2->getChildren)(v2);
for ( i = 0; i < (unsigned int)sub_100720070(v3); ++i )
{
v5 = sub_1007200C0(v3, i);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v5 + 184LL))(v5, v38);
}
for ( j = 0; j < (unsigned int)sub_100720070(a1->m_activeObjects); ++j )
{
v7 = sub_1007200C0(a1->m_activeObjects, j);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v7 + 328LL))(v7, 1);
}
v8 = v36;
v9 = v36;
if ( (v35 & 1) != 0 )
v9 = (const char *)__p;
v10 = cocos2d::CCSprite::createWithSpriteFrameName(v9);
v11 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletLock_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSprite *, __int64))v10->addChild_0)(v10, v11, 1);
v40 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v10->getContentSize)(v10);
v12 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))v10->getContentSize)(v10);
sub_10028CBE0(v39, v40 * 0.5, 0.5 * *(float *)(v12 + 4));
((void (__fastcall *)(cocos2d::CCSprite *, float *))v11->setPosition)(v11, v39);
((void (__fastcall *)(GauntletSprite *, cocos2d::CCSprite *, __int64))v2->addChild_0)(v2, v10, 2);
((void (__fastcall *)(cocos2d::CCSprite *, float *))v10->setPosition)(v10, v38);
((void (__fastcall *)(cocos2d::CCSprite *, void *))v10->setColor)(v10, &unk_10081A243);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v10->setBlendFunc)(v10, 0x100000302LL);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v11->setBlendFunc)(v11, 0x100000302LL);
v13 = cocos2d::CCFadeOut::create(0.5);
cocos2d::CCNode::runAction(v10, v13);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v11->setOpacity)(v11, 200);
v14 = cocos2d::CCFadeTo::create(0.5, 0);
cocos2d::CCNode::runAction(v11, v14);
v15 = v36;
if ( (v35 & 1) != 0 )
v15 = (const char *)__p;
v16 = cocos2d::CCSprite::createWithSpriteFrameName(v15);
v17 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletLock_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSprite *, __int64))v16->addChild_0)(v16, v17, 1);
v40 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v16->getContentSize)(v16);
v18 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))v16->getContentSize)(v16);
sub_10028CBE0(v39, v40 * 0.5, 0.5 * *(float *)(v18 + 4));
((void (__fastcall *)(cocos2d::CCSprite *, float *))v17->setPosition)(v17, v39);
((void (__fastcall *)(GauntletSprite *, cocos2d::CCSprite *, __int64))v2->addChild_0)(v2, v16, 2);
((void (__fastcall *)(cocos2d::CCSprite *, float *))v16->setPosition)(v16, v38);
((void (__fastcall *)(cocos2d::CCSprite *, void *))v16->setColor)(v16, &unk_10081A243);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v16->setBlendFunc)(v16, 0x100000302LL);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v17->setBlendFunc)(v17, 0x100000302LL);
v19 = cocos2d::CCFadeOut::create(0.5);
cocos2d::CCNode::runAction(v16, v19);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v17->setOpacity)(v17, 200);
v20 = cocos2d::CCFadeTo::create(0.5, 0);
cocos2d::CCNode::runAction(v17, v20);
if ( (v35 & 1) != 0 )
v8 = (const char *)__p;
v21 = cocos2d::CCSprite::createWithSpriteFrameName(v8);
v22 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletLock_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSprite *, __int64))v21->addChild_0)(v21, v22, 1);
v40 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v21->getContentSize)(v21);
v23 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))v21->getContentSize)(v21);
sub_10028CBE0(v39, v40 * 0.5, 0.5 * *(float *)(v23 + 4));
((void (__fastcall *)(cocos2d::CCSprite *, float *))v22->setPosition)(v22, v39);
((void (__fastcall *)(GauntletSprite *, cocos2d::CCSprite *, __int64))v2->addChild_0)(v2, v21, 2);
((void (__fastcall *)(cocos2d::CCSprite *, float *))v21->setPosition)(v21, v38);
((void (__fastcall *)(cocos2d::CCSprite *, void *))v21->setColor)(v21, &unk_10081A243);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v21->setBlendFunc)(v21, 0x100000302LL);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v22->setBlendFunc)(v22, 0x100000302LL);
v24 = cocos2d::CCFadeOut::create(0.5);
cocos2d::CCNode::runAction(v21, v24);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v22->setOpacity)(v22, 200);
v25 = cocos2d::CCFadeTo::create(0.5, 0);
cocos2d::CCNode::runAction(v22, v25);
v40 = ((float (__fastcall *)(GauntletSprite *))v2->getScale)(v2);
((void (__fastcall *)(GauntletSprite *, float))v2->setScale)(v2, 1.6);
v26 = cocos2d::CCScaleTo::create_1(0.5, v40);
v27 = cocos2d::CCEaseBounceOut::create(v26);
cocos2d::CCNode::runAction(v2, v27);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_activeItemButton->setEnabled)(
a1->m_activeItemButton,
1);
m_levels = a1->m_levels;
v29 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_activeItemButton->getTag)(a1->m_activeItemButton);
v30 = (GJGameLevel *)sub_1007200C0(m_levels, v29);
v30->m_gauntletLevel2 = 1;
v31 = GameLevelManager::sharedState();
SavedLevel_1 = GameLevelManager::getSavedLevel_1(v31, v30);
if ( SavedLevel_1 )
SavedLevel_1->m_gauntletLevel2 = 1;
if ( (v35 & 1) != 0 )
operator delete(__p);
}
}