//
// CurrencyRewardLayer::update from 0x1400a2940 to 0x1400a3302 (2498 bytes)
//
// 2 xrefs:
// > ??> @ 0x140543820
// > ??> @ 0x1406c76c8
//
// 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=1
void CurrencyRewardLayer::update(CurrencyRewardLayer *a1, float a2)
{
float v2; // xmm3_4
float v4; // xmm9_4
cocos2d::CCDirector *v5; // rax
float v6; // xmm15_4
__int64 v7; // rcx
cocos2d::CCDirector *v8; // rax
float v9; // xmm12_4
unsigned int v10; // esi
struct cocos2d::CCObject *v11; // rdi
char v12; // r15
const struct cocos2d::CCPoint *v13; // rax
unsigned int v14; // xmm0_4
int v15; // xmm2_4
int v16; // eax
float v17; // xmm0_4
int v18; // eax
float v19; // xmm1_4
int v20; // eax
const struct cocos2d::CCPoint *v21; // r8
float v22; // xmm0_4
float v23; // xmm4_4
float v24; // xmm0_4
float v25; // xmm1_4
float v26; // xmm2_4
cocos2d::CCObject_vtbl *v27; // rbx
DS_Dictionary *v28; // rax
__int64 *v29; // rbx
__int64 v30; // rbx
__int64 v31; // rax
cocos2d::CCParticleSystem *v32; // rcx
int m_unknown2; // eax
CurrencyRewardLayer *m_uAutoReleaseCount; // rcx
cocos2d::CCLabelProtocol_vtbl *v35; // rbx
__int64 v36; // rax
CurrencyRewardLayer *v37; // rcx
cocos2d::CCLabelProtocol_vtbl *v38; // rbx
__int64 v39; // rax
CurrencyRewardLayer *v40; // rcx
cocos2d::CCLabelProtocol_vtbl *v41; // rbx
__int64 v42; // rax
CurrencyRewardLayer *v43; // rcx
cocos2d::CCLabelProtocol_vtbl *v44; // rbx
__int64 v45; // rax
cocos2d::CCLabelBMFont *m_shardsLabel; // rcx
CurrencyRewardLayer *v47; // rcx
cocos2d::CCLabelProtocol_vtbl *v48; // rbx
__int64 v49; // rax
CurrencyRewardLayer *v50; // rcx
cocos2d::CCLabelProtocol_vtbl *v51; // rbx
__int64 v52; // rax
struct cocos2d::CCScaleTo *v53; // rbx
__int64 v54; // rax
struct cocos2d::CCSequence *v55; // rax
cocos2d::ccColor3B *v56; // r8
struct cocos2d::CCScaleTo *v57; // rbx
__int64 v58; // rax
struct cocos2d::CCSequence *v59; // rax
cocos2d::ccColor3B *v60; // r8
unsigned int v61; // eax
struct cocos2d::CCScaleTo *v62; // rax
struct cocos2d::CCEaseInOut *v63; // rsi
struct cocos2d::CCScaleTo *v64; // rax
struct cocos2d::CCEaseInOut *v65; // rdi
const struct cocos2d::CCPoint *v66; // rax
struct cocos2d::CCMoveBy *v67; // rax
struct cocos2d::CCEaseInOut *v68; // rbx
__int64 v69; // rax
struct cocos2d::CCSequence *v70; // rax
cocos2d::ccColor3B *v71; // r8
CurrencyRewardDelegate *m_delegate; // rcx
float v73; // [rsp+28h] [rbp-E0h]
float v74; // [rsp+38h] [rbp-D0h] BYREF
float v75; // [rsp+3Ch] [rbp-CCh]
cocos2d::CCPoint v76; // [rsp+40h] [rbp-C8h] BYREF
cocos2d::CCPoint v77; // [rsp+48h] [rbp-C0h] BYREF
float v78; // [rsp+50h] [rbp-B8h]
float v79; // [rsp+54h] [rbp-B4h]
float v80; // [rsp+58h] [rbp-B0h]
cocos2d::CCPoint v81; // [rsp+5Ch] [rbp-ACh] BYREF
cocos2d::CCPoint v82; // [rsp+64h] [rbp-A4h] BYREF
_BYTE v83[528]; // [rsp+78h] [rbp-90h] BYREF
a1->m_elapsed = a2 + a1->m_elapsed;
v78 = a2;
v4 = a2 * 60.0;
v5 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
v6 = *(float *)(*(_QWORD *)&cocos2d::CCDirector::getWinSize(v5) + 4LL) - 6.0;
v8 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v7);
v9 = **(float **)&cocos2d::CCDirector::getWinSize(v8) - 6.0;
v79 = (float)(a2 * 60.0) * 0.40000001;
v80 = (float)(a2 * 60.0) * 0.1;
v10 = 0;
if ( cocos2d::CCArray::count(a1->m_objects) )
{
while ( 1 )
{
v11 = cocos2d::CCArray::objectAtIndex(a1->m_objects, v10);
v12 = 0;
v13 = (const struct cocos2d::CCPoint *)((__int64 (__fastcall *)(struct cocos2d::CCObject *))v11->__vftable[2].getTag)(v11);
cocos2d::CCPoint::CCPoint(&v77, v13);
*(float *)&v14 = *(float *)&v11[11].m_uReference - v78;
v11[11].m_uReference = v14;
if ( *(float *)&v14 > 0.0 )
break;
cocos2d::CCPoint::CCPoint(&v76, (const struct cocos2d::CCPoint *)&v11[11].m_nZOrder);
v22 = cocos2d::ccpDistance((cocos2d *)&v77, &v76, v21);
if ( v22 <= 5.0 )
{
v32 = *(cocos2d::CCParticleSystem **)&v11[11].m_uIndexInArray;
if ( v32 )
{
cocos2d::CCParticleSystem::stopSystem(v32);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&v11[11].m_uIndexInArray + 512LL))(*(_QWORD *)&v11[11].m_uIndexInArray);
*(_QWORD *)&v11[11].m_uIndexInArray = 0;
}
m_unknown2 = v11[11].m_unknown2;
switch ( m_unknown2 )
{
case 1:
m_uAutoReleaseCount = (CurrencyRewardLayer *)v11[11].m_uAutoReleaseCount;
if ( a1->m_orbsLabel )
{
a1->m_orbs += (int)m_uAutoReleaseCount;
CurrencyRewardLayer::pulseSprite(m_uAutoReleaseCount, a1->m_orbsSprite);
fmt::BasicWriter::BasicWriter(v83);
fmt::BasicWriter::operator<<(v83, (unsigned int)a1->m_orbs);
v35 = a1->m_orbsLabel->__vftable;
v36 = fmt::BasicWriter::c_str(v83);
v35->setString(&a1->m_orbsLabel->cocos2d::CCLabelProtocol, (const char *)v36);
break;
}
LABEL_58:
v53 = cocos2d::CCScaleTo::create(0.1, 0.1);
v54 = cocos2d::CCCallFunc::create(v11, sub_14003BE70);
v55 = cocos2d::CCSequence::create(v53, v54, 0);
cocos2d::CCNode::runAction((CCLightFlash *)v11, (cocos2d::CCPoint)v55, v56, v2, v73);
if ( v11[12].__vftable )
{
v57 = cocos2d::CCScaleTo::create(0.1, 0.1);
v58 = cocos2d::CCCallFunc::create(v11[12].__vftable, sub_14003BE70);
v59 = cocos2d::CCSequence::create(v57, v58, 0);
cocos2d::CCNode::runAction((CCLightFlash *)v11[12].__vftable, (cocos2d::CCPoint)v59, v60, v2, v73);
}
cocos2d::CCArray::removeObjectAtIndex(a1->m_objects, v10, 1);
v12 = 1;
goto LABEL_61;
case 2:
v37 = (CurrencyRewardLayer *)v11[11].m_uAutoReleaseCount;
if ( !a1->m_starsLabel )
goto LABEL_58;
a1->m_stars += (int)v37;
CurrencyRewardLayer::pulseSprite(v37, a1->m_starsSprite);
fmt::BasicWriter::BasicWriter(v83);
fmt::BasicWriter::operator<<(v83, (unsigned int)a1->m_stars);
v38 = a1->m_starsLabel->__vftable;
v39 = fmt::BasicWriter::c_str(v83);
v38->setString(&a1->m_starsLabel->cocos2d::CCLabelProtocol, (const char *)v39);
break;
case 15:
v40 = (CurrencyRewardLayer *)v11[11].m_uAutoReleaseCount;
if ( !a1->m_moonsLabel )
goto LABEL_58;
a1->m_moons += (int)v40;
CurrencyRewardLayer::pulseSprite(v40, a1->m_moonsSprite);
fmt::BasicWriter::BasicWriter(v83);
fmt::BasicWriter::operator<<(v83, (unsigned int)a1->m_moons);
v41 = a1->m_moonsLabel->__vftable;
v42 = fmt::BasicWriter::c_str(v83);
v41->setString(&a1->m_moonsLabel->cocos2d::CCLabelProtocol, (const char *)v42);
break;
case 3:
v43 = (CurrencyRewardLayer *)v11[11].m_uAutoReleaseCount;
if ( !a1->m_diamondsLabel )
goto LABEL_58;
a1->m_diamonds += (int)v43;
CurrencyRewardLayer::pulseSprite(v43, a1->m_diamondsSprite);
fmt::BasicWriter::BasicWriter(v83);
fmt::BasicWriter::operator<<(v83, (unsigned int)a1->m_diamonds);
v44 = a1->m_diamondsLabel->__vftable;
v45 = fmt::BasicWriter::c_str(v83);
v44->setString(&a1->m_diamondsLabel->cocos2d::CCLabelProtocol, (const char *)v45);
break;
default:
m_shardsLabel = a1->m_shardsLabel;
if ( m_shardsLabel && m_shardsLabel->getTag(m_shardsLabel) == v11[11].m_unknown2 )
{
v47 = (CurrencyRewardLayer *)v11[11].m_uAutoReleaseCount;
if ( !a1->m_shardsLabel )
goto LABEL_58;
a1->m_shards += (int)v47;
CurrencyRewardLayer::pulseSprite(v47, a1->m_shardsSprite);
fmt::BasicWriter::BasicWriter(v83);
fmt::BasicWriter::operator<<(v83, (unsigned int)a1->m_shards);
v48 = a1->m_shardsLabel->__vftable;
v49 = fmt::BasicWriter::c_str(v83);
v48->setString(&a1->m_shardsLabel->cocos2d::CCLabelProtocol, (const char *)v49);
}
else
{
v50 = (CurrencyRewardLayer *)v11[11].m_uAutoReleaseCount;
if ( !a1->m_keysLabel )
goto LABEL_58;
a1->m_keys += (int)v50;
CurrencyRewardLayer::pulseSprite(v50, a1->m_keysSprite);
fmt::BasicWriter::BasicWriter(v83);
fmt::BasicWriter::operator<<(v83, (unsigned int)a1->m_keys);
v51 = a1->m_keysLabel->__vftable;
v52 = fmt::BasicWriter::c_str(v83);
v51->setString(&a1->m_keysLabel->cocos2d::CCLabelProtocol, (const char *)v52);
}
break;
}
fmt::BasicWriter::~BasicWriter(v83);
goto LABEL_58;
}
v23 = v76.x - v77.x;
v2 = v76.y - v77.y;
v24 = (float)((float)(v22 / 10.0) + 10.0) / *(float *)&v11[11].m_nTag;
v25 = (float)((float)(v76.x - v77.x) / v24) * v4;
v26 = (float)((float)(v76.y - v77.y) / v24) * v4;
if ( (float)(v76.x - v77.x) > 0.0 && v25 > v23 || v23 < 0.0 && v23 > v25 )
v25 = v76.x - v77.x;
if ( v2 > 0.0 && v26 > v2 || v2 < 0.0 && v2 > v26 )
v26 = v76.y - v77.y;
v27 = v11->__vftable;
cocos2d::CCPoint::CCPoint(&v81, v25 + v77.x, v26 + v77.y);
v27[2].encodeWithCoder(v11, v28);
*(float *)&v11[11].m_nTag = (float)(v80 / a1->m_time) + *(float *)&v11[11].m_nTag;
LABEL_34:
if ( v11 )
{
v29 = *(__int64 **)&v11[11].m_uIndexInArray;
if ( v29 )
{
v30 = *v29;
v31 = ((__int64 (__fastcall *)(struct cocos2d::CCObject *))v11->__vftable[2].getTag)(v11);
(*(void (__fastcall **)(_QWORD, __int64))(v30 + 184))(*(_QWORD *)&v11[11].m_uIndexInArray, v31);
}
}
LABEL_61:
v61 = v10 + 1;
if ( v12 )
v61 = v10;
v10 = v61;
if ( v61 >= cocos2d::CCArray::count(a1->m_objects) )
goto LABEL_64;
}
*(float *)&v15 = *(float *)&v11[11].m_nLuaID - v79;
v11[11].m_nLuaID = v15;
cocos2d::CCPoint::CCPoint(&v82, v4 * *(float *)&v11[11].m_uID, *(float *)&v15 * v4);
cocos2d::CCPoint::operator+(&v77, &v74);
if ( v75 <= v6 )
{
if ( v75 >= 6.0
|| ((v75 = 6.0, v18 = v11[11].m_unknown2, v18 == 2) || v18 == 15
? (v19 = *(float *)&v11[11].m_nLuaID * -0.89999998)
: (v19 = (float)(-0.60000002 - (float)((float)((float)rand() / 32767.0) * 0.30000001))
* *(float *)&v11[11].m_nLuaID),
*(float *)&v11[11].m_nLuaID = v19,
v19 >= 4.0) )
{
LABEL_16:
if ( v74 >= 6.0 )
{
if ( v74 <= v9 )
{
LABEL_21:
v11->__vftable[2].encodeWithCoder(v11, (DS_Dictionary *)&v74);
goto LABEL_34;
}
v74 = v9;
}
else
{
v74 = 6.0;
}
*(float *)&v11[11].m_uID = *(float *)&v11[11].m_uID * -0.89999998;
goto LABEL_21;
}
v20 = rand();
v17 = (float)((float)((float)v20 / 32767.0) + (float)((float)v20 / 32767.0)) + 4.0;
}
else
{
v75 = v6;
v16 = v11[11].m_unknown2;
if ( v16 != 2 && v16 != 15 )
{
*(float *)&v11[11].m_nLuaID = (float)(-0.60000002 - (float)((float)((float)rand() / 32767.0) * 0.30000001))
* *(float *)&v11[11].m_nLuaID;
goto LABEL_16;
}
v17 = *(float *)&v11[11].m_nLuaID * -0.89999998;
}
*(float *)&v11[11].m_nLuaID = v17;
goto LABEL_16;
}
LABEL_64:
if ( !cocos2d::CCArray::count(a1->m_objects) )
{
cocos2d::CCNode::unscheduleUpdate(a1);
v62 = cocos2d::CCScaleTo::create(0.2, 1.2);
v63 = cocos2d::CCEaseInOut::create(v62, 2.0);
v64 = cocos2d::CCScaleTo::create(0.2, 1.0);
v65 = cocos2d::CCEaseInOut::create(v64, 2.0);
cocos2d::CCPoint::CCPoint(&v81, 0.0, (float)(30 * a1->m_rewardCount + 20));
v67 = cocos2d::CCMoveBy::create((float)((float)((float)(a1->m_rewardCount - 1) * 0.1) + 0.5) * a1->m_time, v66);
v68 = cocos2d::CCEaseInOut::create(v67, 2.0);
v69 = cocos2d::CCCallFunc::create(a1, sub_14003BE70);
v70 = cocos2d::CCSequence::create(v63, v65, v68, v69);
cocos2d::CCNode::runAction((CCLightFlash *)a1->m_mainNode, (cocos2d::CCPoint)v70, v71, v2, 0.0);
m_delegate = a1->m_delegate;
if ( m_delegate )
m_delegate->currencyWillExit(m_delegate, a1);
}
}