//
// LevelEditorLayer::updateDisabledObjectsLastPos from 0x1000f1f70 to 0x1000f218e (542 bytes)
//
// 1 xrefs:
// > ??> @ 0x1008c06c8
//
// 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 LevelEditorLayer::updateDisabledObjectsLastPos(LevelEditorLayer *a1, cocos2d::CCArray *a2)
{
cocos2d::ccArray *data; // rax
GameObject **arr; // r13
GameObject **v4; // r11
GameObject *v5; // r12
unsigned int m_commandIndex; // eax
int m_disabledObjectsCount; // r9d
int m_disabledObjectsIndex; // r10d
std::__vector_base::pointer end; // r14
GameObject **value; // rax
GameObject **v11; // r15
std::__vector_base::pointer begin; // rsi
signed __int64 v13; // r14
__int64 v14; // rax
unsigned __int64 v15; // r15
GameObject **v16; // rax
GameObject **v17; // r12
__int64 v18; // [rsp+8h] [rbp-48h]
GameObject **v19; // [rsp+10h] [rbp-40h]
int v20; // [rsp+18h] [rbp-38h]
int v21; // [rsp+1Ch] [rbp-34h]
GameObject **__p; // [rsp+20h] [rbp-30h]
if ( a2 )
{
if ( !a1->m_startOptimization )
{
data = a2->data;
if ( data->num )
{
arr = (GameObject **)data->arr;
v4 = &arr[data->num - 1];
do
{
v5 = *arr;
if ( !*arr )
break;
if ( v5->m_isDecoration2 )
{
m_commandIndex = a1->m_gameState.m_commandIndex;
if ( v5->m_unk4C4 != m_commandIndex )
{
v5->m_unk4C4 = m_commandIndex;
m_disabledObjectsCount = a1->m_disabledObjectsCount;
m_disabledObjectsIndex = a1->m_disabledObjectsIndex;
if ( m_disabledObjectsIndex > m_disabledObjectsCount )
{
a1->m_disabledObjects.__begin_[m_disabledObjectsCount] = v5;
}
else
{
end = a1->m_disabledObjects.__end_;
value = a1->m_disabledObjects.__end_cap_.__value_;
if ( end >= value )
{
begin = a1->m_disabledObjects.__begin_;
v13 = (char *)end - (char *)begin;
v18 = v13 >> 3;
if ( (unsigned __int64)((v13 >> 3) + 1) >> 61 )
sub_1000CACE0();
v14 = (char *)value - (char *)begin;
v15 = v14 >> 2;
if ( v14 >> 2 <= (unsigned __int64)((v13 >> 3) + 1) )
v15 = (v13 >> 3) + 1;
if ( (unsigned __int64)v14 >= 0x7FFFFFFFFFFFFFF8LL )
v15 = 0x1FFFFFFFFFFFFFFFLL;
v19 = v4;
v20 = a1->m_disabledObjectsCount;
v21 = a1->m_disabledObjectsIndex;
if ( v15 )
{
if ( v15 > 0x1FFFFFFFFFFFFFFFLL )
sub_100054850();
v16 = (GameObject **)operator new(8 * v15);
}
else
{
v16 = nullptr;
}
__p = &v16[v15];
v16[v18] = v5;
v11 = &v16[v18 + 1];
v17 = v16;
memcpy(v16, begin, v13);
a1->m_disabledObjects.__begin_ = v17;
a1->m_disabledObjects.__end_ = v11;
a1->m_disabledObjects.__end_cap_.__value_ = __p;
if ( begin )
{
operator delete(begin);
m_disabledObjectsCount = a1->m_disabledObjectsCount;
m_disabledObjectsIndex = a1->m_disabledObjectsIndex;
v4 = v19;
}
else
{
v4 = v19;
m_disabledObjectsCount = v20;
m_disabledObjectsIndex = v21;
}
}
else
{
*end = v5;
v11 = end + 1;
}
a1->m_disabledObjects.__end_ = v11;
a1->m_disabledObjectsIndex = m_disabledObjectsIndex + 1;
}
a1->m_disabledObjectsCount = m_disabledObjectsCount + 1;
}
}
++arr;
}
while ( arr <= v4 );
}
}
}
}