//
// GJBaseGameLayer::removeObjectFromSection from 0x1001f324c to 0x1001f33ec (416 bytes)
//
// 14 xrefs:
// > SetupObjectOptionsPopup::onDisableObject @ 0x100040cb4
// > PlayLayer::removeCheckpoint @ 0x100120ed0
// > GJBaseGameLayer::updatePlayerCollisionBlocks @ 0x1001eac94
// > GJBaseGameLayer::reorderObjectSection @ 0x1001eace8
// > GJBaseGameLayer::addUIObject @ 0x1001f31ac
// > GJBaseGameLayer::updateExtendedCollision @ 0x1001f3b08
// > GJBaseGameLayer::updateObjectSection @ 0x1001f426c
// > LevelEditorLayer::removePlayerCollisionBlock @ 0x100357d94
// > LevelEditorLayer::removePlayerCollisionBlock @ 0x100357da8
// > LevelEditorLayer::removeObject @ 0x10035b594
// > LevelEditorLayer::removeSpecial @ 0x10035b710
// > LevelEditorLayer::removeAllObjects @ 0x10035b9f4
// > LevelEditorLayer::handleAction @ 0x10035bec0
// > LevelEditorLayer::handleAction @ 0x10035bf20
//
// 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::removeObjectFromSection(GJBaseGameLayer *a1, GameObject *a2)
{
__int64 m_outerSectionIndex; // x8
__int64 m_middleSectionIndex; // x10
std::vector *v4; // x9
std::__vector_base::pointer begin; // x8
__int64 v6; // x11
GameObject *v7; // x10
__int64 m_someOtherIndex; // x11
__int64 v9; // x8
__int64 m_innerSectionIndex; // x10
std::__vector_base::pointer v11; // x8
__int64 v12; // x8
__int64 v13; // x8
__int64 v14; // x10
GameObject *v15; // x9
std::__vector_base::pointer v16; // x8
__int64 v17; // x11
__int64 v18; // x10
__int64 v19; // x11
__int64 v20; // x8
__int64 v21; // x10
std::vector *v22; // x9
std::__vector_base::pointer v23; // x8
__int64 v24; // x11
GameObject *v25; // x10
__int64 v26; // x11
std::__vector_base::pointer v27; // x8
m_outerSectionIndex = (unsigned int)a2->m_outerSectionIndex;
if ( (m_outerSectionIndex & 0x80000000) == 0 )
{
m_middleSectionIndex = a2->m_middleSectionIndex;
v4 = a1->m_sections.__begin_[m_outerSectionIndex]->__begin_[m_middleSectionIndex];
begin = a1->m_sectionSizes.__begin_[m_outerSectionIndex]->__begin_;
v6 = begin[m_middleSectionIndex] - 1LL;
begin[m_middleSectionIndex] = v6;
v7 = v4->__begin_[v6];
m_someOtherIndex = a2->m_someOtherIndex;
v4->__begin_[m_someOtherIndex] = v7;
v4->__begin_[m_someOtherIndex]->m_someOtherIndex = m_someOtherIndex;
if ( a2->m_objectID == 1816 )
{
if ( a2->m_hasExtendedCollision )
{
v9 = a1->m_calcCollisionBlockObjectsSize - 1LL;
a1->m_calcCollisionBlockObjectsSize = v9;
m_innerSectionIndex = a2->m_innerSectionIndex;
a1->m_calcCollisionBlockObjects.__begin_[m_innerSectionIndex] = a1->m_calcCollisionBlockObjects.__begin_[v9];
v11 = a1->m_calcCollisionBlockObjects.__begin_;
LABEL_8:
v11[m_innerSectionIndex]->m_innerSectionIndex = m_innerSectionIndex;
return;
}
v13 = a2->m_outerSectionIndex;
v14 = a2->m_middleSectionIndex;
v15 = a1->m_collisionBlockSections.__begin_[v13]->__begin_[v14];
v16 = a1->m_collisionBlockSectionSizes.__begin_[v13]->__begin_;
v17 = v16[v14] - 1LL;
v16[v14] = v17;
v18 = *((_QWORD *)&v15->copyWithZone + v17);
v19 = a2->m_innerSectionIndex;
*((_QWORD *)&v15->copyWithZone + v19) = v18;
*(_DWORD *)(*((_QWORD *)&v15->copyWithZone + v19) + 624LL) = v19;
}
else if ( a2->m_objectType != Decoration )
{
if ( a2->m_hasExtendedCollision )
{
v12 = a1->m_calcNonEffectObjectsSize - 1LL;
a1->m_calcNonEffectObjectsSize = v12;
m_innerSectionIndex = a2->m_innerSectionIndex;
a1->m_calcNonEffectObjects.__begin_[m_innerSectionIndex] = a1->m_calcNonEffectObjects.__begin_[v12];
v11 = a1->m_calcNonEffectObjects.__begin_;
goto LABEL_8;
}
v20 = a2->m_outerSectionIndex;
v21 = a2->m_middleSectionIndex;
v22 = a1->m_nonEffectObjects.__begin_[v20]->__begin_[v21];
v23 = a1->m_nonEffectObjectsSizes.__begin_[v20]->__begin_;
v24 = v23[v21] - 1LL;
v23[v21] = v24;
v25 = v22->__begin_[v24];
v26 = a2->m_innerSectionIndex;
v22->__begin_[v26] = v25;
v22->__begin_[v26]->m_innerSectionIndex = v26;
v27 = a1->m_nonEffectObjectsFlags.__begin_[a2->m_outerSectionIndex]->__begin_;
*(_QWORD *)&v27[((unsigned __int64)a2->m_middleSectionIndex >> 3) & 0x1FFFFFFFFFFFFFF8LL] |= 1LL << a2->m_middleSectionIndex;
}
}
}