//
// SecretLayer3::onChest01 from 0x1403eb4f0 to 0x1403eb666 (374 bytes)
//
// 2 xrefs:
// > SecretLayer3::init @ 0x1403eaec8
// > ??> @ 0x1406d806c
//
// 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 SecretLayer3::onChest01(SecretLayer3 *a1, cocos2d::CCObject *a2)
{
GameStatsManager *v4; // rcx
GJRewardItem *v5; // rax
GJRewardItem *v6; // rbx
RewardUnlockLayer *v7; // rdi
cocos2d::CCObject *m_rewardItem; // rcx
__int128 v9; // [rsp+20h] [rbp-28h] BYREF
__int64 v10; // [rsp+30h] [rbp-18h]
__int64 v11; // [rsp+38h] [rbp-10h]
void *v12; // [rsp+60h] [rbp+18h]
if ( !a1->m_lockInput )
{
((void (__fastcall *)(cocos2d::CCObject *, _QWORD))a2->__vftable[12].getTag)(a2, 0);
((void (__fastcall *)(cocos2d::CCObject *, _QWORD))a2->__vftable[4].update)(a2, 0);
v9 = 0;
v10 = 4;
v11 = 15;
strcpy((char *)&v9, "0001");
v4 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v12 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v4 = (GameStatsManager *)qword_1406C2EE8;
}
v5 = GameStatsManager::unlockSpecialChest(v4, (__int64)&v9);
v6 = v5;
if ( v5 )
{
v7 = RewardUnlockLayer::create(v5->m_rewardType, nullptr);
a1->addChild_0(a1, v7, 100);
m_rewardItem = v7->m_rewardItem;
if ( m_rewardItem )
cocos2d::CCObject::release(m_rewardItem);
v7->m_rewardItem = v6;
cocos2d::CCObject::retain(v6);
if ( !v6->m_unk || v6->m_rewardType == v7->m_chestType )
{
v7->m_closeBtn->setVisible(v7->m_closeBtn, 0);
v7->m_closeBtn->setEnabled(v7->m_closeBtn, 0);
v7->m_wrongLabel->setVisible(v7->m_wrongLabel, 0);
v7->m_rewardCollected = 1;
if ( v7->m_animationPlayed )
RewardUnlockLayer::playRewardEffect(v7);
}
}
}
}