//
// GauntletLayer::unlockActiveItem from 0x1402fcc00 to 0x1402fd22b (1579 bytes)
//
// 2 xrefs:
// > GauntletLayer::setupGauntlet @ 0x1402fc5e9
// > ??> @ 0x14091e398
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:30:06 +0000
//
// Hidden C++ exception states: #wind=2
void __fastcall GauntletLayer::unlockActiveItem(__int64 a1)
{
cocos2d::CCNode *v2; // r12
float v3; // xmm6_4
float *v4; // rax
cocos2d::CCArray *v5; // rsi
unsigned int v6; // ebx
unsigned int i; // edi
struct cocos2d::CCObject *v8; // rax
struct cocos2d::CCObject *v9; // rax
__int64 v10; // rdx
const char *v11; // rcx
cocos2d::CCNode *v12; // rsi
struct cocos2d::CCSprite *v13; // r14
__int64 v14; // rbx
float v15; // xmm6_4
float *v16; // rax
__int64 v17; // rax
struct cocos2d::CCAction *v18; // rax
__int64 v19; // rdx
struct cocos2d::CCAction *v20; // rax
const char *v21; // rcx
cocos2d::CCNode *v22; // r14
struct cocos2d::CCSprite *v23; // r15
__int64 v24; // rsi
float v25; // xmm6_4
float *v26; // rax
__int64 v27; // rax
struct cocos2d::CCAction *v28; // rax
__int64 v29; // rdx
struct cocos2d::CCAction *v30; // rax
const char *v31; // rcx
cocos2d::CCNode *v32; // r14
struct cocos2d::CCSprite *v33; // r15
__int64 v34; // rsi
float v35; // xmm6_4
float *v36; // rax
__int64 v37; // rax
struct cocos2d::CCAction *v38; // rax
__int64 v39; // rdx
struct cocos2d::CCAction *v40; // rax
double v41; // xmm0_8
struct cocos2d::CCActionInterval *v42; // rax
struct cocos2d::CCAction *v43; // rax
__int64 v44; // rdx
cocos2d::CCArray *v45; // rbx
unsigned int v46; // eax
struct cocos2d::CCObject *v47; // rbx
__int64 v48; // rcx
__int64 SavedGauntletLevel; // rax
__int64 v50; // [rsp+20h] [rbp-88h] BYREF
_BYTE v51[8]; // [rsp+28h] [rbp-80h] BYREF
void *v52; // [rsp+30h] [rbp-78h] BYREF
_QWORD v53[3]; // [rsp+38h] [rbp-70h] BYREF
unsigned __int64 v54; // [rsp+50h] [rbp-58h]
if ( *(_QWORD *)(a1 + 456) )
{
GauntletNode::frameForType(v53, *(unsigned int *)(a1 + 432));
v2 = (cocos2d::CCNode *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 456) + 952LL))(*(_QWORD *)(a1 + 456));
GauntletSprite::toggleLockedSprite(v2, 0);
v3 = *(float *)((*(__int64 (__fastcall **)(cocos2d::CCNode *, void **))(*(_QWORD *)v2 + 328LL))(v2, &v52) + 4) * 0.5;
v4 = (float *)(*(__int64 (__fastcall **)(cocos2d::CCNode *, __int64 *))(*(_QWORD *)v2 + 328LL))(v2, &v50);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v51, *v4 * 0.5, v3);
v5 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)v2 + 480LL))(v2);
v6 = 0;
for ( i = 0; i < cocos2d::CCArray::count(v5); ++i )
{
v8 = cocos2d::CCArray::objectAtIndex(v5, i);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _BYTE *))(*(_QWORD *)v8 + 184LL))(v8, v51);
}
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 464)) )
{
do
{
v9 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 464), v6);
LOBYTE(v10) = 1;
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(*(_QWORD *)v9 + 336LL))(v9, v10);
++v6;
}
while ( v6 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 464)) );
}
v11 = (const char *)v53;
if ( v54 > 0xF )
v11 = (const char *)v53[0];
v12 = cocos2d::CCSprite::createWithSpriteFrameName(v11);
v13 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletLock_001.png");
(*(void (__fastcall **)(cocos2d::CCNode *, struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v12 + 456LL))(
v12,
v13,
1);
v14 = *(_QWORD *)v13;
v15 = *(float *)((*(__int64 (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)v12 + 320LL))(v12) + 4) * 0.5;
v16 = (float *)(*(__int64 (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)v12 + 320LL))(v12);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, *v16 * 0.5, v15);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v14 + 184))(v13, v17);
(*(void (__fastcall **)(cocos2d::CCNode *, cocos2d::CCNode *, __int64))(*(_QWORD *)v2 + 456LL))(v2, v12, 2);
(*(void (__fastcall **)(cocos2d::CCNode *, _BYTE *))(*(_QWORD *)v12 + 184LL))(v12, v51);
(**((void (__fastcall ***)(__int64, void *))v12 + 40))((__int64)v12 + 320, &unk_14070343C);
v50 = 0x100000302LL;
(**((void (__fastcall ***)(__int64, __int64))v12 + 43))((__int64)v12 + 344, 0x100000302LL);
v50 = 0x100000302LL;
(**((void (__fastcall ***)(__int64, __int64))v13 + 43))((__int64)v13 + 344, 0x100000302LL);
v18 = cocos2d::CCFadeOut::create(0.5);
cocos2d::CCNode::runAction(v12, v18);
LOBYTE(v19) = -56;
(*(void (__fastcall **)(__int64, __int64))(*((_QWORD *)v13 + 40) + 40LL))((__int64)v13 + 320, v19);
v20 = cocos2d::CCFadeTo::create(0.5, 0);
cocos2d::CCNode::runAction(v13, v20);
v21 = (const char *)v53;
if ( v54 > 0xF )
v21 = (const char *)v53[0];
v22 = cocos2d::CCSprite::createWithSpriteFrameName(v21);
v23 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletLock_001.png");
(*(void (__fastcall **)(cocos2d::CCNode *, struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v22 + 456LL))(
v22,
v23,
1);
v24 = *(_QWORD *)v23;
v25 = *(float *)((*(__int64 (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)v22 + 320LL))(v22) + 4) * 0.5;
v26 = (float *)(*(__int64 (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)v22 + 320LL))(v22);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, *v26 * 0.5, v25);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v24 + 184))(v23, v27);
(*(void (__fastcall **)(cocos2d::CCNode *, cocos2d::CCNode *, __int64))(*(_QWORD *)v2 + 456LL))(v2, v22, 2);
(*(void (__fastcall **)(cocos2d::CCNode *, _BYTE *))(*(_QWORD *)v22 + 184LL))(v22, v51);
(**((void (__fastcall ***)(__int64, void *))v22 + 40))((__int64)v22 + 320, &unk_14070343C);
(**((void (__fastcall ***)(__int64, __int64))v22 + 43))((__int64)v22 + 344, 0x100000302LL);
(**((void (__fastcall ***)(__int64, __int64))v23 + 43))((__int64)v23 + 344, 0x100000302LL);
v28 = cocos2d::CCFadeOut::create(0.5);
cocos2d::CCNode::runAction(v22, v28);
LOBYTE(v29) = -56;
(*(void (__fastcall **)(__int64, __int64))(*((_QWORD *)v23 + 40) + 40LL))((__int64)v23 + 320, v29);
v30 = cocos2d::CCFadeTo::create(0.5, 0);
cocos2d::CCNode::runAction(v23, v30);
v31 = (const char *)v53;
if ( v54 > 0xF )
v31 = (const char *)v53[0];
v32 = cocos2d::CCSprite::createWithSpriteFrameName(v31);
v33 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletLock_001.png");
(*(void (__fastcall **)(cocos2d::CCNode *, struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v32 + 456LL))(
v32,
v33,
1);
v34 = *(_QWORD *)v33;
v35 = *(float *)((*(__int64 (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)v32 + 320LL))(v32) + 4) * 0.5;
v36 = (float *)(*(__int64 (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)v32 + 320LL))(v32);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, *v36 * 0.5, v35);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v34 + 184))(v33, v37);
(*(void (__fastcall **)(cocos2d::CCNode *, cocos2d::CCNode *, __int64))(*(_QWORD *)v2 + 456LL))(v2, v32, 2);
(*(void (__fastcall **)(cocos2d::CCNode *, _BYTE *))(*(_QWORD *)v32 + 184LL))(v32, v51);
(**((void (__fastcall ***)(__int64, void *))v32 + 40))((__int64)v32 + 320, &unk_14070343C);
(**((void (__fastcall ***)(__int64, __int64))v32 + 43))((__int64)v32 + 344, 0x100000302LL);
(**((void (__fastcall ***)(__int64, __int64))v33 + 43))((__int64)v33 + 344, 0x100000302LL);
v38 = cocos2d::CCFadeOut::create(0.5);
cocos2d::CCNode::runAction(v32, v38);
LOBYTE(v39) = -56;
(*(void (__fastcall **)(__int64, __int64))(*((_QWORD *)v33 + 40) + 40LL))((__int64)v33 + 320, v39);
v40 = cocos2d::CCFadeTo::create(0.5, 0);
cocos2d::CCNode::runAction(v33, v40);
v41 = (*(double (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)v2 + 168LL))(v2);
(*(void (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)v2 + 160LL))(v2);
v42 = cocos2d::CCScaleTo::create(0.5, *(float *)&v41);
v43 = cocos2d::CCEaseBounceOut::create(v42);
cocos2d::CCNode::runAction(v2, v43);
LOBYTE(v44) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 456) + 936LL))(*(_QWORD *)(a1 + 456), v44);
v45 = *(cocos2d::CCArray **)(a1 + 416);
v46 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 456) + 56LL))(*(_QWORD *)(a1 + 456));
v47 = cocos2d::CCArray::objectAtIndex(v45, v46);
*((_BYTE *)v47 + 722) = 1;
v48 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v52 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v52);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v48 = *(_QWORD *)&qword_14090BFB0;
}
if ( *((_DWORD *)v47 + 248) - *((_DWORD *)v47 + 249) <= 0 )
{
if ( *((_BYTE *)v47 + 721) )
SavedGauntletLevel = GameLevelManager::getSavedGauntletLevel(v48);
else
SavedGauntletLevel = GameLevelManager::getSavedLevel(v48);
}
else
{
SavedGauntletLevel = GameLevelManager::getSavedDailyLevel(v48);
}
if ( SavedGauntletLevel )
*(_BYTE *)(SavedGauntletLevel + 722) = 1;
sub_14003D310((__int64)v53);
}
}