// // RewardUnlockLayer::playRewardEffect from 0x4e912c to 0x4e9c22 (2806 bytes) // // 2 xrefs: // > RewardUnlockLayer::showCollectReward @ 0x4e9c9c // > RewardUnlockLayer::step3 @ 0x4e9d70 // // 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; // r2 FMODAudioEngine *v3; // r6 int v4; // r2 int v5; // r3 FMODAudioEngine *v6; // r6 int v7; // r2 int v8; // r3 FMODAudioEngine *v9; // r6 MusicDownloadManager *v10; // r0 unsigned int v11; // r0 GJRewardItem *m_rewardItem; // r0 cocos2d::CCArray *m_rewardObjects; // r5 int v14; // r7 int v15; // r6 unsigned int v16; // r7 int v17; // r8 CurrencySpriteType v18; // r0 _BOOL4 v19; // r9 FMODAudioEngine *v20; // r10 int v21; // r2 int v22; // r3 FMODAudioEngine *v23; // r10 int v24; // r2 int v25; // r3 FMODAudioEngine *v26; // r10 int v27; // r2 int v28; // r3 FMODAudioEngine *v29; // r10 int v30; // r2 int v31; // r3 FMODAudioEngine *v32; // r10 int v33; // r2 int v34; // r3 FMODAudioEngine *v35; // r10 int v36; // r2 int v37; // r3 FMODAudioEngine *v38; // r10 int v39; // r2 int v40; // r3 FMODAudioEngine *v41; // r10 int v42; // r2 int v43; // r3 FMODAudioEngine *v44; // r10 int v45; // r2 int v46; // r3 FMODAudioEngine *v47; // r10 int v48; // r2 int v49; // r3 const cocos2d::CCPoint *v50; // r0 CurrencyRewardLayer *v51; // r10 cocos2d::CCDirector *v52; // r0 cocos2d::CCSize *WinSize; // r0 _BOOL4 v54; // r9 _BOOL4 v55; // r8 unsigned int i; // r8 int v57; // r0 const cocos2d::CCPoint *v58; // r0 cocos2d::CCArray *v59; // r11 int v60; // r1 cocos2d::CCObject *v61; // r0 unsigned int j; // r6 cocos2d::CCObject *v63; // r1 int v64; // r1 cocos2d::CCObject *v65; // r0 cocos2d::CCObject *v66; // r0 cocos2d::CCObject *v67; // r0 cocos2d::CCObject *v68; // r0 int v69; // r10 int v70; // r2 bool v71; // r3 cocos2d::CCPoint *v72; // r0 cocos2d::CCPoint *v73; // r1 signed int v74; // r6 unsigned int v75; // r8 int v76; // r2 bool v77; // r3 int v78; // r2 bool v79; // r3 int v80; // r2 bool v81; // r3 int v82; // r2 bool v83; // r3 int v84; // r2 bool v85; // r3 int v86; // r2 bool v87; // r3 int v88; // r2 bool v89; // r3 cocos2d::CCPoint *v90; // r1 float v91; // s16 int v92; // r5 int v93; // r2 bool v94; // r3 int v95; // r0 GJRewardType v96; // r9 const cocos2d::CCPoint *v97; // r0 cocos2d::CCArray *v98; // r0 GJRewardType v99; // r10 cocos2d::CCArray *v100; // r6 int v101; // r0 float v102; // s16 int v103; // r0 cocos2d::CCMoveTo *v104; // r0 cocos2d::CCDelayTime *v105; // r0 cocos2d::CCMoveTo *v106; // r0 cocos2d::CCSequence *v107; // r0 float width; // s16 float v109; // s15 cocos2d::CCLightning *v110; // r6 void (__fastcall *setColor)(cocos2d::CCLightning *__hidden, const cocos2d::ccColor3B *); // r2 cocos2d::CCLayer *m_mainLayer; // r0 cocos2d::CCLayer_vtbl *v113; // r3 cocos2d::CCDelayTime *v114; // r0 cocos2d::CCSequence *v115; // r7 cocos2d::CCFiniteTimeAction *v116; // r0 cocos2d::CCAction *v117; // r0 float v118; // [sp+0h] [bp-F4h] cocos2d::CCPoint v119; // [sp+0h] [bp-F4h] cocos2d::CCPoint v120; // [sp+0h] [bp-F4h] cocos2d::CCPoint v121; // [sp+0h] [bp-F4h] cocos2d::CCPoint v122; // [sp+0h] [bp-F4h] float v123; // [sp+8h] [bp-ECh] float v124; // [sp+8h] [bp-ECh] cocos2d::ccColor3B v125; // [sp+Ch] [bp-E8h] cocos2d::ccColor3B v126; // [sp+Ch] [bp-E8h] cocos2d::CCPoint v127; // [sp+10h] [bp-E4h] float v128; // [sp+20h] [bp-D4h] int v129; // [sp+40h] [bp-B4h] int v130; // [sp+44h] [bp-B0h] CurrencySpriteType v131; // [sp+48h] [bp-ACh] int RewardCount; // [sp+4Ch] [bp-A8h] int v133; // [sp+50h] [bp-A4h] CurrencySpriteType v134; // [sp+54h] [bp-A0h] _BOOL4 v135; // [sp+58h] [bp-9Ch] cocos2d::CCArray *v136; // [sp+5Ch] [bp-98h] GJItemIcon *v137; // [sp+60h] [bp-94h] GJItemIcon *v138; // [sp+60h] [bp-94h] cocos2d::ccColor3B v139; // [sp+74h] [bp-80h] cocos2d::ccColor3B v140; // [sp+78h] [bp-7Ch] cocos2d::CCSize v141; // [sp+7Ch] [bp-78h] BYREF cocos2d::CCPoint v142; // [sp+84h] [bp-70h] BYREF cocos2d::CCPoint v143; // [sp+8Ch] [bp-68h] BYREF cocos2d::CCPoint v144; // [sp+94h] [bp-60h] BYREF cocos2d::CCPoint v145; // [sp+9Ch] [bp-58h] BYREF cocos2d::CCPoint v146; // [sp+A4h] [bp-50h] BYREF cocos2d::CCPoint v147; // [sp+ACh] [bp-48h] BYREF cocos2d::CCPoint v148; // [sp+B4h] [bp-40h] BYREF cocos2d::CCPoint v149; // [sp+BCh] [bp-38h] BYREF cocos2d::CCPoint v150; // [sp+C4h] [bp-30h] BYREF cocos2d::CCPoint v151; // [sp+CCh] [bp-28h] BYREF cocos2d::CCPoint v152; // [sp+D4h] [bp-20h] BYREF cocos2d::CCPoint v153; // [sp+DCh] [bp-18h] BYREF cocos2d::CCPoint v154; // [sp+E4h] [bp-10h] BYREF m_rewardType = a1->m_rewardItem->m_rewardType; switch ( m_rewardType ) { case Key50Treasure: v3 = FMODAudioEngine::sharedEngine(); sub_776584((int)&v154, "chest07.ogg"); FMODAudioEngine::playEffect(v3, (int)&v154, v4, v5); break; case Key100Treasure: v6 = FMODAudioEngine::sharedEngine(); sub_776584((int)&v154, "chest08.ogg"); FMODAudioEngine::playEffect(v6, (int)&v154, v7, v8); break; case Gold: v9 = FMODAudioEngine::sharedEngine(); v10 = MusicDownloadManager::sharedState(); MusicDownloadManager::pathForSFX((MusicDownloadManager *)&v154, v10, 9470); v11 = rand(); FMODAudioEngine::playEffectAdvanced( v9, (const void **)&v154, (float)(vcvts_n_f32_s32(v11, 0x1Fu) * 0.2) + 0.9, 0, 1060320051, 0.0, 0, 0, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0); break; default: goto LABEL_8; } sub_774008(&v154); LABEL_8: 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); v133 = GJRewardItem::getRewardCount(a1->m_rewardItem, Diamonds); v135 = GJRewardItem::getRewardCount(a1->m_rewardItem, CustomItem) > 0; if ( m_rewardObjects ) { v16 = 0; v129 = 0; v15 = 0; while ( v16 < cocos2d::CCArray::count(m_rewardObjects) ) { v17 = cocos2d::CCArray::objectAtIndex(m_rewardObjects, v16); if ( GJRewardObject::isSpecialType((GJRewardObject *)v17) ) { if ( v15 ) { v14 = *(_DWORD *)(v17 + 52); v130 = *(_DWORD *)(v17 + 64); goto LABEL_18; } v15 = *(_DWORD *)(v17 + 52); v129 = *(_DWORD *)(v17 + 64); } ++v16; } v130 = 0; v14 = 0; } else { v130 = 0; v14 = 0; v129 = 0; v15 = 0; } LABEL_18: v131 = CurrencySprite::rewardToSpriteType(v15); v18 = CurrencySprite::rewardToSpriteType(v14); v19 = a1->m_rewardItem->m_rewardType == SmallTreasure; v134 = v18; if ( v135 ) { v20 = FMODAudioEngine::sharedEngine(); sub_776584((int)&v154, "reward01.ogg"); FMODAudioEngine::playEffect(v20, (int)&v154, v21, v22); } else if ( v131 == 16 || v18 == 16 ) { v23 = FMODAudioEngine::sharedEngine(); sub_776584((int)&v154, "gold01.ogg"); FMODAudioEngine::playEffect(v23, (int)&v154, v24, v25); sub_774008(&v154); v26 = FMODAudioEngine::sharedEngine(); sub_776584((int)&v154, "goldKey.ogg"); FMODAudioEngine::playEffect(v26, (int)&v154, v27, v28); } else if ( v131 == DemonKey || v18 == DemonKey ) { v29 = FMODAudioEngine::sharedEngine(); sub_776584((int)&v154, "gold01.ogg"); FMODAudioEngine::playEffect(v29, (int)&v154, v30, v31); sub_774008(&v154); v32 = FMODAudioEngine::sharedEngine(); sub_776584((int)&v154, "secretKey.ogg"); FMODAudioEngine::playEffect(v32, (int)&v154, v33, v34); } else if ( v131 ) { v35 = FMODAudioEngine::sharedEngine(); sub_776584((int)&v154, "magicExplosion.ogg"); FMODAudioEngine::playEffect(v35, (int)&v154, v36, v37); sub_774008(&v154); v38 = FMODAudioEngine::sharedEngine(); sub_776584((int)&v154, "crystal01.ogg"); FMODAudioEngine::playEffect(v38, (int)&v154, v39, v40); } else if ( v133 <= 0 ) { if ( RewardCount <= 0 ) goto LABEL_33; v44 = FMODAudioEngine::sharedEngine(); sub_776584((int)&v154, "gold01.ogg"); FMODAudioEngine::playEffect(v44, (int)&v154, v45, v46); sub_774008(&v154); v47 = FMODAudioEngine::sharedEngine(); sub_776584((int)&v154, "magicExplosion.ogg"); FMODAudioEngine::playEffect(v47, (int)&v154, v48, v49); } else { v41 = FMODAudioEngine::sharedEngine(); sub_776584((int)&v154, "gold02.ogg"); FMODAudioEngine::playEffect(v41, (int)&v154, v42, v43); } sub_774008(&v154); LABEL_33: v50 = a1->m_chestSprite->getPosition(a1->m_chestSprite); cocos2d::CCPoint::CCPoint(&v154, v50); LODWORD(v127.x) = &v154; LODWORD(v127.y) = v19; v51 = CurrencyRewardLayer::create( RewardCount, 0, 0, v133, v131, v129, v134, v130, v127, SLODWORD(a1->m_unkFloat), 1.0, v128); if ( v135 ) { for ( i = 0; i < cocos2d::CCArray::count(m_rewardObjects); ++i ) { v57 = cocos2d::CCArray::objectAtIndex(m_rewardObjects, i); if ( *(_DWORD *)(v57 + 52) == 9 ) { *(_WORD *)&v139.r = -20561; v139.b = -81; v125.b = -1; *(_WORD *)&v125.r = -1; v137 = GJItemIcon::create( *(UnlockType *)(v57 + 56), *(_DWORD *)(v57 + 60), v139, (cocos2d::ccColor3B)-1, 0, 0, 1, v125); v58 = a1->m_chestSprite->getPosition(a1->m_chestSprite); cocos2d::CCPoint::CCPoint(&v154, v58); CurrencyRewardLayer::createUnlockObject( v51, v137, (cocos2d::CCPoint)((unsigned int)&v154 | 0x3ECCCCCD00000000LL), v118); } } } a1->addChild_0(a1, v51, 100); v51->m_delegate = &a1->CurrencyRewardDelegate; v52 = cocos2d::CCDirector::sharedDirector(); WinSize = cocos2d::CCDirector::getWinSize(&v141, v52); v54 = v15 > 0; v55 = v14 > 0; if ( v15 > 0 && v14 > 0 && v15 == v14 ) { v55 = 0; v129 += v130; } v59 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)WinSize); v136 = (cocos2d::CCArray *)cocos2d::CCArray::create(v59); if ( v135 ) { for ( j = 0; j < cocos2d::CCArray::count(m_rewardObjects); ++j ) { v63 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(m_rewardObjects, j); if ( v63[1].__vftable == (cocos2d::CCObject_vtbl *)byte_9 ) { cocos2d::CCArray::addObject(v136, v63); v65 = cocos2d::CCInteger::create(nullptr, v64); cocos2d::CCArray::addObject(v59, v65); } } } if ( RewardCount > 0 ) { v61 = cocos2d::CCInteger::create((cocos2d::CCInteger *)((char *)&dword_0 + 1), v60); cocos2d::CCArray::addObject(v59, v61); } if ( v133 > 0 ) { v66 = cocos2d::CCInteger::create((cocos2d::CCInteger *)((char *)&dword_0 + 3), v60); cocos2d::CCArray::addObject(v59, v66); } if ( v54 ) { v67 = cocos2d::CCInteger::create((cocos2d::CCInteger *)((char *)&stru_270C.st_name + 2), v60); cocos2d::CCArray::addObject(v59, v67); } if ( v55 ) { v68 = cocos2d::CCInteger::create((cocos2d::CCInteger *)((char *)&stru_270C.st_name + 3), v60); cocos2d::CCArray::addObject(v59, v68); } v69 = cocos2d::CCArray::count(v59); cocos2d::CCPoint::CCPoint(&v142); cocos2d::CCPoint::CCPoint(&v143); cocos2d::CCPoint::CCPoint(&v144); cocos2d::CCPoint::CCPoint(&v145); cocos2d::CCPoint::CCPoint(&v146); cocos2d::CCPoint::CCPoint(&v147); cocos2d::CCPoint::CCPoint(&v148, v141.width * 0.5, (float)(v141.height * 0.5) + 68.0); if ( v69 == 1 ) { v72 = &v142; v73 = &v148; } else { if ( v69 == 2 ) { v148.x = v148.x - 45.0; cocos2d::CCPoint::operator=((PlayerObject *)&v142, COERCE_FLOAT(&v148), v70, v71); cocos2d::CCPoint::CCPoint(&v153, 90.0, 0.0); cocos2d::CCPoint::operator+(&v154, &v148, &v153); v72 = &v143; } else if ( v69 == 3 ) { v148.x = v148.x - 75.0; cocos2d::CCPoint::CCPoint(&v153, 0.0, -10.0); cocos2d::CCPoint::operator+(&v154, &v148, &v153); cocos2d::CCPoint::operator=((PlayerObject *)&v142, COERCE_FLOAT(&v154), v76, v77); cocos2d::CCPoint::CCPoint(&v153, 75.0, 10.0); cocos2d::CCPoint::operator+(&v154, &v148, &v153); cocos2d::CCPoint::operator=((PlayerObject *)&v143, COERCE_FLOAT(&v154), v78, v79); cocos2d::CCPoint::CCPoint(&v153, 150.0, -10.0); cocos2d::CCPoint::operator+(&v154, &v148, &v153); v72 = &v144; } else { v148.y = v148.y - 5.0; v148.x = v148.x - 109.5; cocos2d::CCPoint::CCPoint(&v153, 0.0, -15.0); cocos2d::CCPoint::operator+(&v154, &v148, &v153); cocos2d::CCPoint::operator=((PlayerObject *)&v142, COERCE_FLOAT(&v154), v80, v81); cocos2d::CCPoint::CCPoint(&v153, 73.0, 15.0); cocos2d::CCPoint::operator+(&v154, &v148, &v153); cocos2d::CCPoint::operator=((PlayerObject *)&v143, COERCE_FLOAT(&v154), v82, v83); cocos2d::CCPoint::CCPoint(&v153, 146.0, 15.0); cocos2d::CCPoint::operator+(&v154, &v148, &v153); cocos2d::CCPoint::operator=((PlayerObject *)&v144, COERCE_FLOAT(&v154), v84, v85); cocos2d::CCPoint::CCPoint(&v153, 219.0, -15.0); cocos2d::CCPoint::operator+(&v154, &v148, &v153); cocos2d::CCPoint::operator=((PlayerObject *)&v145, COERCE_FLOAT(&v154), v86, v87); cocos2d::CCPoint::CCPoint(&v153, 219.0, -70.0); cocos2d::CCPoint::operator+(&v154, &v148, &v153); cocos2d::CCPoint::operator=((PlayerObject *)&v146, COERCE_FLOAT(&v154), v88, v89); cocos2d::CCPoint::CCPoint(&v153, 0.0, -70.0); cocos2d::CCPoint::operator+(&v154, &v148, &v153); v72 = &v147; } v73 = &v154; } v74 = 0; cocos2d::CCPoint::operator=((PlayerObject *)v72, *(float *)&v73, v70, v71); v75 = 0; while ( v74 < v69 ) { v92 = *(_DWORD *)(cocos2d::CCArray::objectAtIndex(v59, v74) + 52); cocos2d::CCPoint::CCPoint(&v153); switch ( v74 ) { case 0: v90 = &v142; break; case 1: v90 = &v143; break; case 2: v90 = &v144; break; case 3: v90 = &v145; break; case 4: v90 = &v146; break; default: v90 = &v147; break; } cocos2d::CCPoint::operator=((PlayerObject *)&v153, *(float *)&v90, v93, v94); v91 = (float)((float)v74 * 0.2) + 0.5; switch ( v92 ) { case 1: cocos2d::CCPoint::CCPoint(&v154, &v153); LODWORD(v119.x) = &v154; v119.y = (float)((float)v74 * 0.2) + 0.5; RewardUnlockLayer::playLabelEffect(a1, RewardCount, v92, nullptr, v119, v123); break; case 3: cocos2d::CCPoint::CCPoint(&v154, &v153); LODWORD(v120.x) = &v154; v120.y = (float)((float)v74 * 0.2) + 0.5; RewardUnlockLayer::playLabelEffect(a1, v133, v92, nullptr, v120, v123); break; case 9998: cocos2d::CCPoint::CCPoint(&v154, &v153); LODWORD(v121.x) = &v154; v121.y = (float)((float)v74 * 0.2) + 0.5; RewardUnlockLayer::playLabelEffect(a1, v129, v131, nullptr, v121, v123); break; case 9999: cocos2d::CCPoint::CCPoint(&v154, &v153); LODWORD(v122.x) = &v154; v122.y = (float)((float)v74 * 0.2) + 0.5; RewardUnlockLayer::playLabelEffect(a1, v130, v134, nullptr, v122, v123); break; case 0: v95 = cocos2d::CCArray::objectAtIndex(v136, v75); *(_WORD *)&v140.r = -20561; v140.b = -81; ++v75; *(_WORD *)&v126.r = -1; v126.b = -1; v138 = GJItemIcon::create( *(UnlockType *)(v95 + 56), *(_DWORD *)(v95 + 60), v140, (cocos2d::ccColor3B)0xFFFFFF, 0, 0, 1, v126); cocos2d::CCPoint::CCPoint(&v154, &v153); if ( v69 < 2 ) v91 = 2.2; RewardUnlockLayer::playLabelEffect(a1, 1, 0, v138, (cocos2d::CCPoint)__PAIR64__(LODWORD(v91), &v154), v124); break; } ++v74; } if ( a1->m_rewardItem->m_rewardType > Key10Treasure ) { v96 = 0; v97 = a1->m_mainLayer->getPosition(a1->m_mainLayer); v98 = (cocos2d::CCArray *)cocos2d::CCPoint::CCPoint(&v149, v97); v99 = a1->m_rewardItem->m_rewardType; v100 = (cocos2d::CCArray *)cocos2d::CCArray::create(v98); while ( v96 < v99 ) { v101 = rand(); ++v96; v102 = (float)((float)v101 * 4.6566e-10) + (float)((float)v101 * 4.6566e-10); v103 = rand(); cocos2d::CCPoint::CCPoint( &v153, (float)(v102 - 1.0) * (float)((float)((float)v99 * 0.1) + 3.0), (float)((float)((float)((float)v103 * 4.6566e-10) + (float)((float)v103 * 4.6566e-10)) - 1.0) * (float)((float)((float)v99 * 0.1) + 3.0)); cocos2d::CCPoint::operator+(&v154, &v149, &v153); v104 = cocos2d::CCMoveTo::create(0.0, &v154); cocos2d::CCArray::addObject(v100, v104); v105 = cocos2d::CCDelayTime::create(0.03); cocos2d::CCArray::addObject(v100, v105); } v106 = cocos2d::CCMoveTo::create(0.0, &v149); cocos2d::CCArray::addObject(v100, v106); v107 = cocos2d::CCSequence::create(v100); cocos2d::CCNode::runAction(a1->m_mainLayer, v107); if ( a1->m_rewardItem->m_rewardType == Key100Treasure ) { width = v141.width; v109 = vcvts_n_f32_s32(rand(), 0x1Fu); cocos2d::CCPoint::CCPoint( &v150, (float)(width * 0.5) + (float)((float)((float)(v109 + v109) - 1.0) * 50.0), v141.height + 5.0); cocos2d::CCPoint::CCPoint(&v151, v141.width * 0.5, v141.height * 0.5); cocos2d::CCPoint::operator-(&v152, &v151, &v150); cocos2d::CCPoint::CCPoint(&v153, &v152); cocos2d::CCPoint::CCPoint(&v154, &stru_AC6F90); v110 = cocos2d::CCLightning::lightningWithStrikePoint(&v153, &v154, 1056964608); v110->setPosition(v110, &v150); setColor = v110->setColor; LOWORD(v154.x) = 255; BYTE2(v154.x) = -1; setColor(v110, (const cocos2d::ccColor3B *)&v154); m_mainLayer = a1->m_mainLayer; v110->m_unkBool = 1; v110->m_removeAfterFinished = 1; v113 = m_mainLayer->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable; v110->m_lineWidth = 5.0; v113->addChild_0(m_mainLayer, v110, 3); } } v114 = cocos2d::CCDelayTime::create(1.5); v154.y = 0.0; LODWORD(v154.x) = RewardUnlockLayer::showCloseButton; v115 = (cocos2d::CCSequence *)v114; v116 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, RewardUnlockLayer::showCloseButton, 0); v117 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v115, v116, 0); cocos2d::CCNode::runAction(a1, v117); }
GD Web Decomp Icon

GD Web Decomp

Raw Source