//
// BoomScrollLayer::pageNumberForPosition from 0x2e1e92 to 0x2e1f1a (136 bytes)
//
// 4 xrefs:
// > BoomScrollLayer::updateDots @ 0x2e1fc6
// > BoomScrollLayer::moveToPageEnded @ 0x2e2100
// > BoomScrollLayer::ccTouchEnded @ 0x2e275e
// > BoomScrollLayer::ccTouchMoved @ 0x2e2b0a
//
// 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
//
int BoomScrollLayer::pageNumberForPosition(BoomScrollLayer *a1, cocos2d::CCPoint a2)
{
float v3; // s17
float v4; // s16
int v5; // r4
v3 = *(float *)((int (__fastcall *)(ExtendedLayer *, _DWORD, _DWORD))a1->m_extendedLayer->getPosition)(
a1->m_extendedLayer,
LODWORD(a2.x),
LODWORD(a2.y));
v4 = (float)-v3 / (float)(a1->getContentSize(a1)->width - a1->m_pageOffset);
v5 = (int)ceilf(v4);
if ( (float)((float)v5 - v4) >= 0.5 )
--v5;
if ( !a1->m_looped )
{
v5 &= ~(v5 >> 31);
if ( BoomScrollLayer::getTotalPages(a1) - 1 <= v5 )
return BoomScrollLayer::getTotalPages(a1) - 1;
}
return v5;
}