//
// GameStatsManager::preProcessReward from 0x100333694 to 0x100333830 (412 bytes)
//
// 4 xrefs:
// > RewardsPage::rewardsStatusFinished @ 0x1001c4b10
// > GameStatsManager::unlockSpecialChest @ 0x10033693c
// > GameStatsManager::unlockSecretChest @ 0x10033e0e8
// > GameStatsManager::unlockGoldChest @ 0x10033e1cc
//
// 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 GameStatsManager::preProcessReward(GameStatsManager *a1, GJRewardItem *a2)
{
cocos2d::CCArray *m_rewardObjects; // x21
int v5; // w25
__int64 v6; // x22
__int64 v7; // x23
unsigned int v8; // w0
const char *v10; // x1
void **v11; // x1
int Stat; // w24
int v13; // w8
GJRewardObject *RewardObjectForType; // x0
void *__p[2]; // [xsp+10h] [xbp-80h] BYREF
char v16; // [xsp+27h] [xbp-69h]
void *v17[2]; // [xsp+28h] [xbp-68h] BYREF
char v18; // [xsp+3Fh] [xbp-51h]
m_rewardObjects = a2->m_rewardObjects;
if ( m_rewardObjects && (unsigned int)sub_10024A36C((__int64)a2->m_rewardObjects) )
{
v5 = 0;
v6 = 0;
do
{
v7 = sub_10024A388((__int64)m_rewardObjects, v6);
v8 = *(_DWORD *)(v7 + 56);
if ( v8 > 0xE || ((1 << v8) & 0x7C3E) == 0 )
goto LABEL_22;
GJRewardItem::rewardItemToStat(v17);
v10 = v18 >= 0 ? (const char *)v17 : (const char *)v17[0];
if ( GameStatsManager::getStat(a1, v10) > 99 )
{
Stat = 100;
}
else
{
GJRewardItem::rewardItemToStat(__p);
if ( v16 >= 0 )
v11 = __p;
else
v11 = (void **)__p[0];
Stat = GameStatsManager::getStat(a1, (const char *)v11);
if ( v16 < 0 )
operator delete(__p[0]);
}
if ( v18 < 0 )
operator delete(v17[0]);
v13 = *(_DWORD *)(v7 + 68);
if ( v13 + Stat < 100 || (v5 += v13 + Stat - 100, *(_DWORD *)(v7 + 68) = 100 - Stat, 100 - Stat >= 1) )
LABEL_22:
v6 = (unsigned int)(v6 + 1);
else
sub_10024A44C((__int64)m_rewardObjects, v6, 1);
}
while ( (unsigned int)v6 < (unsigned int)sub_10024A36C((__int64)m_rewardObjects) );
if ( v5 >= 1 )
{
RewardObjectForType = GJRewardItem::getRewardObjectForType(a2, BonusKey|FireShard);
RewardObjectForType->m_total = (int)(float)((float)RewardObjectForType->m_total
+ (float)((float)(unsigned int)v5 * 100.0));
}
}
}