//
// SecretRewardsLayer::createSecondaryLayer from 0xa6ab0c to 0xa6aef8 (1004 bytes)
//
// 2 xrefs:
// > SecretRewardsLayer::moveToSecondaryLayer @ 0xa6afe0
// > ??> @ 0x4eed0
//
// 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 SecretRewardsLayer::createSecondaryLayer(SecretRewardsLayer *a1, int a2)
{
cocos2d::CCLayer *m_secondaryLayer; // x0
cocos2d::CCLayer_vtbl *v5; // x1
cocos2d::CCDirector *v6; // x0
int v7; // w23
cocos2d::CCLayer *v8; // x0
cocos2d::CCNode *v9; // x20
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // x24
const cocos2d::ccColor3B *v12; // x0
cocos2d::CCSprite *v13; // x20
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
void (__fastcall *v15)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::CCLabelBMFont *v16; // x0
cocos2d::CCLabelBMFont *m_chestCounter; // x20
void (__fastcall *v18)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::CCArray *ChestItems; // x0
BoomScrollLayer *v20; // x0
cocos2d::CCLayer *v21; // x2
BoomScrollLayer *m_secondaryScrollLayer; // x20
cocos2d::CCDirector *v23; // x0
float v24; // s0
BoomScrollLayer *v25; // x19
cocos2d::CCDirector *v26; // x0
float v27; // s0
cocos2d::CCDirector *v28; // x0
float v29; // s0
float v30; // [xsp+90h] [xbp+90h]
float v31; // [xsp+A8h] [xbp+A8h]
float v32; // [xsp+ACh] [xbp+ACh]
cocos2d::CCSize v33; // [xsp+B0h] [xbp+B0h] BYREF
cocos2d::CCRect v34; // [xsp+B8h] [xbp+B8h] BYREF
cocos2d::CCPoint v35; // 0:s0.4,4:s1.4
cocos2d::CCRect v36; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
m_secondaryLayer = a1->m_secondaryLayer;
if ( m_secondaryLayer )
{
v5 = m_secondaryLayer->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_secondaryScrollLayer = nullptr;
a1->m_chestCounter = nullptr;
v5->removeFromParent(m_secondaryLayer);
a1->m_secondaryLayer = nullptr;
}
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v6);
v7 = 0;
v8 = cocos2d::CCLayer::create();
a1->m_secondaryLayer = v8;
a1->addChild(a1, v8);
cocos2d::CCRect::CCRect(&v34, 0.0, 0.0, 80.0, 80.0);
v9 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square05.png",
(const char *)&v34,
v36);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v9->__vftable[1].~CCNode_0)(v9, 75);
cocos2d::CCSize::CCSize(&v33, 370.0, 255.0);
v9->setContentSize(v9, &v33);
a1->m_secondaryLayer->addChild_0(a1->m_secondaryLayer, v9, -1);
setPosition = v9->setPosition;
cocos2d::CCPoint::CCPoint(&v34.origin, v31 * 0.5, v32 * 0.5);
setPosition(v9, &v34.origin);
getTag = v9->__vftable[1].getTag;
v12 = a1->m_backgroundSprite->getColor(a1->m_backgroundSprite);
((void (__fastcall *)(cocos2d::CCNode *, const cocos2d::ccColor3B *))getTag)(v9, v12);
while ( 1 )
{
v13 = cocos2d::CCSprite::createWithSpriteFrameName("chain_01_001.png");
a1->m_secondaryLayer->addChild_0(a1->m_secondaryLayer, v13, -1);
setAnchorPoint = v13->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v34.origin, 0.5, 0.0);
setAnchorPoint(v13, &v34.origin);
v15 = v13->setPosition;
cocos2d::CCPoint::CCPoint(
&v34.origin,
(float)((float)(v31 * 0.5) + -100.0) + (float)((float)((float)v7 * 100.0) * 2.0),
(float)((float)(v33.height * 0.5) + (float)(v32 * 0.5)) - 2.0);
v15(v13, &v34.origin);
v13->setColor(v13, (const cocos2d::ccColor3B *)&dword_F131E0[6]);
v13->setOpacity(v13, 75);
if ( v7 )
break;
v7 = 1;
}
v16 = cocos2d::CCLabelBMFont::create();
a1->m_chestCounter = v16;
a1->m_secondaryLayer->addChild(a1->m_secondaryLayer, v16);
a1->m_chestCounter->setScale(a1->m_chestCounter, 0.6);
m_chestCounter = a1->m_chestCounter;
v18 = m_chestCounter->setPosition;
cocos2d::CCPoint::CCPoint(&v34.origin, v31 * 0.5, (float)((float)(v33.height * 0.5) + (float)(v32 * 0.5)) + 17.0);
v18(m_chestCounter, &v34.origin);
SecretRewardsLayer::updateUnlockedLabel(a1);
ChestItems = SecretRewardsLayer::generateChestItems(a1, a2);
v20 = (BoomScrollLayer *)BoomScrollLayer::create(ChestItems, 0, a2 <= 5, nullptr, nullptr);
v21 = a1->m_secondaryLayer;
a1->m_secondaryScrollLayer = v20;
v21->addChild(v21, v20);
m_secondaryScrollLayer = a1->m_secondaryScrollLayer;
v23 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenBottom(v23);
cocos2d::CCPoint::CCPoint(&v34.origin, v31 * 0.5, v24 + 10.0);
BoomScrollLayer::setPagesIndicatorPosition(m_secondaryScrollLayer, v35);
v25 = a1->m_secondaryScrollLayer;
v25->m_doVisit = v7;
v25->m_unkFloat2 = 0.9;
v26 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenRight(v26);
v30 = v27;
v28 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v28);
cocos2d::CCRect::CCRect(&v34, 0.0, 0.0, v30, v29);
cocos2d::CCRect::operator=(&v25->m_clippingRect, &v34);
}