//
// SecretRewardsLayer::createSecondaryLayer from 0x589ed8 to 0x58a1a8 (720 bytes)
//
// 1 xrefs:
// > SecretRewardsLayer::moveToSecondaryLayer @ 0x58a250
//
// 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; // r0
cocos2d::CCLayer_vtbl *v5; // r3
cocos2d::CCDirector *v6; // r0
cocos2d::CCLayer *v7; // r0
SecretRewardsLayer_vtbl *v8; // r3
cocos2d::CCNode *v9; // r6
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // r7
const cocos2d::ccColor3B *v12; // r0
int i; // r7
cocos2d::CCSprite *v14; // r6
cocos2d::CCLabelBMFont *v15; // r0
cocos2d::CCLabelBMFont *m_chestCounter; // r6
void (__fastcall *v17)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCArray *ChestItems; // r0
BoomScrollLayer *v19; // r0
BoomScrollLayer *m_secondaryScrollLayer; // r6
float v21; // s17
cocos2d::CCDirector *v22; // r0
float v23; // r0
cocos2d::CCPoint v24; // r1
BoomScrollLayer *v25; // r4
cocos2d::CCDirector *v26; // r0
float v27; // r6
cocos2d::CCDirector *v28; // r0
float v29; // r0
float v30; // r2
float v31; // r3
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [sp+Ch] [bp-30h]
void (__fastcall *v33)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [sp+Ch] [bp-30h]
cocos2d::CCSize v34; // [sp+14h] [bp-28h] BYREF
cocos2d::CCSize v35; // [sp+1Ch] [bp-20h] BYREF
cocos2d::CCRect v36; // [sp+24h] [bp-18h] BYREF
cocos2d::CCSize v37; // 0:^0.8
cocos2d::CCRect v38; // 0:kr00_16.16
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(&v34, v6);
v7 = cocos2d::CCLayer::create();
v8 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_secondaryLayer = v7;
v8->addChild(a1, v7);
cocos2d::CCRect::CCRect(&v36, 0.0, 0.0, 80.0, 80.0);
v38.origin.x = v30;
v38.origin.y = v31;
v38.size = v37;
v9 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square05.png",
(const char *)&v36,
v38);
((void (__fastcall *)(cocos2d::CCNode *, int))v9->__vftable[1].~CCNode_0)(v9, 75);
cocos2d::CCSize::CCSize(&v35, 370.0, 255.0);
v9->setContentSize(v9, &v35);
a1->m_secondaryLayer->addChild_0(a1->m_secondaryLayer, v9, -1);
setPosition = v9->setPosition;
cocos2d::CCPoint::CCPoint(&v36.origin, v34.width * 0.5, v34.height * 0.5);
setPosition(v9, &v36.origin);
getTag = v9->__vftable[1].getTag;
v12 = a1->m_backgroundSprite->getColor(a1->m_backgroundSprite);
((void (__fastcall *)(cocos2d::CCNode *, const cocos2d::ccColor3B *))getTag)(v9, v12);
for ( i = 0; ; i = 1 )
{
v14 = cocos2d::CCSprite::createWithSpriteFrameName("chain_01_001.png");
a1->m_secondaryLayer->addChild_0(a1->m_secondaryLayer, v14, -1);
setAnchorPoint = v14->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v36.origin, 0.5, 0.0);
setAnchorPoint(v14, &v36.origin);
v33 = v14->setPosition;
cocos2d::CCPoint::CCPoint(
&v36.origin,
(float)((float)(v34.width * 0.5) - 100.0) + (float)((float)((float)i * 100.0) + (float)((float)i * 100.0)),
(float)((float)(v35.height * 0.5) + (float)(v34.height * 0.5)) - 2.0);
v33(v14, &v36.origin);
v14->setColor(v14, &stru_9ADC1C);
v14->setOpacity(v14, 75);
if ( i )
break;
}
v15 = cocos2d::CCLabelBMFont::create();
a1->m_chestCounter = v15;
a1->m_secondaryLayer->addChild(a1->m_secondaryLayer, v15);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))a1->m_chestCounter->setScale)(a1->m_chestCounter, 1058642330);
m_chestCounter = a1->m_chestCounter;
v17 = m_chestCounter->setPosition;
cocos2d::CCPoint::CCPoint(
&v36.origin,
v34.width * 0.5,
(float)((float)(v35.height * 0.5) + (float)(v34.height * 0.5)) + 17.0);
v17(m_chestCounter, &v36.origin);
SecretRewardsLayer::updateUnlockedLabel(a1);
ChestItems = SecretRewardsLayer::generateChestItems(a1, a2);
v19 = BoomScrollLayer::create(ChestItems, 0, a2 <= 5, nullptr, nullptr);
a1->m_secondaryScrollLayer = v19;
a1->m_secondaryLayer->addChild(a1->m_secondaryLayer, v19);
m_secondaryScrollLayer = a1->m_secondaryScrollLayer;
v21 = v34.width * 0.5;
v22 = cocos2d::CCDirector::sharedDirector();
v23 = COERCE_FLOAT(cocos2d::CCDirector::getScreenBottom(v22));
cocos2d::CCPoint::CCPoint(&v36.origin, v21, v23 + 10.0);
LODWORD(v24.x) = &v36;
BoomScrollLayer::setPagesIndicatorPosition(m_secondaryScrollLayer, v24);
v25 = a1->m_secondaryScrollLayer;
v25->m_unkFloat2 = 0.9;
v25->m_doVisit = i;
v26 = cocos2d::CCDirector::sharedDirector();
v27 = COERCE_FLOAT(cocos2d::CCDirector::getScreenRight(v26));
v28 = cocos2d::CCDirector::sharedDirector();
v29 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v28));
cocos2d::CCRect::CCRect(&v36, 0.0, 0.0, v27, v29);
cocos2d::CCRect::operator=(&v25->m_clippingRect, &v36);
}