//
// GJBaseGameLayer::updateObjectSection from 0x100140620 to 0x100140782 (354 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::updateObjectSection @ 0x1000f1e4a
// > ??> @ 0x1008b7370
// > ??> @ 0x1008c18f0
//
// 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 __fastcall GJBaseGameLayer::updateObjectSection(GJBaseGameLayer *a1, GameObject *a2)
{
int m_outerSectionIndex; // eax
double m_positionX; // xmm1_8
double v4; // xmm0_8
int v5; // ecx
double m_positionY; // xmm1_8
float m_sectionXFactor; // xmm2_4
float m_sectionYFactor; // xmm0_4
int v9; // eax
int m_middleSectionIndex; // eax
m_outerSectionIndex = a2->m_outerSectionIndex;
if ( m_outerSectionIndex < 0 )
return;
m_positionX = a2->m_positionX;
v4 = 0.0;
if ( m_positionX <= 0.0 )
{
v5 = (int)0.0;
m_positionY = a2->m_positionY;
if ( m_positionY <= 0.0 )
goto LABEL_4;
LABEL_11:
m_sectionYFactor = a1->m_sectionYFactor;
if ( m_positionY >= 10000000.0 )
{
v4 = (float)(m_sectionYFactor * 10000000.0);
if ( m_outerSectionIndex != v5 )
goto LABEL_15;
}
else
{
v4 = m_positionY * m_sectionYFactor;
if ( m_outerSectionIndex != v5 )
goto LABEL_15;
}
LABEL_5:
if ( a2->m_middleSectionIndex == (int)v4 )
return;
goto LABEL_15;
}
m_sectionXFactor = a1->m_sectionXFactor;
if ( m_positionX >= 10000000.0 )
{
v5 = (int)(float)(m_sectionXFactor * 10000000.0);
m_positionY = a2->m_positionY;
if ( m_positionY > 0.0 )
goto LABEL_11;
}
else
{
v5 = (int)(m_positionX * m_sectionXFactor);
m_positionY = a2->m_positionY;
if ( m_positionY > 0.0 )
goto LABEL_11;
}
LABEL_4:
if ( m_outerSectionIndex == v5 )
goto LABEL_5;
LABEL_15:
GJBaseGameLayer::removeObjectFromSection(a1, a2);
((void (__fastcall *)(GJBaseGameLayer *, GameObject *, double))a1->addToSection)(a1, a2, v4);
if ( a2->m_isActivated )
{
v9 = a2->m_outerSectionIndex;
if ( v9 > a1->m_rightSectionIndex
|| v9 < a1->m_leftSectionIndex
|| (m_middleSectionIndex = a2->m_middleSectionIndex, m_middleSectionIndex > a1->m_topSectionIndex)
|| m_middleSectionIndex < a1->m_bottomSectionIndex )
{
cocos2d::CCDictionary::setObject(a1->m_objectsToDeactivate, a2, (unsigned int)a2->m_uniqueID);
a2->m_unk3ee = 1;
}
}
}