//
// SecretRewardsLayer::switchToOpenedState from 0x1002e9a6c to 0x1002e9b4c (224 bytes)
//
// 5 xrefs:
// > SecretRewardsLayer::init @ 0x1002e8b8c
// > SecretRewardsLayer::init @ 0x1002e911c
// > SecretRewardsLayer::onSpecialItem @ 0x1002ea554
// > SecretRewardsLayer::generateChestItems @ 0x1002eb2dc
// > SecretRewardsLayer::onSelectItem @ 0x1002eb4fc
//
// 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 SecretRewardsLayer::switchToOpenedState(SecretRewardsLayer *a1, CCMenuItemSpriteExtra *a2)
{
GJChestSprite *v3; // x20
__int64 v4; // x0
unsigned int *v5; // x9
__int64 v6; // x8
_QWORD *v7; // x21
unsigned __int64 v8; // x22
__int64 v9; // x20
__int16 v10; // [xsp+Ch] [xbp-34h] BYREF
char v11; // [xsp+Eh] [xbp-32h]
v3 = (GJChestSprite *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a2->getNormalImage)(a2);
GJChestSprite::switchToState(v3, Opened, 1);
v4 = ((__int64 (__fastcall *)(GJChestSprite *))v3->getChildren)(v3);
if ( v4 )
{
v5 = *(unsigned int **)(v4 + 56);
v6 = *v5;
if ( (_DWORD)v6 )
{
v7 = *((_QWORD **)v5 + 2);
v8 = (unsigned __int64)&v7[v6 - 1];
do
{
v9 = *v7;
if ( !*v7 )
break;
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)v9 + 896LL))(*v7, 100);
v11 = -106;
v10 = -26986;
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v9 + 944LL))(v9, &v10);
++v7;
}
while ( (unsigned __int64)v7 <= v8 );
}
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a2->setEnabled)(a2, 0);
}