//
// CurrencyRewardLayer::update from 0x90e7d8 to 0x90edfc (1572 bytes)
//
// 2 xrefs:
// > ??> @ 0xb6700
// > ??> @ 0x11aa178
//
// 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 CurrencyRewardLayer::update(CurrencyRewardLayer *a1, float a2)
{
float v3; // s8
unsigned int v5; // w20
cocos2d::CCPoint v6; // x22
cocos2d::CCDirector *v7; // x0
float v8; // s9
cocos2d::CCDirector *v9; // x0
float v10; // s13
bool v11; // cf
cocos2d::CCArray *m_objects; // x0
__int64 v13; // x24
const cocos2d::CCPoint *v14; // x0
float v15; // s0
float v16; // s2
float v17; // s0
int v18; // w0
__int64 v19; // x22
__int64 v20; // x0
__int64 (__fastcall *v21)(__int64); // x1
void (__fastcall *v22)(__int64, __int64); // x24
__int64 v23; // x0
int v24; // w0
float v25; // s0
float v26; // s0
float v27; // s2
float v28; // s0
float v29; // s1
float v30; // s2
float v31; // s5
float v32; // s2
void (__fastcall *v33)(__int64, cocos2d::CCPoint *); // x22
cocos2d::CCParticleSystem *v34; // x0
int v35; // w0
cocos2d::CCLabelBMFont *m_shardsLabel; // x0
cocos2d::CCScaleTo *v37; // x0
cocos2d::CCSequence *v38; // x22
cocos2d::CCFiniteTimeAction *v39; // x0
cocos2d::CCAction *v40; // x0
cocos2d::CCScaleTo *v41; // x0
cocos2d::CCSequence *v42; // x22
cocos2d::CCFiniteTimeAction *v43; // x0
cocos2d::CCAction *v44; // x0
cocos2d::CCScaleTo *v45; // x0
cocos2d::CCActionInterval *v46; // x0
cocos2d::CCEaseInOut *v47; // x24
cocos2d::CCActionInterval *v48; // x0
cocos2d::CCEaseInOut *v49; // x22
int v50; // w1
float v51; // s14
cocos2d::CCMoveBy *v52; // x0
cocos2d::CCEaseInOut *v53; // x20
__int64 v54; // x0
cocos2d::CCAction *v55; // x0
CurrencyRewardDelegate *m_delegate; // x0
cocos2d::CCPoint v57; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::CCPoint v58; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::CCPoint v59[2]; // [xsp+B0h] [xbp+B0h] BYREF
v3 = a2 * 60.0;
v5 = 0;
v6 = (cocos2d::CCPoint)_stack_chk_guard;
a1->m_elapsed = a1->m_elapsed + a2;
v59[1] = v6;
v7 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v7);
v8 = v59[0].y - 6.0;
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v9);
v10 = v59[0].x - 6.0;
while ( 1 )
{
v11 = v5 >= (unsigned int)cocos2d::CCArray::count(a1->m_objects);
m_objects = a1->m_objects;
if ( v11 )
break;
while ( 1 )
{
v13 = cocos2d::CCArray::objectAtIndex(m_objects, v5);
v14 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 192LL))(v13);
cocos2d::CCPoint::CCPoint(&v57, v14);
v15 = *(float *)(v13 + 632) - a2;
*(float *)(v13 + 632) = v15;
if ( v15 > 0.0 )
{
v16 = *(float *)(v13 + 624) - (float)(v3 * 0.4);
v17 = v3 * *(float *)(v13 + 620);
*(float *)(v13 + 624) = v16;
cocos2d::CCPoint::CCPoint(v59, v17, v3 * v16);
cocos2d::CCPoint::operator+(&v58, &v57, v59);
if ( v8 >= v58.y )
{
if ( v58.y < 6.0 )
{
v24 = *(_DWORD *)(v13 + 648);
v58.y = 6.0;
if ( v24 == 15 || v24 == 2 )
{
v25 = *(float *)(v13 + 624) * -0.9;
*(float *)(v13 + 624) = v25;
}
else
{
v25 = (float)(-0.6 - (float)((float)((float)rand() * 4.6566e-10) * 0.3)) * *(float *)(v13 + 624);
*(float *)(v13 + 624) = v25;
}
if ( v25 < 4.0 )
*(float *)(v13 + 624) = (float)((float)((float)rand() * 4.6566e-10) * 2.0) + 4.0;
}
}
else
{
v18 = *(_DWORD *)(v13 + 648);
v58.y = v8;
if ( v18 == 15 || v18 == 2 )
*(float *)(v13 + 624) = *(float *)(v13 + 624) * -0.9;
else
*(float *)(v13 + 624) = *(float *)(v13 + 624)
* (float)(-0.6 - (float)((float)((float)rand() * 4.6566e-10) * 0.3));
}
if ( v58.x >= 6.0 )
{
if ( v10 < v58.x )
{
v58.x = v10;
*(float *)(v13 + 620) = *(float *)(v13 + 620) * -0.9;
}
}
else
{
v58.x = 6.0;
*(float *)(v13 + 620) = *(float *)(v13 + 620) * -0.9;
}
(*(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v13 + 184LL))(v13, &v58);
v19 = *(_QWORD *)(v13 + 640);
if ( !v19 )
goto LABEL_12;
goto LABEL_11;
}
cocos2d::CCPoint::CCPoint(&v58, (const cocos2d::CCPoint *)(v13 + 652));
v26 = cocos2d::ccpDistance(&v57, &v58);
if ( v26 <= 5.0 )
break;
v27 = v26 / 10.0;
v28 = v58.x - v57.x;
v29 = v58.y - v57.y;
v30 = (float)(v27 + 10.0) / *(float *)(v13 + 628);
v31 = (float)((float)(v58.x - v57.x) / v30) * v3;
v32 = (float)((float)(v58.y - v57.y) / v30) * v3;
if ( ((float)(v58.x - v57.x) >= v31 || v28 <= 0.0) && (v28 <= v31 || v28 >= 0.0) )
v28 = v31;
if ( (v29 >= v32 || v29 <= 0.0) && (v29 <= v32 || v29 >= 0.0) )
v29 = v32;
v33 = *(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v13 + 184LL);
cocos2d::CCPoint::CCPoint(v59, v28 + v57.x, v29 + v57.y);
v33(v13, v59);
v19 = *(_QWORD *)(v13 + 640);
*(float *)(v13 + 628) = *(float *)(v13 + 628) + (float)((float)(v3 * 0.1) / a1->m_time);
if ( !v19 )
{
++v5;
goto LABEL_13;
}
LABEL_11:
v20 = v13;
v21 = *(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 192LL);
v22 = *(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v19 + 184LL);
v23 = v21(v20);
v22(v19, v23);
LABEL_12:
++v5;
LABEL_13:
v11 = v5 >= (unsigned int)cocos2d::CCArray::count(a1->m_objects);
m_objects = a1->m_objects;
if ( v11 )
goto LABEL_15;
}
v34 = *(cocos2d::CCParticleSystem **)(v13 + 640);
if ( v34 )
{
cocos2d::CCParticleSystem::stopSystem(v34);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(v13 + 640) + 520LL))(*(_QWORD *)(v13 + 640));
*(_QWORD *)(v13 + 640) = 0;
}
v35 = *(_DWORD *)(v13 + 648);
switch ( v35 )
{
case 1:
CurrencyRewardLayer::incrementCount(a1, *(_DWORD *)(v13 + 636));
break;
case 2:
CurrencyRewardLayer::incrementStarsCount(a1, *(_DWORD *)(v13 + 636));
break;
case 15:
CurrencyRewardLayer::incrementMoonsCount(a1, *(_DWORD *)(v13 + 636));
break;
case 3:
CurrencyRewardLayer::incrementDiamondsCount(a1, *(_DWORD *)(v13 + 636));
break;
default:
m_shardsLabel = a1->m_shardsLabel;
if ( m_shardsLabel && m_shardsLabel->getTag(m_shardsLabel) == *(_DWORD *)(v13 + 648) )
CurrencyRewardLayer::incrementSpecialCount2(a1, *(_DWORD *)(v13 + 636));
else
CurrencyRewardLayer::incrementSpecialCount1(a1, *(_DWORD *)(v13 + 636));
break;
}
v38 = (cocos2d::CCSequence *)cocos2d::CCScaleTo::create(v37, 0.1, 0.1);
v39 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(v13, 520, 1);
v40 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v38, v39, 0);
cocos2d::CCNode::runAction((cocos2d::CCNode *)v13, v40);
v41 = *(cocos2d::CCScaleTo **)(v13 + 664);
if ( v41 )
{
v42 = (cocos2d::CCSequence *)cocos2d::CCScaleTo::create(v41, 0.1, 0.1);
v43 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(*(_QWORD *)(v13 + 664), 520, 1);
v44 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v42, v43, 0);
cocos2d::CCNode::runAction(*(cocos2d::CCNode **)(v13 + 664), v44);
}
cocos2d::CCArray::removeObjectAtIndex(a1->m_objects, v5, 1);
}
LABEL_15:
if ( !(unsigned int)cocos2d::CCArray::count(m_objects) )
{
cocos2d::CCNode::unscheduleUpdate(a1);
v46 = (cocos2d::CCActionInterval *)cocos2d::CCScaleTo::create(v45, 0.2, 1.2);
v47 = cocos2d::CCEaseInOut::create(v46, 2.0);
v48 = (cocos2d::CCActionInterval *)cocos2d::CCScaleTo::create((cocos2d::CCScaleTo *)v47, 0.2, 1.0);
v49 = cocos2d::CCEaseInOut::create(v48, 2.0);
v50 = a1->m_rewardCount - 1;
v51 = (float)((float)((float)v50 * 0.1) + 0.5) * a1->m_time;
cocos2d::CCPoint::CCPoint(v59, 0.0, (float)(30 * v50 + 50));
v52 = cocos2d::CCMoveBy::create(v51, v59);
v53 = cocos2d::CCEaseInOut::create(v52, 2.0);
v54 = cocos2d::CCCallFunc::create(a1, 520, 1);
v55 = (cocos2d::CCAction *)cocos2d::CCSequence::create((cocos2d::CCSequence *)v47, v49, v53, v54, 0);
cocos2d::CCNode::runAction(a1->m_mainNode, v55);
m_delegate = a1->m_delegate;
if ( m_delegate )
m_delegate->currencyWillExit(m_delegate, a1);
}
}