//
// LevelEditorLayer::updateEditorMode from 0x1000de890 to 0x1000debd3 (835 bytes)
//
// 4 xrefs:
// > EditorUI::keyDown @ 0x100050923
// > LevelEditorLayer::init @ 0x1000dc0eb
// > MapSelectLayer::init @ 0x100268552
// > EditorPauseLayer::toggleEditorColorMode @ 0x1002941aa
//
// 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::updateEditorMode(LevelEditorLayer *a1)
{
LevelEditorLayer *v1; // rbx
bool GameVariable; // al
GameManager *v3; // rax
GJGroundLayer *m_groundLayer; // r14
cocos2d::CCSprite *m_lineSprite; // rdi
bool v6; // al
GJGroundLayer *m_groundLayer2; // r14
cocos2d::CCSprite *v8; // rdi
bool v9; // al
GJMGLayer *m_middleground; // rdi
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer begin; // rax
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer end; // rcx
unsigned __int64 v13; // rsi
std::vector *, std::allocator *>> *v14; // rdx
unsigned __int64 v15; // rdi
__int64 v16; // r13
std::vector *v17; // rbx
__int64 v18; // r12
__int64 i; // r15
GameObject *v20; // r14
cocos2d::CCArray *m_objects; // r14
unsigned int v22; // r15d
unsigned __int64 j; // rax
unsigned __int64 v24; // rsi
unsigned __int64 v25; // [rsp+10h] [rbp-40h]
LevelEditorLayer *v26; // [rsp+18h] [rbp-38h]
__int16 v27; // [rsp+24h] [rbp-2Ch] BYREF
char v28; // [rsp+26h] [rbp-2Ah]
v1 = a1;
GameVariable = 1;
if ( !a1->m_alwaysPreviewMode )
{
v3 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v3, "0036");
}
a1->m_previewMode = GameVariable;
a1->m_updateColorSprites = 1;
((void (__fastcall *)(cocos2d::CCSprite *, void *))a1->m_background->setColor)(a1->m_background, &unk_100816676);
m_groundLayer = a1->m_groundLayer;
GJGroundLayer::updateGround01Color(m_groundLayer, (cocos2d::ccColor3B)-5855578);
GJGroundLayer::updateGround02Color(m_groundLayer, (cocos2d::ccColor3B)-5855578);
m_lineSprite = m_groundLayer->m_lineSprite;
v28 = -31;
v27 = -7711;
((void (__fastcall *)(cocos2d::CCSprite *, __int16 *))m_lineSprite->setColor)(m_lineSprite, &v27);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))m_groundLayer->m_lineSprite->setOpacity)(
m_groundLayer->m_lineSprite,
255);
v6 = v1->m_previewMode && (*((_QWORD *)v1->m_blendingColors.__begin_ + 15) & 0x40000000000LL) != 0;
GJGroundLayer::updateLineBlend(m_groundLayer, v6);
m_groundLayer2 = v1->m_groundLayer2;
GJGroundLayer::updateGround01Color(m_groundLayer2, (cocos2d::ccColor3B)-5855578);
GJGroundLayer::updateGround02Color(m_groundLayer2, (cocos2d::ccColor3B)-5855578);
v8 = m_groundLayer2->m_lineSprite;
v28 = -31;
v27 = -7711;
((void (__fastcall *)(cocos2d::CCSprite *, __int16 *))v8->setColor)(v8, &v27);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))m_groundLayer2->m_lineSprite->setOpacity)(
m_groundLayer2->m_lineSprite,
255);
v9 = v1->m_previewMode && (*((_QWORD *)v1->m_blendingColors.__begin_ + 15) & 0x40000000000LL) != 0;
GJGroundLayer::updateLineBlend(m_groundLayer2, v9);
m_middleground = v1->m_middleground;
if ( m_middleground )
{
GJMGLayer::updateGroundColor(m_middleground, (cocos2d::ccColor3B)6579300, 1);
GJMGLayer::updateGroundColor(v1->m_middleground, (cocos2d::ccColor3B)-6908266, 0);
}
begin = v1->m_sections.__begin_;
end = v1->m_sections.__end_;
if ( end != begin )
{
v13 = 0;
v26 = v1;
do
{
v14 = begin[v13];
if ( v14 )
{
v15 = (unsigned __int64)((char *)v14->__end_ - (char *)v14->__begin_) >> 3;
if ( (int)v15 > 0 )
{
v16 = 0;
v25 = v13;
do
{
v17 = v1->m_sections.__begin_[v13]->__begin_[v16];
if ( v17 )
{
v18 = v26->m_sectionSizes.__begin_[v25]->__begin_[v16];
if ( v18 > 0 )
{
for ( i = 0; i != v18; ++i )
{
v20 = v17->__begin_[i];
((void (__fastcall *)(GameObject *))v20->updateStartValues)(v20);
((void (__fastcall *)(GameObject *))v20->resetObject)(v20);
}
}
}
++v16;
v1 = v26;
v13 = v25;
}
while ( v16 != (v15 & 0x7FFFFFFF) );
begin = v26->m_sections.__begin_;
end = v26->m_sections.__end_;
}
}
++v13;
}
while ( end - begin > v13 );
}
if ( !v1->m_previewMode )
{
m_objects = v1->m_objects;
if ( (unsigned int)sub_100720070(m_objects) )
{
v22 = 0;
do
*(_BYTE *)(sub_1007200C0(m_objects, v22++) + 1149) = 1;
while ( v22 < (unsigned int)sub_100720070(m_objects) );
}
}
for ( j = 0; j != 10000; j += 2LL )
{
v1->m_toggledGroupStates.__begin_[j] = 0;
v24 = j >> 6;
*(_QWORD *)&v1->m_toggledGroups.__begin_[8 * v24] &= __ROL8__(-2, j & 0x3E);
v1->m_toggledGroupStates.__begin_[j + 1] = 0;
*(_QWORD *)&v1->m_toggledGroups.__begin_[8 * v24] &= __ROL8__(-2, (unsigned __int8)j + 1);
}
LevelEditorLayer::updatePreviewParticles(v1);
}