//
// GauntletLayer::unlockActiveItem from 0x1401f7e00 to 0x1401f8402 (1538 bytes)
//
// 2 xrefs:
// > GauntletLayer::setupGauntlet @ 0x1401f7806
// > ??> @ 0x1406cc90c
//
// 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
//
// Hidden C++ exception states: #wind=2
void GauntletLayer::unlockActiveItem(GauntletLayer *a1)
{
float v1; // xmm0_4
float v2; // xmm3_4
GauntletSprite *v4; // r12
float *v5; // rax
double v6; // xmm0_8
cocos2d::CCArray *v7; // rsi
unsigned int v8; // ebx
unsigned int i; // edi
struct cocos2d::CCObject *v10; // rax
struct cocos2d::CCObject *v11; // rax
__int64 v12; // rdx
const char *v13; // rcx
CCLightFlash *v14; // rsi
struct cocos2d::CCSprite *v15; // r14
cocos2d::CCSprite_vtbl *v16; // rbx
float *v17; // rax
const cocos2d::CCPoint *v18; // rax
__int64 v19; // rdi
__int64 v20; // rbx
struct cocos2d::CCFadeOut *v21; // rax
cocos2d::ccColor3B *v22; // r8
__int64 v23; // rdx
struct cocos2d::CCFadeTo *v24; // rax
cocos2d::ccColor3B *v25; // r8
const char *v26; // rcx
CCLightFlash *v27; // r14
struct cocos2d::CCSprite *v28; // r15
cocos2d::CCSprite_vtbl *v29; // rsi
float *v30; // rax
const cocos2d::CCPoint *v31; // rax
struct cocos2d::CCFadeOut *v32; // rax
cocos2d::ccColor3B *v33; // r8
__int64 v34; // rdx
struct cocos2d::CCFadeTo *v35; // rax
cocos2d::ccColor3B *v36; // r8
const char *v37; // rcx
CCLightFlash *v38; // r14
struct cocos2d::CCSprite *v39; // r15
cocos2d::CCSprite_vtbl *v40; // rsi
float *v41; // rax
const cocos2d::CCPoint *v42; // rax
struct cocos2d::CCFadeOut *v43; // rax
cocos2d::ccColor3B *v44; // r8
__int64 v45; // rdx
struct cocos2d::CCFadeTo *v46; // rax
cocos2d::ccColor3B *v47; // r8
double v48; // xmm0_8
struct cocos2d::CCScaleTo *v49; // rax
struct cocos2d::CCEaseBounceOut *v50; // rax
cocos2d::ccColor3B *v51; // r8
_BOOL8 v52; // rdx
unsigned int v53; // eax
struct cocos2d::CCObject *v54; // rbx
GameLevelManager *v55; // rcx
GJGameLevel *SavedGauntletLevel; // rax
int v57; // edx
float v58; // [rsp+20h] [rbp-98h] BYREF
void *v59; // [rsp+28h] [rbp-90h] BYREF
__int64 v60; // [rsp+30h] [rbp-88h] BYREF
__int64 v61; // [rsp+38h] [rbp-80h]
_QWORD v62[3]; // [rsp+40h] [rbp-78h] BYREF
unsigned __int64 v63; // [rsp+58h] [rbp-60h]
if ( a1->m_activeItemButton )
{
GauntletNode::frameForType(v62, (unsigned int)a1->m_gauntletType);
v4 = (GauntletSprite *)a1->m_activeItemButton->getNormalImage(a1->m_activeItemButton);
GauntletSprite::toggleLockedSprite(v4, 0);
((__int64 (__fastcall *)(GauntletSprite *, void **))v4->getScaledContentSize)(v4, &v59);
v5 = (float *)((__int64 (__fastcall *)(GauntletSprite *, __int64 *))v4->getScaledContentSize)(v4, &v60);
v6 = cocos2d::CCPoint::CCPoint(v1, *v5 * 0.5);
v7 = v4->getChildren(v4);
v8 = 0;
for ( i = 0; i < cocos2d::CCArray::count(v7); ++i )
{
v10 = cocos2d::CCArray::objectAtIndex(v7, i);
v10->__vftable[2].encodeWithCoder(v10, (DS_Dictionary *)&v58);
}
if ( cocos2d::CCArray::count(a1->m_activeObjects) )
{
do
{
v11 = cocos2d::CCArray::objectAtIndex(a1->m_activeObjects, v8);
LOBYTE(v12) = 1;
((void (__fastcall *)(struct cocos2d::CCObject *, __int64))v11->__vftable[4].update)(v11, v12);
++v8;
}
while ( v8 < cocos2d::CCArray::count(a1->m_activeObjects) );
}
v61 = 0x100000302LL;
v60 = 0x100000302LL;
v13 = (const char *)v62;
if ( v63 > 0xF )
v13 = (const char *)v62[0];
v14 = (CCLightFlash *)cocos2d::CCSprite::createWithSpriteFrameName(v13);
v15 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletLock_001.png");
v14->addChild_0(v14, v15, 1);
v16 = v15->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v14->getContentSize(v14);
v17 = (float *)v14->getContentSize(v14);
cocos2d::CCPoint::CCPoint(*(float *)&v6, *v17 * 0.5);
v16->setPosition_0(v15, v18);
v4->addChild_0(v4, v14, 2);
v14->setPosition_0(v14, (const cocos2d::CCPoint *)&v58);
((void (__fastcall *)(cocos2d::CCArray **, void *))v14->m_lightStripArray->__vftable)(
&v14->m_lightStripArray,
&unk_140529A88);
v19 = v61;
((void (__fastcall *)(cocos2d::CCNode **, __int64))v14->m_mainLayer->__vftable)(&v14->m_mainLayer, v61);
v20 = v60;
((void (__fastcall *)(cocos2d::CCTextureProtocol *, __int64))v15->setBlendFunc)(
&v15->cocos2d::CCTextureProtocol,
v60);
v21 = cocos2d::CCFadeOut::create(0.5);
cocos2d::CCNode::runAction(v14, (cocos2d::CCPoint)v21, v22, v2, v58);
LOBYTE(v23) = -56;
v15->setOpacity(&v15->cocos2d::CCRGBAProtocol, v23);
v24 = cocos2d::CCFadeTo::create(0.5, 0);
cocos2d::CCNode::runAction((CCLightFlash *)v15, (cocos2d::CCPoint)v24, v25, v2, v58);
v26 = (const char *)v62;
if ( v63 > 0xF )
v26 = (const char *)v62[0];
v27 = (CCLightFlash *)cocos2d::CCSprite::createWithSpriteFrameName(v26);
v28 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletLock_001.png");
v27->addChild_0(v27, v28, 1);
v29 = v28->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v27->getContentSize(v27);
v30 = (float *)v27->getContentSize(v27);
cocos2d::CCPoint::CCPoint(0.5, *v30 * 0.5);
v29->setPosition_0(v28, v31);
v4->addChild_0(v4, v27, 2);
v27->setPosition_0(v27, (const cocos2d::CCPoint *)&v58);
((void (__fastcall *)(cocos2d::CCArray **, void *))v27->m_lightStripArray->__vftable)(
&v27->m_lightStripArray,
&unk_140529A88);
((void (__fastcall *)(cocos2d::CCNode **, __int64))v27->m_mainLayer->__vftable)(&v27->m_mainLayer, v19);
((void (__fastcall *)(cocos2d::CCTextureProtocol *, __int64))v28->setBlendFunc)(
&v28->cocos2d::CCTextureProtocol,
v20);
v32 = cocos2d::CCFadeOut::create(0.5);
cocos2d::CCNode::runAction(v27, (cocos2d::CCPoint)v32, v33, v2, v58);
LOBYTE(v34) = -56;
v28->setOpacity(&v28->cocos2d::CCRGBAProtocol, v34);
v35 = cocos2d::CCFadeTo::create(0.5, 0);
cocos2d::CCNode::runAction((CCLightFlash *)v28, (cocos2d::CCPoint)v35, v36, v2, v58);
v37 = (const char *)v62;
if ( v63 > 0xF )
v37 = (const char *)v62[0];
v38 = (CCLightFlash *)cocos2d::CCSprite::createWithSpriteFrameName(v37);
v39 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletLock_001.png");
v38->addChild_0(v38, v39, 1);
v40 = v39->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v38->getContentSize(v38);
v41 = (float *)v38->getContentSize(v38);
cocos2d::CCPoint::CCPoint(0.5, *v41 * 0.5);
v40->setPosition_0(v39, v42);
v4->addChild_0(v4, v38, 2);
v38->setPosition_0(v38, (const cocos2d::CCPoint *)&v58);
((void (__fastcall *)(cocos2d::CCArray **, void *))v38->m_lightStripArray->__vftable)(
&v38->m_lightStripArray,
&unk_140529A88);
((void (__fastcall *)(cocos2d::CCNode **, __int64))v38->m_mainLayer->__vftable)(&v38->m_mainLayer, v19);
((void (__fastcall *)(cocos2d::CCTextureProtocol *, __int64))v39->setBlendFunc)(
&v39->cocos2d::CCTextureProtocol,
v20);
v43 = cocos2d::CCFadeOut::create(0.5);
cocos2d::CCNode::runAction(v38, (cocos2d::CCPoint)v43, v44, v2, v58);
LOBYTE(v45) = -56;
v39->setOpacity(&v39->cocos2d::CCRGBAProtocol, v45);
v46 = cocos2d::CCFadeTo::create(0.5, 0);
cocos2d::CCNode::runAction((CCLightFlash *)v39, (cocos2d::CCPoint)v46, v47, v2, v58);
v48 = ((double (__fastcall *)(GauntletSprite *))v4->getScale)(v4);
((void (__fastcall *)(GauntletSprite *))v4->setScale_0)(v4);
v49 = cocos2d::CCScaleTo::create(0.5, *(float *)&v48);
v50 = cocos2d::CCEaseBounceOut::create(v49);
cocos2d::CCNode::runAction((CCLightFlash *)v4, (cocos2d::CCPoint)v50, v51, v2, v58);
LOBYTE(v52) = 1;
a1->m_activeItemButton->setEnabled(a1->m_activeItemButton, v52);
v53 = a1->m_activeItemButton->getTag(a1->m_activeItemButton);
v54 = cocos2d::CCArray::objectAtIndex(a1->m_levels, v53);
BYTE2(v54[12].m_unknown2) = 1;
v55 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v59 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v59);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v55 = (GameLevelManager *)qword_1406C2EC0;
}
if ( v54[15].m_uUnknown - v54[15].m_unknown2 <= 0 )
{
v57 = v54[5].m_uOrderOfArrival - v54[5].m_unknown5;
if ( BYTE1(v54[12].m_unknown2) )
SavedGauntletLevel = GameLevelManager::getSavedGauntletLevel(v55, v57);
else
SavedGauntletLevel = GameLevelManager::getSavedLevel(v55, v57);
}
else
{
SavedGauntletLevel = GameLevelManager::getSavedDailyLevel(v55, v54[15].m_uUnknown - v54[15].m_unknown2);
}
if ( SavedGauntletLevel )
SavedGauntletLevel->m_gauntletLevel2 = 1;
sub_14003A830((__int64)v62);
}
}