//
// GJBaseGameLayer::removeObjectFromSection from 0x10013e730 to 0x10013e8e8 (440 bytes)
//
// 23 xrefs:
// > PlayLayer::storeCheckpoint @ 0x1000bd198
// > PlayLayer::removeCheckpoint @ 0x1000bd21b
// > LevelEditorLayer::init @ 0x1000dbc79
// > LevelEditorLayer::init @ 0x1000dbc88
// > LevelEditorLayer::removePlayerCollisionBlock @ 0x1000dcc70
// > LevelEditorLayer::removePlayerCollisionBlock @ 0x1000dcc85
// > LevelEditorLayer::removeObject @ 0x1000e2226
// > LevelEditorLayer::removeSpecial @ 0x1000e23c4
// > LevelEditorLayer::removeAllObjects @ 0x1000e274f
// > LevelEditorLayer::removeAllObjectsOfType @ 0x1000e29ba
// > LevelEditorLayer::handleAction @ 0x1000e2c48
// > LevelEditorLayer::handleAction @ 0x1000e2d74
// > LevelEditorLayer::onPausePlaytest @ 0x1000f2b71
// > LevelEditorLayer::onPausePlaytest @ 0x1000f2b80
// > LevelEditorLayer::onStopPlaytest @ 0x1000f2eb5
// > LevelEditorLayer::onStopPlaytest @ 0x1000f2ec4
// > GJBaseGameLayer::updatePlayerCollisionBlocks @ 0x10012ae1e
// > GJBaseGameLayer::updatePlayerCollisionBlocks @ 0x10012aeda
// > GJBaseGameLayer::reorderObjectSection @ 0x10012af0d
// > GJBaseGameLayer::addUIObject @ 0x10013e5a2
// > GJBaseGameLayer::updateExtendedCollision @ 0x10013f885
// > GJBaseGameLayer::updateObjectSection @ 0x100140714
// > SetupObjectOptionsPopup::onDisableObject @ 0x10031a404
//
// 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; // rax
__int64 m_middleSectionIndex; // r8
std::vector *v4; // rcx
std::__vector_base::pointer begin; // rax
__int64 v6; // rdx
std::__vector_base::pointer v7; // rax
GameObject *v8; // rcx
__int64 m_someOtherIndex; // rdx
__int64 m_calcCollisionBlockObjectsSize; // rax
std::__vector_base::pointer v11; // rcx
GameObject *v12; // rax
__int64 m_innerSectionIndex; // rdx
__int64 v14; // rax
std::__vector_base *, std::allocator *>>::pointer v15; // rdx
std::vector *v16; // rcx
__int64 v17; // rdi
__int64 *v18; // rcx
std::__vector_base::pointer v19; // rax
__int64 v20; // rdx
__int64 v21; // rax
__int64 v22; // rcx
__int64 v23; // rdx
__int64 v24; // rax
__int64 v25; // r8
std::vector *v26; // rcx
std::__vector_base::pointer v27; // rax
__int64 v28; // rdx
std::__vector_base::pointer v29; // rax
GameObject *v30; // rcx
__int64 v31; // rdx
std::__vector_base::pointer v32; // rax
m_outerSectionIndex = a2->m_outerSectionIndex;
if ( m_outerSectionIndex >= 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];
begin[m_middleSectionIndex] = v6 - 1;
v7 = v4->__begin_;
v8 = v4->__begin_[v6 - 1];
m_someOtherIndex = a2->m_someOtherIndex;
v7[m_someOtherIndex] = v8;
v8->m_someOtherIndex = m_someOtherIndex;
if ( a2->m_objectID == 1816 )
{
if ( a2->m_hasExtendedCollision )
{
m_calcCollisionBlockObjectsSize = a1->m_calcCollisionBlockObjectsSize;
a1->m_calcCollisionBlockObjectsSize = m_calcCollisionBlockObjectsSize - 1;
v11 = a1->m_calcCollisionBlockObjects.__begin_;
LABEL_8:
v12 = v11[m_calcCollisionBlockObjectsSize - 1];
m_innerSectionIndex = a2->m_innerSectionIndex;
v11[m_innerSectionIndex] = v12;
v12->m_innerSectionIndex = m_innerSectionIndex;
return;
}
v14 = a2->m_outerSectionIndex;
v15 = a1->m_collisionBlockSectionSizes.__begin_;
v16 = a1->m_collisionBlockSections.__begin_[v14];
v17 = a2->m_middleSectionIndex;
v18 = (__int64 *)v16->__begin_[v17];
v19 = v15[v14]->__begin_;
v20 = v19[v17];
v19[v17] = v20 - 1;
v21 = *v18;
v22 = *(_QWORD *)(*v18 + 8 * v20 - 8);
v23 = a2->m_innerSectionIndex;
*(_QWORD *)(v21 + 8 * v23) = v22;
*(_DWORD *)(v22 + 624) = v23;
}
else
{
if ( a2->m_objectType == Decoration )
return;
if ( a2->m_hasExtendedCollision )
{
m_calcCollisionBlockObjectsSize = a1->m_calcNonEffectObjectsSize;
a1->m_calcNonEffectObjectsSize = m_calcCollisionBlockObjectsSize - 1;
v11 = a1->m_calcNonEffectObjects.__begin_;
goto LABEL_8;
}
v24 = a2->m_outerSectionIndex;
v25 = a2->m_middleSectionIndex;
v26 = a1->m_nonEffectObjects.__begin_[v24]->__begin_[v25];
v27 = a1->m_nonEffectObjectsSizes.__begin_[v24]->__begin_;
v28 = v27[v25];
v27[v25] = v28 - 1;
v29 = v26->__begin_;
v30 = v26->__begin_[v28 - 1];
v31 = a2->m_innerSectionIndex;
v29[v31] = v30;
v30->m_innerSectionIndex = v31;
v32 = a1->m_nonEffectObjectsFlags.__begin_[a2->m_outerSectionIndex]->__begin_;
*(_QWORD *)&v32[8 * ((unsigned __int64)a2->m_middleSectionIndex >> 6)] |= 1LL << a2->m_middleSectionIndex;
}
}
}