//
// GameStatsManager::generateItemUnlockableData from 0x41cc88 to 0x41ce84 (508 bytes)
//
// 1 xrefs:
// > GameStatsManager::init @ 0x4205de
//
// 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 GameStatsManager::generateItemUnlockableData(GameStatsManager *a1)
{
cocos2d::CCDictionary *v2; // r0
int v3; // r11
UnlockType v4; // r4
int v5; // r6
int v6; // r5
int i; // r8
AchievementManager *v8; // r0
GJUnlockableItem *v9; // r7
int v10; // r9
GameStatsManager *v11; // r0
GJUnlockableItem *v12; // r0
ShopType m_shopType; // r2
int v14; // r1
GameStatsManager *v15; // r0
GameStatsManager *v16; // r0
GJStoreItem *StoreItem; // [sp+8h] [bp-1Ch]
cocos2d::CCDictionary *m_unlockedItems; // [sp+8h] [bp-1Ch]
int v19; // [sp+10h] [bp-14h] BYREF
_DWORD v20[2]; // [sp+14h] [bp-10h] BYREF
if ( a1->m_unlockedItems )
return;
v2 = cocos2d::CCDictionary::create();
v3 = 0;
v4 = 1;
v5 = 485;
v6 = 1;
a1->m_unlockedItems = v2;
cocos2d::CCObject::retain(v2);
while ( 2 )
{
for ( i = v6; i <= v5; ++i )
{
v8 = AchievementManager::sharedState();
AchievementManager::achievementForUnlock((int)&v19, (int)v8, i, v4);
if ( *(_DWORD *)(v19 - 12) )
{
v9 = GJUnlockableItem::create();
v9->setTag(v9, 1);
v10 = 1;
}
else
{
v10 = 0;
v9 = nullptr;
}
v11 = GameStatsManager::sharedState();
StoreItem = GameStatsManager::getStoreItem(v11, i);
if ( StoreItem )
{
++v10;
if ( !v9 )
{
v12 = GJUnlockableItem::create();
v9 = v12;
m_shopType = StoreItem->m_shopType;
switch ( m_shopType )
{
case Secret:
v14 = 5;
break;
case Community:
v14 = 6;
break;
case Mechanic:
v14 = 7;
break;
case Diamond:
v14 = 8;
break;
default:
v14 = 4;
break;
}
v12->setTag(v12, v14);
}
}
v15 = GameStatsManager::sharedState();
if ( GameStatsManager::getSecretChestForItem(v15, i, v4) > 0 )
{
++v10;
if ( !v9 )
{
v9 = GJUnlockableItem::create();
v9->setTag(v9, 2);
}
}
v16 = GameStatsManager::sharedState();
if ( GameStatsManager::getSpecialChestKeyForItem(v16, i, v4) )
{
if ( !v9 )
{
v9 = GJUnlockableItem::create();
v9->setTag(v9, 3);
}
LABEL_30:
m_unlockedItems = a1->m_unlockedItems;
GameStatsManager::getItemKey((GameStatsManager *)v20, (int)a1, i, v4);
cocos2d::CCDictionary::setObject((int)m_unlockedItems, v9);
sub_774008(v20);
goto LABEL_31;
}
if ( !v10 && i > v6 )
{
v20[0] = v4;
v20[1] = i;
std::_Rb_tree,std::pair,std::_Identity>,std::less>,std::allocator>>::find(
(int)&a1->m_wraithIcons,
v20);
}
if ( v9 )
goto LABEL_30;
LABEL_31:
sub_774008(&v19);
}
if ( ++v3 != 15 )
{
switch ( v3 )
{
case 2:
v4 = 5;
v6 = 1;
v5 = 118;
continue;
case 3:
v4 = Bird;
v6 = 1;
v5 = 149;
continue;
case 4:
v4 = Dart;
v6 = 1;
v5 = 96;
continue;
case 5:
v4 = 8;
v6 = 1;
v5 = 68;
continue;
case 6:
v4 = 9;
v6 = 1;
v5 = 69;
continue;
case 7:
v4 = Streak;
v6 = 1;
v5 = 7;
continue;
case 8:
v4 = Death;
goto LABEL_48;
case 9:
v4 = Col1;
goto LABEL_43;
case 10:
v4 = Col2;
LABEL_43:
v6 = 0;
v5 = 107;
break;
case 11:
v4 = GJItem|0x1;
v6 = 1;
v5 = 43;
break;
case 12:
v4 = GJItem|Col1;
v6 = 1;
v5 = 8;
break;
case 13:
v4 = GJItem|Col2;
v6 = 1;
v5 = 6;
break;
case 14:
v4 = GJItem;
LABEL_48:
v6 = 1;
v5 = 20;
break;
default:
v4 = 4;
v6 = 1;
v5 = 169;
break;
}
continue;
}
break;
}
}