//
// LevelEditorLayer::updateEditorMode from 0x369030 to 0x36920e (478 bytes)
//
// 4 xrefs:
// > LevelEditorLayer::init @ 0x376cd0
// > EditorUI::keyDown @ 0x3a74da
// > EditorPauseLayer::toggleEditorColorMode @ 0x3ff400
// > MapSelectLayer::init @ 0x50fab6
//
// 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 LevelEditorLayer::updateEditorMode(LevelEditorLayer *a1)
{
_BOOL4 m_alwaysPreviewMode; // r0
GameManager *v3; // r0
cocos2d::CCSprite *m_background; // r0
bool *p_m_previewMode; // r8
_BOOL4 v6; // r7
GJGroundLayer *i; // r5
cocos2d::CCSprite *m_lineSprite; // r0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r2
bool shouldBlend; // r1
GJMGLayer *m_middleground; // r0
unsigned int v12; // r6
std::vector *, std::allocator *>> *, std::allocator *, std::allocator *>> *>> *p_m_sections; // r7
std::vector *, std::allocator *>> *v14; // r2
int v15; // r5
std::vector *, std::allocator *>> *p_m_sectionSizes; // r2
int j; // r8
std::vector *v18; // r3
int v19; // r9
GameObject *v20; // r10
unsigned int m_previewMode; // r5
cocos2d::CCArray *AllObjects; // r6
int v23; // r0
int v24; // [sp+0h] [bp-24h]
std::vector *v25; // [sp+8h] [bp-1Ch]
std::vector *, std::allocator *>> *v26; // [sp+Ch] [bp-18h]
cocos2d::ccColor3B v27; // [sp+14h] [bp-10h]
int v28; // [sp+18h] [bp-Ch] BYREF
m_alwaysPreviewMode = a1->m_alwaysPreviewMode;
if ( !m_alwaysPreviewMode )
{
v3 = GameManager::sharedState();
LOBYTE(m_alwaysPreviewMode) = GameManager::getGameVariable(v3, "0036");
}
a1->m_previewMode = m_alwaysPreviewMode;
m_background = a1->m_background;
a1->m_updateColorSprites = 1;
p_m_previewMode = &a1->m_previewMode;
v6 = 0;
m_background->setColor(m_background, (const cocos2d::ccColor3B *)&byte_9AA6C3);
for ( i = a1->m_groundLayer; ; i = a1->m_groundLayer2 )
{
GJGroundLayer::updateGround01Color(i, (cocos2d::ccColor3B)-5855578);
GJGroundLayer::updateGround02Color(i, (cocos2d::ccColor3B)-5855578);
m_lineSprite = i->m_lineSprite;
setColor = m_lineSprite->setColor;
LOWORD(v28) = -7711;
BYTE2(v28) = -31;
setColor(m_lineSprite, (const cocos2d::ccColor3B *)&v28);
i->m_lineSprite->setOpacity(i->m_lineSprite, 255);
shouldBlend = *p_m_previewMode;
if ( *p_m_previewMode )
shouldBlend = LevelEditorLayer::shouldBlend(a1, 1002);
GJGroundLayer::updateLineBlend(i, shouldBlend);
if ( v6 )
break;
v6 = 1;
}
m_middleground = a1->m_middleground;
if ( m_middleground )
{
*(_WORD *)&v27.r = 25700;
v27.b = 100;
GJMGLayer::updateGroundColor(m_middleground, v27, v6);
LOWORD(v28) = -26986;
BYTE2(v28) = -106;
GJMGLayer::updateGroundColor(a1->m_middleground, (cocos2d::ccColor3B)v28, 0);
}
v12 = 0;
p_m_sections = &a1->m_sections;
while ( v12 < a1->m_sections.m_finish - a1->m_sections.m_start )
{
v14 = p_m_sections->m_start[v12];
if ( v14 )
v15 = v14->m_finish - v14->m_start;
else
v15 = -1;
p_m_sectionSizes = &a1->m_sectionSizes;
for ( j = 0; j < v15; ++j )
{
v18 = p_m_sections->m_start[v12]->m_start[j];
if ( v18 )
{
v19 = 0;
v24 = p_m_sectionSizes->m_start[v12]->m_start[j];
while ( v19 < v24 )
{
v26 = p_m_sectionSizes;
v25 = v18;
v20 = v18->m_start[v19++];
v20->updateStartValues(v20);
v20->resetObject(v20);
p_m_sectionSizes = v26;
v18 = v25;
}
}
}
++v12;
}
m_previewMode = a1->m_previewMode;
if ( !a1->m_previewMode )
{
AllObjects = LevelEditorLayer::getAllObjects(a1);
while ( m_previewMode < cocos2d::CCArray::count(AllObjects) )
{
v23 = cocos2d::CCArray::objectAtIndex(AllObjects, m_previewMode++);
*(_BYTE *)(v23 + 997) = 1;
}
}
LevelEditorLayer::resetToggledGroups(a1);
LevelEditorLayer::updatePreviewParticles(a1);
}