//
// GauntletLayer::unlockActiveItem from 0x4da354 to 0x4da5d0 (636 bytes)
//
// 0 xrefs:
//
// 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 GauntletLayer::unlockActiveItem(GauntletLayer *a1)
{
GauntletSprite *v2; // r5
float v3; // s17
cocos2d::CCArray *v4; // r7
unsigned int i; // r4
int v6; // r0
unsigned int j; // r4
int v8; // r0
int v9; // r11
cocos2d::CCSprite *v10; // r4
cocos2d::CCSprite *v11; // r7
float width; // s17
int v13; // r0
cocos2d::CCSprite_vtbl *v14; // r3
cocos2d::CCSprite_vtbl *v15; // r3
cocos2d::CCFadeOut *v16; // r0
cocos2d::CCFadeTo *v17; // r0
float v18; // r4
float v19; // r2
cocos2d::CCActionInterval *v20; // r0
cocos2d::CCEaseBounceOut *v21; // r0
cocos2d::CCArray *m_levels; // r4
unsigned int v23; // r0
GJGameLevel *v24; // r0
GJGameLevel *v25; // r4
GameLevelManager *v26; // r0
GJGameLevel *SavedLevel; // r0
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [sp+0h] [bp-3Ch]
cocos2d::CCSprite *v29; // [sp+18h] [bp-24h] BYREF
cocos2d::CCPoint v30; // [sp+1Ch] [bp-20h] BYREF
cocos2d::CCSize v31; // [sp+24h] [bp-18h] BYREF
cocos2d::CCPoint v32; // [sp+2Ch] [bp-10h] BYREF
if ( a1->m_activeItemButton )
{
GauntletNode::frameForType((int)&v29, a1->m_gauntletType);
v2 = (GauntletSprite *)a1->m_activeItemButton->getNormalImage(a1->m_activeItemButton);
GauntletSprite::toggleLockedSprite(v2, 0);
v2->getScaledContentSize(&v31, v2);
v3 = v31.width * 0.5;
v2->getScaledContentSize((cocos2d::CCSize *)&v32, v2);
cocos2d::CCPoint::CCPoint(&v30, v3, v32.y * 0.5);
v4 = v2->getChildren(v2);
for ( i = 0; i < cocos2d::CCArray::count(v4); ++i )
{
v6 = cocos2d::CCArray::objectAtIndex(v4, i);
(*(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v6 + 92))(v6, &v30);
}
for ( j = 0; j < cocos2d::CCArray::count(a1->m_activeObjects); ++j )
{
v8 = cocos2d::CCArray::objectAtIndex(a1->m_activeObjects, j);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v8 + 164))(v8, 1);
}
v9 = 3;
do
{
v10 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v29);
v11 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletLock_001.png");
v10->addChild_0(v10, v11, 1);
setPosition = v11->setPosition;
width = v10->getContentSize(v10)->width;
v13 = (int)v10->getContentSize(v10);
cocos2d::CCPoint::CCPoint(&v32, width * 0.5, *(float *)(v13 + 4) * 0.5);
setPosition(v11, &v32);
v2->addChild_0(v2, v10, 2);
v10->setPosition(v10, &v30);
v10->setColor(v10, &stru_9AC8A4);
v14 = v10->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
LODWORD(v31.width) = 770;
LODWORD(v31.height) = 1;
((void (__fastcall *)(cocos2d::CCSprite *, int, int))v14->setBlendFunc)(v10, 770, 1);
v15 = v11->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
LODWORD(v32.x) = 770;
LODWORD(v32.y) = 1;
((void (__fastcall *)(cocos2d::CCSprite *, int, int))v15->setBlendFunc)(v11, 770, 1);
v16 = cocos2d::CCFadeOut::create(0.5);
cocos2d::CCNode::runAction(v10, v16);
v11->setOpacity(v11, 200);
v17 = cocos2d::CCFadeTo::create(0.5, 0);
cocos2d::CCNode::runAction(v11, v17);
--v9;
}
while ( v9 );
v18 = COERCE_FLOAT(((int (__fastcall *)(GauntletSprite *))v2->getScale)(v2));
((void (__fastcall *)(GauntletSprite *, int))v2->setScale)(v2, 1070386381);
v20 = (cocos2d::CCActionInterval *)cocos2d::CCScaleTo::create((cocos2d::CCScaleTo *)0x3F000000, v18, v19);
v21 = cocos2d::CCEaseBounceOut::create(v20);
cocos2d::CCNode::runAction(v2, v21);
a1->m_activeItemButton->setEnabled(a1->m_activeItemButton, 1);
m_levels = a1->m_levels;
v23 = a1->m_activeItemButton->getTag(a1->m_activeItemButton);
v24 = (GJGameLevel *)cocos2d::CCArray::objectAtIndex(m_levels, v23);
v24->m_gauntletLevel2 = 1;
v25 = v24;
v26 = GameLevelManager::sharedState();
SavedLevel = GameLevelManager::getSavedLevel(v26, v25);
if ( SavedLevel )
SavedLevel->m_gauntletLevel2 = 1;
sub_774008(&v29);
}
}