//
// GJBaseGameLayer::removeObjectFromSection from 0x860b54 to 0x860d08 (436 bytes)
//
// 12 xrefs:
// > PlayLayer::removeCheckpoint @ 0x5d2d78
// > PlayLayer::removeCheckpoint @ 0x5d2dc0
// > LevelEditorLayer::removePlayerCollisionBlock @ 0x6612b4
// > LevelEditorLayer::removePlayerCollisionBlock @ 0x6612c8
// > LevelEditorLayer::removeObject @ 0x6658d8
// > LevelEditorLayer::handleAction @ 0x672678
// > LevelEditorLayer::handleAction @ 0x67271c
// > GJBaseGameLayer::reorderObjectSection @ 0x860d1c
// > GJBaseGameLayer::updateExtendedCollision @ 0x861638
// > GJBaseGameLayer::addUIObject @ 0x87853c
// > SetupObjectOptionsPopup::onDisableObject @ 0x974b6c
// > ??> @ 0x7afe8
//
// 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 GJBaseGameLayer::removeObjectFromSection(GJBaseGameLayer *a1, GameObject *a2)
{
int m_outerSectionIndex; // w2
int m_middleSectionIndex; // w3
int m_someOtherIndex; // w7
int *m_start; // x6
std::vector *v6; // x4
GameObject **v7; // x5
int v8; // w2
GameObject **v9; // x3
int v10; // w2
int v11; // w4
GameObject **v12; // x3
int v13; // w2
int m_innerSectionIndex; // w4
int v15; // w3
int v16; // w2
int v17; // w6
int *v18; // x5
GameObject *v19; // x3
GameObject_vtbl *v20; // x4
int v21; // w0
int v22; // w2
int v23; // w3
int v24; // w7
int *v25; // x6
std::vector *v26; // x4
GameObject **v27; // x5
int v28; // w2
std::vector **v29; // x0
m_outerSectionIndex = a2->m_outerSectionIndex;
if ( (m_outerSectionIndex & 0x80000000) == 0 )
{
m_middleSectionIndex = a2->m_middleSectionIndex;
m_someOtherIndex = a2->m_someOtherIndex;
m_start = a1->m_sectionSizes.m_start[m_outerSectionIndex]->m_start;
v6 = a1->m_sections.m_start[m_outerSectionIndex]->m_start[m_middleSectionIndex];
v7 = v6->m_start;
v8 = m_start[m_middleSectionIndex] - 1;
m_start[m_middleSectionIndex] = v8;
v7[m_someOtherIndex] = v7[v8];
v6->m_start[a2->m_someOtherIndex]->m_someOtherIndex = a2->m_someOtherIndex;
if ( a2->m_objectID == 1816 )
{
if ( a2->m_hasExtendedCollision )
{
v12 = a1->m_calcCollisionBlockObjects.m_start;
v13 = a1->m_calcCollisionBlockObjectsSize - 1;
m_innerSectionIndex = a2->m_innerSectionIndex;
a1->m_calcCollisionBlockObjectsSize = v13;
v12[m_innerSectionIndex] = v12[v13];
a1->m_calcCollisionBlockObjects.m_start[a2->m_innerSectionIndex]->m_innerSectionIndex = a2->m_innerSectionIndex;
}
else
{
v15 = a2->m_outerSectionIndex;
v16 = a2->m_middleSectionIndex;
v17 = a2->m_innerSectionIndex;
v18 = a1->m_collisionBlockSectionSizes.m_start[v15]->m_start;
v19 = a1->m_collisionBlockSections.m_start[v15]->m_start[v16];
v20 = v19->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v21 = v18[v16] - 1;
v18[v16] = v21;
*((_QWORD *)&v20->copyWithZone + v17) = *((_QWORD *)&v20->copyWithZone + v21);
*(_DWORD *)(*((_QWORD *)&v19->copyWithZone + a2->m_innerSectionIndex) + 624LL) = a2->m_innerSectionIndex;
}
}
else if ( a2->m_objectType != Decoration )
{
if ( a2->m_hasExtendedCollision )
{
v9 = a1->m_calcNonEffectObjects.m_start;
v10 = a1->m_calcNonEffectObjectsSize - 1;
v11 = a2->m_innerSectionIndex;
a1->m_calcNonEffectObjectsSize = v10;
v9[v11] = v9[v10];
a1->m_calcNonEffectObjects.m_start[a2->m_innerSectionIndex]->m_innerSectionIndex = a2->m_innerSectionIndex;
}
else
{
v22 = a2->m_outerSectionIndex;
v23 = a2->m_middleSectionIndex;
v24 = a2->m_innerSectionIndex;
v25 = a1->m_nonEffectObjectsSizes.m_start[v22]->m_start;
v26 = a1->m_nonEffectObjects.m_start[v22]->m_start[v23];
v27 = v26->m_start;
v28 = v25[v23] - 1;
v25[v23] = v28;
v27[v24] = v27[v28];
v29 = a1->m_nonEffectObjectsFlags.m_start;
v26->m_start[a2->m_innerSectionIndex]->m_innerSectionIndex = a2->m_innerSectionIndex;
v29[a2->m_outerSectionIndex]->m_start.m_bitptr[(unsigned __int64)a2->m_middleSectionIndex >> 6] |= 1LL << (a2->m_middleSectionIndex & 0x3F);
}
}
}
}