//
// SecretRewardsLayer::scrollLayerMoved from 0x5851e4 to 0x585372 (398 bytes)
//
// 1 xrefs:
// > `non-virtual thunk to'SecretRewardsLayer::scrollLayerMoved @ 0x585388
//
// 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::scrollLayerMoved(SecretRewardsLayer *a1, cocos2d::CCPoint a2)
{
float x; // r5
cocos2d::CCDirector *v4; // r0
int TotalPages; // r0
float v6; // s17
int v7; // r7
float v8; // r0
int v9; // r1
float v10; // s16
int v11; // r5
int v12; // r0
int v13; // r0
float v14; // s15
int v15; // r0
char v16; // r3
cocos2d::CCSprite *m_backgroundSprite; // r0
_BOOL4 m_inMainLayer; // r5
cocos2d::ccColor3B v19; // [sp+0h] [bp-1Ch]
cocos2d::ccColor3B v20; // [sp+4h] [bp-18h]
_BYTE v21[4]; // [sp+8h] [bp-14h] BYREF
cocos2d::CCSize v22; // [sp+Ch] [bp-10h] BYREF
x = a2.x;
if ( a1->m_inMainLayer )
{
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v22, v4);
TotalPages = BoomScrollLayer::getTotalPages(a1->m_mainScrollLayer);
v6 = (float)-*(float *)LODWORD(x) / v22.width;
v7 = TotalPages;
while ( v6 < 0.0 )
v6 = v6 + (float)TotalPages;
v8 = floorf(v6);
v9 = (int)v8 % v7;
v10 = v6 - (float)(int)v8;
v11 = v9 + 1;
*(cocos2d::ccColor3B *)&v12 = SecretRewardsLayer::getPageColor(a1, v9);
if ( v11 == v7 )
v11 = 0;
*(_WORD *)&v19.r = v12;
v19.b = BYTE2(v12);
*(cocos2d::ccColor3B *)&v13 = SecretRewardsLayer::getPageColor(a1, v11);
*(_WORD *)&v20.r = v13;
v20.b = BYTE2(v13);
v14 = (float)(v10 / 0.66667) - 0.2;
if ( v14 >= 1.0 )
{
v14 = 1.0;
}
else if ( v14 <= 0.0 )
{
v14 = 0.0;
}
*(cocos2d::ccColor3B *)&v15 = GameToolbox::multipliedColorValue(v19, v20, v14);
v16 = BYTE1(v15);
v21[0] = v15;
v21[2] = BYTE2(v15);
m_backgroundSprite = a1->m_backgroundSprite;
v21[1] = v16;
m_backgroundSprite->setColor(m_backgroundSprite, (const cocos2d::ccColor3B *)v21);
m_inMainLayer = a1->m_inMainLayer;
if ( a1->m_inMainLayer )
m_inMainLayer = lroundf() % v7 == 3;
a1->m_keysLabel->setVisible(a1->m_keysLabel, !m_inMainLayer);
a1->m_keySprite->setVisible(a1->m_keySprite, !m_inMainLayer);
a1->m_goldKeysLabel->setVisible(a1->m_goldKeysLabel, m_inMainLayer);
a1->m_goldKeySprite->setVisible(a1->m_goldKeySprite, m_inMainLayer);
}
}