//
// RewardUnlockLayer::playRewardEffect from 0x938d28 to 0x93a1d0 (5288 bytes)
//
// 3 xrefs:
// > RewardUnlockLayer::showCollectReward @ 0x93a2e8
// > RewardUnlockLayer::step3 @ 0x93a42c
// > ??> @ 0xb8e90
//
// 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 RewardUnlockLayer::playRewardEffect(RewardUnlockLayer *a1)
{
GJRewardType m_rewardType; // w0
GJRewardItem *m_rewardItem; // x0
cocos2d::CCArray *m_rewardObjects; // x19
_BOOL4 v5; // w23
unsigned int v6; // w22
int v7; // w27
int v8; // w21
__int64 v9; // x20
int v10; // w24
FMODAudioEngine *v11; // x20
cocos2d::CCPoint v12; // x2
void *v13; // x0
const cocos2d::CCPoint *v14; // x0
float v15; // s2
float v16; // s3
CurrencyRewardLayer *v17; // x22
FMODAudioEngine *v18; // x20
void *v19; // x0
unsigned int v20; // w20
const cocos2d::CCPoint *v21; // x0
float v22; // s2
float v23; // s3
_DWORD *v24; // x0
cocos2d::CCDirector *v25; // x0
unsigned __int64 v26; // x0
_BOOL4 v27; // w22
_BOOL4 v28; // w24
cocos2d::CCArray *v29; // x21
unsigned int v30; // w20
__int64 v31; // x1
__int64 v32; // x19
__int64 v33; // x19
__int64 v34; // x19
int v35; // w20
float v36; // s0
float v37; // s1
float v38; // s0
float v39; // s1
float v40; // s0
float v41; // s1
float v42; // s0
float v43; // s1
float v44; // s0
float v45; // s1
float v46; // s0
float v47; // s1
float v48; // s0
float v49; // s1
signed int v50; // w26
unsigned int v51; // w24
float v52; // s11
int v53; // w27
float v54; // s0
float v55; // s1
GJItemIcon *v56; // x21
const cocos2d::CCPoint *v57; // x0
float v58; // s2
__int64 v59; // x23
float v60; // s2
int v61; // w1
RewardUnlockLayer *v62; // x0
cocos2d::CCSequence *v63; // x19
cocos2d::CCFiniteTimeAction *v64; // x0
cocos2d::CCAction *v65; // x0
__int64 v66; // x19
__int64 v67; // x0
float v68; // s2
float v69; // s2
float v70; // s2
const cocos2d::CCPoint *v71; // x0
GJRewardItem *v72; // x0
int v73; // w23
float v74; // s8
cocos2d::CCArray *v75; // x21
int v76; // w20
int v77; // w0
cocos2d::CCMoveTo *v78; // x0
cocos2d::CCDelayTime *v79; // x0
cocos2d::CCMoveTo *v80; // x0
cocos2d::CCSequence *v81; // x0
int v82; // w0
cocos2d::CCLightning *v83; // x19
void (__fastcall *setColor)(cocos2d::CCLightning *__hidden, const cocos2d::ccColor3B *); // x3
cocos2d::CCLayer *m_mainLayer; // x2
cocos2d::CCLayer_vtbl *v86; // x4
float v87; // s0
float v88; // s1
float v89; // s0
float v90; // s1
float v91; // s0
float v92; // s1
FMODAudioEngine *v93; // x20
void *v94; // x0
cocos2d::CCPoint v95; // x1
unsigned int *v96; // x1
int v97; // w2
FMODAudioEngine *v98; // x20
void *v99; // x0
unsigned int *v100; // x1
FMODAudioEngine *v101; // x20
void *v102; // x0
unsigned int *v103; // x3
int v104; // w1
FMODAudioEngine *v105; // x19
cocos2d::CCPoint v106; // x2
void *v107; // x0
unsigned int *v108; // x2
int v109; // w1
FMODAudioEngine *v110; // x19
unsigned int *v111; // x2
float v112; // s0
float v113; // s1
FMODAudioEngine *v114; // x20
void *v115; // x0
unsigned int *v116; // x3
FMODAudioEngine *v117; // x19
MusicDownloadManager *v118; // x0
int v119; // w0
unsigned int *v120; // x3
unsigned int *v121; // x1
int v122; // w2
unsigned int *v123; // x3
unsigned int *v124; // x2
int v125; // w1
unsigned int *v126; // x1
int v127; // w2
unsigned int *v128; // x3
int v129; // w2
unsigned int *v130; // x3
int v131; // w1
int v132; // [xsp+D8h] [xbp+98h]
unsigned int v133; // [xsp+DCh] [xbp+9Ch]
GJItemIcon *v134; // [xsp+F0h] [xbp+B0h]
int v135; // [xsp+110h] [xbp+D0h]
cocos2d::CCArray *v136; // [xsp+110h] [xbp+D0h]
FMODAudioEngine *v137; // [xsp+110h] [xbp+D0h]
FMODAudioEngine *v138; // [xsp+110h] [xbp+D0h]
FMODAudioEngine *v139; // [xsp+110h] [xbp+D0h]
FMODAudioEngine *v140; // [xsp+110h] [xbp+D0h]
unsigned int v141; // [xsp+118h] [xbp+D8h]
CurrencySpriteType v142; // [xsp+120h] [xbp+E0h]
int v143; // [xsp+124h] [xbp+E4h]
CurrencySpriteType v144; // [xsp+128h] [xbp+E8h]
int RewardCount; // [xsp+12Ch] [xbp+ECh]
int v146; // [xsp+130h] [xbp+F0h]
float v147; // [xsp+130h] [xbp+F0h]
cocos2d::ccColor3B v148; // [xsp+148h] [xbp+108h]
cocos2d::ccColor3B v149; // [xsp+150h] [xbp+110h]
float v150; // [xsp+158h] [xbp+118h]
float v151; // [xsp+15Ch] [xbp+11Ch]
cocos2d::CCPoint v152; // [xsp+160h] [xbp+120h] BYREF
cocos2d::CCPoint v153; // [xsp+168h] [xbp+128h] BYREF
cocos2d::CCPoint v154; // [xsp+170h] [xbp+130h] BYREF
cocos2d::CCPoint v155; // [xsp+178h] [xbp+138h] BYREF
cocos2d::CCPoint v156; // [xsp+180h] [xbp+140h] BYREF
cocos2d::CCPoint v157; // [xsp+188h] [xbp+148h] BYREF
cocos2d::CCPoint v158; // [xsp+190h] [xbp+150h] BYREF
cocos2d::CCPoint v159; // [xsp+198h] [xbp+158h] BYREF
cocos2d::CCPoint v160; // [xsp+1A0h] [xbp+160h] BYREF
cocos2d::CCPoint v161; // [xsp+1A8h] [xbp+168h] BYREF
cocos2d::CCPoint v162; // [xsp+1B0h] [xbp+170h] BYREF
cocos2d::CCPoint v163; // [xsp+1B8h] [xbp+178h] BYREF
cocos2d::CCPoint v164; // [xsp+1C0h] [xbp+180h] BYREF
cocos2d::CCPoint v165; // 0:s0.4,4:s1.4
cocos2d::CCPoint v166; // 0:s0.4,4:s1.4
cocos2d::CCPoint v167; // 0:s0.4,4:s1.4
cocos2d::CCPoint v168; // 0:s0.4,4:s1.4
cocos2d::CCPoint v169; // 0:s0.4,4:s1.4
cocos2d::CCPoint v170; // 0:s0.4,4:s1.4
cocos2d::CCPoint v171; // 0:s0.4,4:s1.4
m_rewardType = a1->m_rewardItem->m_rewardType;
switch ( m_rewardType )
{
case Key50Treasure:
v105 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v164, "chest07.ogg");
FMODAudioEngine::playEffect((__int64)v105, (__int64)&v164);
v106 = v164;
v107 = (void *)(*(_QWORD *)&v164 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v164 - 24LL) == &qword_124B6B0 )
goto LABEL_4;
if ( !&pthread_create )
goto LABEL_137;
v108 = (unsigned int *)(*(_QWORD *)&v164 - 8LL);
do
v109 = __ldaxr(v108);
while ( __stlxr(v109 - 1, v108) );
break;
case Key100Treasure:
v110 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v164, "chest08.ogg");
FMODAudioEngine::playEffect((__int64)v110, (__int64)&v164);
v106 = v164;
v107 = (void *)(*(_QWORD *)&v164 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v164 - 24LL) == &qword_124B6B0 )
goto LABEL_4;
if ( !&pthread_create )
goto LABEL_137;
v111 = (unsigned int *)(*(_QWORD *)&v164 - 8LL);
do
v109 = __ldaxr(v111);
while ( __stlxr(v109 - 1, v111) );
break;
case Gold:
v117 = FMODAudioEngine::sharedEngine();
v118 = MusicDownloadManager::sharedState();
MusicDownloadManager::pathForSFX((__int64 *)&v164, v118, 0x24FEu);
v119 = rand();
FMODAudioEngine::playEffectAdvanced(
(__int64)v117,
(const void **)&v164,
0,
0,
120,
0,
0,
0,
(float)((float)((float)v119 * 4.6566e-10) * 0.2) + 0.9,
0.0,
0.7,
0.0,
0.0,
0,
0,
0,
0,
0,
0,
0);
v106 = v164;
v107 = (void *)(*(_QWORD *)&v164 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v164 - 24LL) == &qword_124B6B0 )
goto LABEL_4;
v120 = (unsigned int *)(*(_QWORD *)&v164 - 8LL);
if ( &pthread_create )
{
do
v109 = __ldaxr(v120);
while ( __stlxr(v109 - 1, v120) );
break;
}
LABEL_137:
v109 = *(_DWORD *)(*(_QWORD *)&v106 - 8LL);
*(_DWORD *)(*(_QWORD *)&v106 - 8LL) = v109 - 1;
break;
default:
goto LABEL_4;
}
if ( v109 <= 0 )
operator delete(v107);
LABEL_4:
GJChestSprite::switchToState(a1->m_chestSprite, Opened, 0);
m_rewardItem = a1->m_rewardItem;
m_rewardObjects = m_rewardItem->m_rewardObjects;
RewardCount = GJRewardItem::getRewardCount(m_rewardItem, BonusKey|FireShard);
v143 = GJRewardItem::getRewardCount(a1->m_rewardItem, Diamonds);
v5 = GJRewardItem::getRewardCount(a1->m_rewardItem, CustomItem) > 0;
if ( m_rewardObjects )
{
v6 = 0;
v7 = 0;
v8 = 0;
if ( !(unsigned int)cocos2d::CCArray::count(m_rewardObjects) )
{
LABEL_10:
v10 = v8;
v146 = 0;
v133 = 0;
v141 = 0;
goto LABEL_11;
}
while ( 1 )
{
v9 = cocos2d::CCArray::objectAtIndex(m_rewardObjects, v6);
if ( GJRewardObject::isSpecialType((GJRewardObject *)v9) )
{
if ( v8 )
{
v10 = v8;
v141 = *(_DWORD *)(v9 + 56);
v133 = *(_DWORD *)(v9 + 68);
v146 = v141;
goto LABEL_11;
}
v8 = *(_DWORD *)(v9 + 56);
v7 = *(_DWORD *)(v9 + 68);
}
if ( ++v6 >= (unsigned int)cocos2d::CCArray::count(m_rewardObjects) )
goto LABEL_10;
}
}
v146 = 0;
v10 = 0;
v133 = 0;
v7 = 0;
v141 = 0;
v8 = 0;
LABEL_11:
v144 = CurrencySprite::rewardToSpriteType(v10);
v142 = CurrencySprite::rewardToSpriteType(v146);
if ( !v5 )
{
if ( v142 == 16 || v144 == 16 )
{
v93 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v164, "gold01.ogg");
FMODAudioEngine::playEffect((__int64)v93, (__int64)&v164);
v94 = (void *)(*(_QWORD *)&v164 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v164 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v121 = (unsigned int *)(*(_QWORD *)&v164 - 8LL);
do
v122 = __ldaxr(v121);
while ( __stlxr(v122 - 1, v121) );
}
else
{
v122 = *(_DWORD *)(*(_QWORD *)&v164 - 8LL);
*(_DWORD *)(*(_QWORD *)&v164 - 8LL) = v122 - 1;
}
if ( v122 <= 0 )
operator delete(v94);
}
v137 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v164, "goldKey.ogg");
FMODAudioEngine::playEffect((__int64)v137, (__int64)&v164);
v95 = v164;
v13 = (void *)(*(_QWORD *)&v164 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v164 - 24LL) == &qword_124B6B0 )
goto LABEL_19;
if ( !&pthread_create )
goto LABEL_136;
v96 = (unsigned int *)(*(_QWORD *)&v164 - 8LL);
do
v97 = __ldaxr(v96);
while ( __stlxr(v97 - 1, v96) );
}
else
{
if ( v142 != DemonKey && v144 != DemonKey )
{
if ( v144 == Icon )
{
if ( v143 <= 0 )
{
if ( RewardCount <= 0 )
goto LABEL_19;
v101 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v164, "gold01.ogg");
FMODAudioEngine::playEffect((__int64)v101, (__int64)&v164);
v102 = (void *)(*(_QWORD *)&v164 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v164 - 24LL) != &qword_124B6B0 )
{
v130 = (unsigned int *)(*(_QWORD *)&v164 - 8LL);
if ( &pthread_create )
{
do
v131 = __ldaxr(v130);
while ( __stlxr(v131 - 1, v130) );
}
else
{
v131 = *(_DWORD *)(*(_QWORD *)&v164 - 8LL);
*(_DWORD *)(*(_QWORD *)&v164 - 8LL) = v131 - 1;
}
if ( v131 <= 0 )
operator delete(v102);
}
v139 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v164, "magicExplosion.ogg");
FMODAudioEngine::playEffect((__int64)v139, (__int64)&v164);
v12 = v164;
v13 = (void *)(*(_QWORD *)&v164 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v164 - 24LL) == &qword_124B6B0 )
goto LABEL_19;
v103 = (unsigned int *)(*(_QWORD *)&v164 - 8LL);
if ( &pthread_create )
{
do
v104 = __ldaxr(v103);
while ( __stlxr(v104 - 1, v103) );
LABEL_93:
if ( v104 > 0 )
goto LABEL_19;
goto LABEL_94;
}
}
else
{
v11 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v164, "gold02.ogg");
FMODAudioEngine::playEffect((__int64)v11, (__int64)&v164);
v12 = v164;
v13 = (void *)(*(_QWORD *)&v164 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v164 - 24LL) == &qword_124B6B0 )
{
LABEL_19:
v14 = a1->m_chestSprite->getPosition(a1->m_chestSprite);
cocos2d::CCPoint::CCPoint(&v164, v14);
v165.x = a1->m_unkFloat;
v165.y = 1.0;
v17 = CurrencyRewardLayer::create(
RewardCount,
0,
0,
v143,
v144,
v7,
v142,
v133,
v165,
(CurrencyRewardType)&v164,
v15,
v16);
goto LABEL_26;
}
v123 = (unsigned int *)(*(_QWORD *)&v164 - 8LL);
if ( &pthread_create )
{
do
v104 = __ldaxr(v123);
while ( __stlxr(v104 - 1, v123) );
goto LABEL_93;
}
}
v104 = *(_DWORD *)(*(_QWORD *)&v12 - 8LL);
*(_DWORD *)(*(_QWORD *)&v12 - 8LL) = v104 - 1;
goto LABEL_93;
}
v114 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v164, "magicExplosion.ogg");
FMODAudioEngine::playEffect((__int64)v114, (__int64)&v164);
v115 = (void *)(*(_QWORD *)&v164 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v164 - 24LL) != &qword_124B6B0 )
{
v128 = (unsigned int *)(*(_QWORD *)&v164 - 8LL);
if ( &pthread_create )
{
do
v129 = __ldaxr(v128);
while ( __stlxr(v129 - 1, v128) );
}
else
{
v129 = *(_DWORD *)(*(_QWORD *)&v164 - 8LL);
*(_DWORD *)(*(_QWORD *)&v164 - 8LL) = v129 - 1;
}
if ( v129 <= 0 )
operator delete(v115);
}
v140 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v164, "crystal01.ogg");
FMODAudioEngine::playEffect((__int64)v140, (__int64)&v164);
v95 = v164;
v13 = (void *)(*(_QWORD *)&v164 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v164 - 24LL) == &qword_124B6B0 )
goto LABEL_19;
v116 = (unsigned int *)(*(_QWORD *)&v164 - 8LL);
if ( &pthread_create )
{
do
v97 = __ldaxr(v116);
while ( __stlxr(v97 - 1, v116) );
goto LABEL_80;
}
LABEL_136:
v97 = *(_DWORD *)(*(_QWORD *)&v95 - 8LL);
*(_DWORD *)(*(_QWORD *)&v95 - 8LL) = v97 - 1;
goto LABEL_80;
}
v98 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v164, "gold01.ogg");
FMODAudioEngine::playEffect((__int64)v98, (__int64)&v164);
v99 = (void *)(*(_QWORD *)&v164 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v164 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v126 = (unsigned int *)(*(_QWORD *)&v164 - 8LL);
do
v127 = __ldaxr(v126);
while ( __stlxr(v127 - 1, v126) );
}
else
{
v127 = *(_DWORD *)(*(_QWORD *)&v164 - 8LL);
*(_DWORD *)(*(_QWORD *)&v164 - 8LL) = v127 - 1;
}
if ( v127 <= 0 )
operator delete(v99);
}
v138 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v164, "secretKey.ogg");
FMODAudioEngine::playEffect((__int64)v138, (__int64)&v164);
v95 = v164;
v13 = (void *)(*(_QWORD *)&v164 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v164 - 24LL) == &qword_124B6B0 )
goto LABEL_19;
if ( !&pthread_create )
goto LABEL_136;
v100 = (unsigned int *)(*(_QWORD *)&v164 - 8LL);
do
v97 = __ldaxr(v100);
while ( __stlxr(v97 - 1, v100) );
}
LABEL_80:
if ( v97 > 0 )
goto LABEL_19;
LABEL_94:
operator delete(v13);
goto LABEL_19;
}
v18 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v164, "reward01.ogg");
FMODAudioEngine::playEffect((__int64)v18, (__int64)&v164);
v19 = (void *)(*(_QWORD *)&v164 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v164 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v124 = (unsigned int *)(*(_QWORD *)&v164 - 8LL);
do
v125 = __ldaxr(v124);
while ( __stlxr(v125 - 1, v124) );
}
else
{
v125 = *(_DWORD *)(*(_QWORD *)&v164 - 8LL);
*(_DWORD *)(*(_QWORD *)&v164 - 8LL) = v125 - 1;
}
if ( v125 <= 0 )
operator delete(v19);
}
v20 = 0;
v21 = a1->m_chestSprite->getPosition(a1->m_chestSprite);
cocos2d::CCPoint::CCPoint(&v164, v21);
v166.x = a1->m_unkFloat;
v166.y = 1.0;
v17 = CurrencyRewardLayer::create(
RewardCount,
0,
0,
v143,
v144,
v7,
v142,
v133,
v166,
(CurrencyRewardType)&v164,
v22,
v23);
v135 = v8;
if ( (unsigned int)cocos2d::CCArray::count(m_rewardObjects) )
{
do
{
v24 = (_DWORD *)cocos2d::CCArray::objectAtIndex(m_rewardObjects, v20);
if ( v24[14] == 9 )
{
*(_WORD *)&v148.r = -20561;
v148.b = -81;
++v20;
v56 = GJItemIcon::create(
(UnlockType)v24[15],
v24[16],
v148,
(cocos2d::ccColor3B)&unk_FFFFFF,
0,
0,
1,
(cocos2d::ccColor3B)&unk_FFFFFF);
v57 = a1->m_chestSprite->getPosition(a1->m_chestSprite);
cocos2d::CCPoint::CCPoint(&v164, v57);
v167.x = 0.4;
CurrencyRewardLayer::createUnlockObject(v17, v56, v167, v58);
}
else
{
++v20;
}
}
while ( v20 < (unsigned int)cocos2d::CCArray::count(m_rewardObjects) );
}
v8 = v135;
LABEL_26:
a1->addChild_0(a1, v17, 100);
v17->m_delegate = &a1->CurrencyRewardDelegate;
v25 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v25);
v26 = (unsigned int)v146;
v27 = v10 > 0;
v28 = v146 > 0;
if ( v146 > 0 && v27 )
{
v26 = v141;
v28 = 1;
if ( v8 == v141 )
{
v26 = v133;
v28 = 0;
v7 += v133;
}
}
v29 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)v26);
v136 = (cocos2d::CCArray *)cocos2d::CCArray::create(v29);
if ( v5 )
{
v30 = 0;
while ( v30 < (unsigned int)cocos2d::CCArray::count(m_rewardObjects) )
{
v31 = cocos2d::CCArray::objectAtIndex(m_rewardObjects, v30);
if ( *(_DWORD *)(v31 + 56) == 9 )
{
cocos2d::CCArray::addObject(v136, (cocos2d::CCObject *)v31);
v59 = operator new(0x40u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v59);
*(_DWORD *)(v59 + 56) = 0;
++v30;
*(_QWORD *)v59 = &off_1148430;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v59);
cocos2d::CCArray::addObject(v29, (cocos2d::CCObject *)v59);
}
else
{
++v30;
}
}
}
if ( RewardCount > 0 )
{
v32 = operator new(0x40u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v32);
*(_DWORD *)(v32 + 56) = 1;
*(_QWORD *)v32 = &off_1148430;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v32);
cocos2d::CCArray::addObject(v29, (cocos2d::CCObject *)v32);
}
if ( v143 > 0 )
{
v33 = operator new(0x40u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v33);
*(_DWORD *)(v33 + 56) = 3;
*(_QWORD *)v33 = &off_1148430;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v33);
cocos2d::CCArray::addObject(v29, (cocos2d::CCObject *)v33);
}
if ( v27 )
{
v66 = operator new(0x40u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v66);
*(_DWORD *)(v66 + 56) = 9998;
*(_QWORD *)v66 = &off_1148430;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v66);
cocos2d::CCArray::addObject(v29, (cocos2d::CCObject *)v66);
}
if ( v28 )
{
v34 = operator new(0x40u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v34);
*(_DWORD *)(v34 + 56) = 9999;
*(_QWORD *)v34 = &off_1148430;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v34);
cocos2d::CCArray::addObject(v29, (cocos2d::CCObject *)v34);
}
v35 = cocos2d::CCArray::count(v29);
cocos2d::CCPoint::CCPoint(&v152);
cocos2d::CCPoint::CCPoint(&v153);
cocos2d::CCPoint::CCPoint(&v154);
cocos2d::CCPoint::CCPoint(&v155);
cocos2d::CCPoint::CCPoint(&v156);
cocos2d::CCPoint::CCPoint(&v157);
cocos2d::CCPoint::CCPoint(&v158, v150 * 0.5, (float)(v151 * 0.5) + 68.0);
switch ( v35 )
{
case 1:
cocos2d::CCPoint::operator=(&v152, v36, v37);
goto LABEL_47;
case 2:
v158.x = v158.x - 45.0;
cocos2d::CCPoint::operator=(&v152, v158.x, 45.0);
cocos2d::CCPoint::CCPoint(&v163, 90.0, 0.0);
cocos2d::CCPoint::operator+(&v164, &v158, &v163);
cocos2d::CCPoint::operator=(&v153, v112, v113);
goto LABEL_47;
case 3:
v158.x = v158.x - 75.0;
cocos2d::CCPoint::CCPoint(&v163, 0.0, -10.0);
cocos2d::CCPoint::operator+(&v164, &v158, &v163);
cocos2d::CCPoint::operator=(&v152, v87, v88);
cocos2d::CCPoint::CCPoint(&v163, 75.0, 10.0);
cocos2d::CCPoint::operator+(&v164, &v158, &v163);
cocos2d::CCPoint::operator=(&v153, v89, v90);
cocos2d::CCPoint::CCPoint(&v163, 150.0, -10.0);
cocos2d::CCPoint::operator+(&v164, &v158, &v163);
cocos2d::CCPoint::operator=(&v154, v91, v92);
goto LABEL_47;
}
v158.y = v158.y - 5.0;
v158.x = v158.x - 109.5;
cocos2d::CCPoint::CCPoint(&v163, 0.0, -15.0);
cocos2d::CCPoint::operator+(&v164, &v158, &v163);
cocos2d::CCPoint::operator=(&v152, v38, v39);
cocos2d::CCPoint::CCPoint(&v163, 73.0, 15.0);
cocos2d::CCPoint::operator+(&v164, &v158, &v163);
cocos2d::CCPoint::operator=(&v153, v40, v41);
cocos2d::CCPoint::CCPoint(&v163, 146.0, 15.0);
cocos2d::CCPoint::operator+(&v164, &v158, &v163);
cocos2d::CCPoint::operator=(&v154, v42, v43);
cocos2d::CCPoint::CCPoint(&v163, 219.0, -15.0);
cocos2d::CCPoint::operator+(&v164, &v158, &v163);
cocos2d::CCPoint::operator=(&v155, v44, v45);
cocos2d::CCPoint::CCPoint(&v163, 219.0, -70.0);
cocos2d::CCPoint::operator+(&v164, &v158, &v163);
cocos2d::CCPoint::operator=(&v156, v46, v47);
cocos2d::CCPoint::CCPoint(&v163, 0.0, -70.0);
cocos2d::CCPoint::operator+(&v164, &v158, &v163);
cocos2d::CCPoint::operator=(&v157, v48, v49);
if ( v35 > 0 )
{
LABEL_47:
v50 = 0;
v132 = v7;
v51 = 0;
while ( 1 )
{
v53 = *(_DWORD *)(cocos2d::CCArray::objectAtIndex(v29, v50) + 56);
cocos2d::CCPoint::CCPoint(&v163);
switch ( v50 )
{
case 3:
cocos2d::CCPoint::operator=(&v163, v54, v55);
v52 = (float)((float)v50 * 0.2) + 0.5;
if ( v53 != 1 )
goto LABEL_49;
goto LABEL_58;
default:
cocos2d::CCPoint::operator=(&v163, v54, v55);
v52 = (float)((float)v50 * 0.2) + 0.5;
if ( v53 == 1 )
{
LABEL_58:
cocos2d::CCPoint::CCPoint(&v164, &v163);
v61 = RewardCount;
v62 = a1;
LABEL_59:
v168.x = v52;
++v50;
RewardUnlockLayer::playLabelEffect(v62, v61, v53, nullptr, v168, v60);
if ( v35 <= v50 )
goto LABEL_60;
}
else
{
LABEL_49:
switch ( v53 )
{
case 3:
cocos2d::CCPoint::CCPoint(&v164, &v163);
v62 = a1;
v61 = v143;
goto LABEL_59;
case 9998:
cocos2d::CCPoint::CCPoint(&v164, &v163);
v170.x = v52;
RewardUnlockLayer::playLabelEffect(a1, v132, v144, nullptr, v170, v69);
break;
case 9999:
cocos2d::CCPoint::CCPoint(&v164, &v163);
v171.x = v52;
RewardUnlockLayer::playLabelEffect(a1, v133, v142, nullptr, v171, v70);
break;
case 0:
v67 = cocos2d::CCArray::objectAtIndex(v136, v51);
*(_WORD *)&v149.r = -20561;
v149.b = -81;
v134 = GJItemIcon::create(
(UnlockType)*(_DWORD *)(v67 + 60),
*(_DWORD *)(v67 + 64),
v149,
(cocos2d::ccColor3B)&unk_FFFFFF,
0,
0,
1,
(cocos2d::ccColor3B)&unk_FFFFFF);
cocos2d::CCPoint::CCPoint(&v164, &v163);
v169.x = v52;
if ( v35 <= 1 )
v169.x = 2.2;
++v51;
RewardUnlockLayer::playLabelEffect(a1, 1, 0, v134, v169, v68);
break;
}
if ( v35 <= ++v50 )
goto LABEL_60;
}
break;
}
}
}
LABEL_60:
if ( a1->m_rewardItem->m_rewardType > Key10Treasure )
{
v71 = a1->m_mainLayer->getPosition(a1->m_mainLayer);
cocos2d::CCPoint::CCPoint(&v159, v71);
v72 = a1->m_rewardItem;
v73 = v72->m_rewardType;
v74 = (float)((float)v73 * 0.1) + 3.0;
v75 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)v72);
if ( v73 > 0 )
{
v76 = 0;
do
{
++v76;
v147 = (float)((float)((float)((float)rand() * 4.6566e-10) * 2.0) + -1.0) * v74;
v77 = rand();
cocos2d::CCPoint::CCPoint(&v163, v147, (float)((float)((float)((float)v77 * 4.6566e-10) * 2.0) + -1.0) * v74);
cocos2d::CCPoint::operator+(&v164, &v159, &v163);
v78 = cocos2d::CCMoveTo::create(0.0, &v164);
cocos2d::CCArray::addObject(v75, v78);
v79 = cocos2d::CCDelayTime::create(0.03);
cocos2d::CCArray::addObject(v75, v79);
}
while ( v73 != v76 );
}
v80 = cocos2d::CCMoveTo::create(0.0, &v159);
cocos2d::CCArray::addObject(v75, v80);
v81 = cocos2d::CCSequence::create(v75);
cocos2d::CCNode::runAction(a1->m_mainLayer, v81);
if ( a1->m_rewardItem->m_rewardType == Key100Treasure )
{
v82 = rand();
cocos2d::CCPoint::CCPoint(
&v160,
(float)((float)((float)((float)((float)v82 * 4.6566e-10) * 2.0) + -1.0) * 50.0) + (float)(v150 * 0.5),
v151 + 5.0);
cocos2d::CCPoint::CCPoint(&v161, v150 * 0.5, v151 * 0.5);
cocos2d::CCPoint::operator-(&v162, &v161, &v160);
cocos2d::CCPoint::CCPoint(&v163, &v162);
cocos2d::CCPoint::CCPoint(&v164, &stru_12434F8);
v83 = cocos2d::CCLightning::lightningWithStrikePoint(&v163, &v164, 0.5);
v83->setPosition(v83, &v160);
setColor = v83->setColor;
LOBYTE(v164.x) = -1;
*(_WORD *)((char *)&v164.x + 1) = -256;
setColor(v83, (const cocos2d::ccColor3B *)&v164);
m_mainLayer = a1->m_mainLayer;
v83->m_unkBool = 1;
v86 = m_mainLayer->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v83->m_removeAfterFinished = 1;
v83->m_lineWidth = 5.0;
v86->addChild_0(m_mainLayer, v83, 3);
}
}
v63 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(1.5);
v64 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, RewardUnlockLayer::showCloseButton, 0);
v65 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v63, v64, 0);
cocos2d::CCNode::runAction(a1, v65);
}