//
// DailyLevelNode::onClaimReward from 0x915804 to 0x915994 (400 bytes)
//
// 3 xrefs:
// > ??> @ 0xbeb48
// > DailyLevelNode::init @ 0x914138
// > ??> @ 0x122e9d0
//
// 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 DailyLevelNode::onClaimReward(DailyLevelNode *a1, cocos2d::CCObject *a2)
{
DailyLevelNode_vtbl *v4; // x1
DailyLevelPage *m_page; // x23
__int64 v6; // x0
FMODAudioEngine *v7; // x20
void *v8; // x0
unsigned int *v9; // x2
int v10; // w1
GJGameLevel *m_level; // [xsp+48h] [xbp+48h]
__int64 v12; // [xsp+60h] [xbp+60h] BYREF
cocos2d::CCPoint v13; // 0:s0.4,4:s1.4
if ( !a1->m_unkBool )
{
v4 = a1->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_unkBool = 1;
m_level = a1->m_level;
m_page = a1->m_page;
v6 = ((__int64 (*)(void))v4->getPosition)();
cocos2d::CCPoint::operator+(&v12, v6, &a1->m_unkPoint);
DailyLevelPage::claimLevelReward(m_page, a1, m_level, v13);
if ( a1->m_page->m_type != 1 )
{
v7 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v12, "gold02.ogg");
FMODAudioEngine::playEffect((__int64)v7, (__int64)&v12);
v8 = (void *)(v12 - 24);
if ( (__int64 *)(v12 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v12 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(v12 - 8);
*(_DWORD *)(v12 - 8) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v8);
}
}
((void (__fastcall *)(cocos2d::CCObject *, _QWORD))a2->__vftable[4].~CCObject)(a2, 0);
a2->__vftable[13].copyWithZone(a2, nullptr);
}
}