// // GJChestSprite::switchToState from 0x4e7c9c to 0x4e85b6 (2330 bytes) // // 10 xrefs: // > RewardUnlockLayer::step2 @ 0x4e85f4 // > GJChestSprite::init @ 0x4e867c // > RewardUnlockLayer::playRewardEffect @ 0x4e9204 // > SecretLayer3::init @ 0x4ef9ea // > SecretLayer3::init @ 0x4efb64 // > SecretLayer4::init @ 0x4f2074 // > FollowRewardPage::switchToOpenedState @ 0x4ffc2c // > FollowRewardPage::init @ 0x500352 // > SecretRewardsLayer::switchToOpenedState @ 0x58583a // > SecretRewardsLayer::generateChestItems @ 0x589ca6 // // 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 GJChestSprite::switchToState(GJChestSprite *a1, ChestSpriteState a2, bool a3) { _BOOL4 v3; // r5 GJChestSprite_vtbl *v6; // r3 float v7; // s17 int m_chestType; // r0 const char *v9; // r0 cocos2d::CCSprite *v10; // r0 char *RewardFrame; // r0 cocos2d::CCSprite *v12; // r0 int v13; // r3 cocos2d::CCSprite *v14; // r0 int v15; // r3 cocos2d::CCSprite *v16; // r5 cocos2d::CCSprite *v17; // r6 void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r8 float width; // s18 int v20; // r0 cocos2d::CCSprite_vtbl *v21; // r3 bool v22; // r2 cocos2d::CCParticleSystem *v23; // r5 int v24; // r3 int v25; // r4 int v26; // r6 int v27; // r8 int v28; // r10 int v29; // r11 void (__fastcall *setEndColor)(cocos2d::CCParticleSystem *__hidden, const cocos2d::ccColor4F *); // r10 void (__fastcall *v31)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r4 char *v32; // r0 cocos2d::CCSprite *v33; // r0 int v34; // r3 cocos2d::CCSprite *v35; // r0 int v36; // r3 cocos2d::CCSprite *v37; // r5 void (__fastcall *setBlendFunc)(cocos2d::CCSprite *__hidden, cocos2d::ccBlendFunc); // r6 cocos2d::CCFadeTo *v39; // r0 cocos2d::CCEaseInOut *v40; // r6 cocos2d::CCFadeTo *v41; // r0 cocos2d::CCEaseInOut *v42; // r0 cocos2d::CCActionInterval *v43; // r0 cocos2d::CCRepeatForever *v44; // r0 int v45; // r1 int v46; // r5 int v47; // r6 int v48; // r7 int v49; // r11 int v50; // r8 cocos2d::CCSprite *v51; // r9 float v52; // s19 int v53; // r0 float v54; // r2 cocos2d::CCActionInterval *v55; // r0 cocos2d::CCRepeatForever *v56; // r0 cocos2d::CCSprite *v57; // r9 int v58; // r0 float v59; // r2 cocos2d::CCActionInterval *v60; // r0 cocos2d::CCRepeatForever *v61; // r0 bool v62; // r2 cocos2d::CCParticleSystem *v63; // r9 float v64; // s16 void (__fastcall *v65)(cocos2d::CCParticleSystem *__hidden, const cocos2d::ccColor4F *); // r5 cocos2d::CCSprite *v66; // r5 cocos2d::CCSprite *v67; // r5 cocos2d::CCSprite *v68; // r5 void (__fastcall *v69)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7 cocos2d::CCSprite *v70; // r5 void (__fastcall *v71)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r6 void (__fastcall *setStartColor)(cocos2d::CCParticleSystem *__hidden, const cocos2d::ccColor4F *); // [sp+0h] [bp-4Ch] void (__fastcall *v73)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [sp+4h] [bp-48h] void (__fastcall *v74)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+4h] [bp-48h] void (__fastcall *v75)(cocos2d::CCParticleSystem *__hidden, const cocos2d::ccColor4F *); // [sp+4h] [bp-48h] void (__fastcall *v76)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [sp+8h] [bp-44h] char v77; // [sp+14h] [bp-38h] BYREF char v78; // [sp+15h] [bp-37h] char v79; // [sp+16h] [bp-36h] char v80; // [sp+18h] [bp-34h] BYREF char v81; // [sp+19h] [bp-33h] char v82; // [sp+1Ah] [bp-32h] _BYTE v83[4]; // [sp+1Ch] [bp-30h] BYREF cocos2d::CCSprite *v84; // [sp+20h] [bp-2Ch] BYREF cocos2d::CCSprite *v85; // [sp+24h] [bp-28h] BYREF cocos2d::CCSprite *v86; // [sp+28h] [bp-24h] BYREF int v87; // [sp+2Ch] [bp-20h] BYREF int v88; // [sp+30h] [bp-1Ch] cocos2d::CCPoint v89; // [sp+34h] [bp-18h] BYREF float v90; // [sp+3Ch] [bp-10h] int v91; // [sp+40h] [bp-Ch] v3 = a3; if ( a1->m_spriteState != a2 ) { v6 = a1->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable; a1->m_spriteState = a2; v7 = 0.8; ((void (*)(void))v6->removeAllChildren)(); m_chestType = a1->m_chestType; if ( m_chestType != 1 ) v7 = 1.0; if ( a2 == Opening ) { RewardFrame = (char *)RewardsPage::getRewardFrame(m_chestType, 3); sub_776584((int)&v84, RewardFrame); v12 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v84); a1->addChild_0(a1, v12, 3); sub_4E6B4C((int)&v85, (char *)v84, "_back_001", v13); v14 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v85); a1->addChild_0(a1, v14, 0); if ( !v3 ) { sub_4E6B4C((int)&v86, (char *)v84, "_glow_001", v15); v16 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v86); a1->addChild_0(a1, v16, 1); v17 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v86); v16->addChild_0(v16, v17, 1); setPosition = v17->setPosition; width = v16->getContentSize(v16)->width; v20 = (int)v16->getContentSize(v16); cocos2d::CCPoint::CCPoint(&v89, width * 0.5, *(float *)(v20 + 4) * 0.5); setPosition(v17, &v89); ((void (__fastcall *)(cocos2d::CCSprite *, int))v17->setScaleX)(v17, 1061997773); v21 = v16->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable; v87 = 770; v88 = 1; ((void (__fastcall *)(cocos2d::CCSprite *, int, int))v21->setBlendFunc)(v16, 770, 1); ((void (__fastcall *)(cocos2d::CCSprite *, int, int))v17->setBlendFunc)(v17, v87, v88); v23 = (cocos2d::CCParticleSystem *)cocos2d::CCParticleSystemQuad::create( (cocos2d::CCParticleSystemQuad *)"chestOpen.plist", nullptr, v22); v23->setAutoRemoveOnFinish(v23, 1); a1->addChild_0(a1, v23, 4); v24 = a1->m_chestType; switch ( v24 ) { case 1: v25 = 0; v27 = 255; v26 = 0; v28 = 50; v29 = 255; break; case 3: v26 = 0; v25 = 255; v27 = 0; v28 = 255; v29 = 0; break; case 4: v25 = 0; v26 = 255; v27 = 0; v28 = 0; v29 = 150; break; default: v25 = 255; v27 = 0; v26 = 255; v28 = 255; v29 = 255; break; } setStartColor = v23->setStartColor; v91 = 1065353216; v89.y = 1.0; v89.x = (float)v29 / 255.0; v90 = (float)v28 / 255.0; ((void (__fastcall *)(cocos2d::CCParticleSystem *, cocos2d::CCPoint *, int))setStartColor)( v23, &v89, 1065353216); setEndColor = v23->setEndColor; v91 = 1065353216; v89.x = (float)v27 / 255.0; v89.y = (float)v26 / 255.0; v90 = (float)v25 / 255.0; setEndColor(v23, (const cocos2d::ccColor4F *)&v89); v23->setScale(v23, COERCE_FLOAT(LODWORD(v7))); v31 = v23->setPosition; cocos2d::CCPoint::CCPoint(&v89, 0.0, 0.0); v31(v23, &v89); cocos2d::CCParticleSystem::resetSystem(v23); sub_774008(&v86); } sub_774008(&v85); } else { if ( a2 != Opened ) { if ( a2 == Closed ) { v9 = RewardsPage::getRewardFrame(m_chestType, 2); v10 = cocos2d::CCSprite::createWithSpriteFrameName(v9); a1->addChild_0(a1, v10, 3); } return; } v32 = (char *)RewardsPage::getRewardFrame(m_chestType, 4); sub_776584((int)&v84, v32); v33 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v84); a1->addChild_0(a1, v33, 4); sub_4E6B4C((int)&v85, (char *)v84, "_back_001", v34); v35 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v85); a1->addChild_0(a1, v35, 0); if ( !v3 ) { sub_4E6B4C((int)&v86, (char *)v84, "_glow_001", v36); v37 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v86); a1->addChild_0(a1, v37, 1); setBlendFunc = v37->setBlendFunc; v87 = 770; v88 = 1; ((void (__fastcall *)(cocos2d::CCSprite *, int, int, int *))setBlendFunc)(v37, 770, 1, &v87); v39 = cocos2d::CCFadeTo::create(1.0, 0xAFu); v40 = cocos2d::CCEaseInOut::create(v39, 2.0); v41 = cocos2d::CCFadeTo::create(1.0, 0xFFu); v42 = cocos2d::CCEaseInOut::create(v41, 2.0); v43 = (cocos2d::CCActionInterval *)cocos2d::CCSequence::create((cocos2d::CCSequence *)v40, v42, 0); v44 = cocos2d::CCRepeatForever::create(v43); cocos2d::CCNode::runAction(v37, v44); v78 = -106; v81 = -106; qmemcpy(v83, "3D", 2); v83[2] = -103; v45 = a1->m_chestType; v77 = 0; v79 = -1; v80 = 0; v82 = -1; switch ( v45 ) { case 1: v46 = 0; v77 = -1; v78 = -56; v79 = 0; v80 = -1; v82 = 0; goto LABEL_28; case 2: case 5: v78 = -56; v81 = 100; goto LABEL_30; case 4: v78 = -1; v47 = 255; v81 = -1; v48 = 0; v79 = 0; v82 = 50; goto LABEL_25; case 6: v78 = -56; v81 = 100; qmemcpy(v83, "\n6S", 3); goto LABEL_30; case 7: v47 = 255; v48 = 100; v78 = -1; v81 = -1; v79 = 0; v82 = 50; qmemcpy(v83, ")Q;", 3); LABEL_25: v46 = 0; v49 = 255; v50 = 150; break; case 8: v48 = 255; v77 = -1; v80 = -1; v47 = 0; v78 = 0; v83[0] = 58; v46 = 255; v81 = 0; v83[1] = 27; v49 = 150; v83[2] = 75; goto LABEL_29; case 9: v46 = 0; v77 = -1; v80 = -1; v78 = -56; v79 = 0; v83[0] = 39; v82 = 0; v83[1] = 29; v83[2] = 44; LABEL_28: v48 = 255; v47 = 100; v49 = 255; LABEL_29: v50 = 255; break; default: LABEL_30: v47 = 0; v46 = 255; v48 = 0; v49 = 255; v50 = 0; break; } v51 = cocos2d::CCSprite::createWithSpriteFrameName("shineBurst_001.png"); a1->addChild_0(a1, v51, 1); ((void (__fastcall *)(cocos2d::CCSprite *, int, int))v51->setBlendFunc)(v51, v87, v88); v76 = v51->setPosition; cocos2d::CCPoint::CCPoint(&v89, 0.0, -5.0); v76(v51, &v89); ((void (__fastcall *)(cocos2d::CCSprite *, _DWORD))v51->setScale)(v51, v7 * 4.0); v51->setColor(v51, (const cocos2d::ccColor3B *)&v77); v52 = -1.0; if ( (float)((float)rand() * 4.6566e-10) > 0.5 ) v52 = 1.0; v53 = rand(); v55 = (cocos2d::CCActionInterval *)cocos2d::CCRotateBy::create( (cocos2d::CCRotateBy *)0x3F800000, (float)((float)((float)((float)((float)v53 * 4.6566e-10) * 0.5) + 0.5) * 180.0) * v52, v54); v56 = cocos2d::CCRepeatForever::create(v55); cocos2d::CCNode::runAction(v51, v56); v57 = cocos2d::CCSprite::createWithSpriteFrameName("shineBurst_001.png"); a1->addChild_0(a1, v57, 1); ((void (__fastcall *)(cocos2d::CCSprite *, int, int))v57->setBlendFunc)(v57, v87, v88); v73 = v57->setPosition; cocos2d::CCPoint::CCPoint(&v89, 0.0, -5.0); v73(v57, &v89); ((void (__fastcall *)(cocos2d::CCSprite *, _DWORD))v57->setScale)(v57, v7 * 3.5); v57->setColor(v57, (const cocos2d::ccColor3B *)&v80); v58 = rand(); v60 = (cocos2d::CCActionInterval *)cocos2d::CCRotateBy::create( (cocos2d::CCRotateBy *)0x3F800000, -(float)(v52 * (float)((float)((float)((float)((float)v58 * 4.6566e-10) * 0.5) + 0.5) * 180.0)), v59); v61 = cocos2d::CCRepeatForever::create(v60); cocos2d::CCNode::runAction(v57, v61); v63 = (cocos2d::CCParticleSystem *)cocos2d::CCParticleSystemQuad::create( (cocos2d::CCParticleSystemQuad *)"chestOpened.plist", nullptr, v62); v63->setAutoRemoveOnFinish(v63, 1); a1->addChild_0(a1, v63, 1); v74 = v63->setPosition; cocos2d::CCPoint::CCPoint(&v89, 0.0, 0.0); v74(v63, &v89); v75 = v63->setStartColor; v91 = 1065353216; v89.x = (float)v50 / 255.0; v89.y = (float)v49 / 255.0; v64 = (float)v46 / 255.0; v90 = v64; v75(v63, (const cocos2d::ccColor4F *)&v89); v65 = v63->setEndColor; v91 = 1065353216; v90 = v64; v89.x = (float)v48 / 255.0; v89.y = (float)v47 / 255.0; v65(v63, (const cocos2d::ccColor4F *)&v89); v63->setScale(v63, COERCE_FLOAT(LODWORD(v7))); cocos2d::CCParticleSystem::resetSystem(v63); v66 = cocos2d::CCSprite::createWithSpriteFrameName("chest_glow_bg_001.png"); a1->addChild_0(a1, v66, 2); v66->setScale(v66, COERCE_FLOAT(LODWORD(v7))); v66->setColor(v66, (const cocos2d::ccColor3B *)v83); v67 = cocos2d::CCSprite::createWithSpriteFrameName("chest_glow_bg_001.png"); cocos2d::CCSprite::setFlipX(v67, 1); a1->addChild_0(a1, v67, 2); v67->setScale(v67, COERCE_FLOAT(LODWORD(v7))); v67->setColor(v67, (const cocos2d::ccColor3B *)v83); v68 = cocos2d::CCSprite::createWithSpriteFrameName("whiteSquare60_001.png"); v69 = v68->setPosition; cocos2d::CCPoint::CCPoint(&v89, 0.0, v7 * -52.0); v69(v68, &v89); ((void (__fastcall *)(cocos2d::CCSprite *, _DWORD))v68->setScaleX)(v68, v7 * 5.2); ((void (__fastcall *)(cocos2d::CCSprite *, _DWORD))v68->setScaleY)(v68, v7 * 2.2); v68->setColor(v68, (const cocos2d::ccColor3B *)v83); a1->addChild_0(a1, v68, 2); v70 = cocos2d::CCSprite::createWithSpriteFrameName("chest_shadow_001.png"); v71 = v70->setPosition; cocos2d::CCPoint::CCPoint(&v89, 0.0, v7 * -48.0); v71(v70, &v89); a1->addChild_0(a1, v70, 3); ((void (__fastcall *)(cocos2d::CCSprite *, _DWORD))v70->setScale)(v70, v7 * 0.95); v70->setOpacity(v70, 90); sub_774008(&v86); } sub_774008(&v85); } sub_774008(&v84); } }
GD Web Decomp Icon

GD Web Decomp

Raw Source