//
// LevelEditorLayer::updateEditorMode from 0x6624e0 to 0x6627b4 (724 bytes)
//
// 5 xrefs:
// > LevelEditorLayer::init @ 0x67cb6c
// > EditorUI::keyDown @ 0x6c64b0
// > EditorPauseLayer::toggleEditorColorMode @ 0x78ad24
// > MapSelectLayer::init @ 0x98095c
// > ??> @ 0x88308
//
// 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)
{
float *v2; // x27
bool m_alwaysPreviewMode; // w1
cocos2d::CCSprite *m_background; // x0
_BOOL4 v5; // w21
cocos2d::CCSprite_vtbl *v6; // x2
char *v7; // x24
GJGroundLayer *m_groundLayer; // x19
cocos2d::CCSprite *m_lineSprite; // x0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
char shouldBlend; // w1
GJMGLayer *m_middleground; // x0
std::vector *, std::allocator *>> **m_start; // x19
unsigned __int64 v14; // x26
std::vector *, std::allocator *>> **m_finish; // x2
std::vector *, std::allocator *>> *v16; // x1
__int64 v17; // x1
unsigned __int64 v18; // x22
__int64 v19; // x24
std::vector *v20; // x28
int v21; // w21
unsigned __int64 v22; // x20
__int64 v23; // x21
GameObject *v24; // x19
unsigned int v25; // w19
cocos2d::CCArray *i; // x20
unsigned int v27; // w1
GameManager *v28; // x0
cocos2d::ccColor3B v29; // [xsp+68h] [xbp+68h]
__int64 v30; // [xsp+70h] [xbp+70h] BYREF
v2 = &a1->m_varianceValues.__elems_[1975];
m_alwaysPreviewMode = a1->m_alwaysPreviewMode;
if ( !m_alwaysPreviewMode )
{
v28 = GameManager::sharedState();
m_alwaysPreviewMode = GameManager::getGameVariable(v28, "0036");
}
m_background = a1->m_background;
*((_BYTE *)v2 + 2225) = m_alwaysPreviewMode;
v5 = 0;
v6 = m_background->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
*((_BYTE *)v2 + 2224) = 1;
v7 = (char *)v2 + 2225;
((void (__fastcall *)(cocos2d::CCSprite *))v6->setColor)(m_background);
m_groundLayer = a1->m_groundLayer;
while ( 1 )
{
GJGroundLayer::updateGround01Color(m_groundLayer, (cocos2d::ccColor3B)-5855578);
GJGroundLayer::updateGround02Color(m_groundLayer, (cocos2d::ccColor3B)-5855578);
m_lineSprite = m_groundLayer->m_lineSprite;
setColor = m_lineSprite->setColor;
LOWORD(v30) = -7711;
BYTE2(v30) = -31;
setColor(m_lineSprite, (const cocos2d::ccColor3B *)&v30);
m_groundLayer->m_lineSprite->setOpacity(m_groundLayer->m_lineSprite, 0xFFFFFFFFLL);
shouldBlend = *v7;
if ( *v7 )
shouldBlend = LevelEditorLayer::shouldBlend(a1, 1002);
GJGroundLayer::updateLineBlend(m_groundLayer, shouldBlend);
if ( v5 )
break;
m_groundLayer = a1->m_groundLayer2;
v5 = 1;
}
m_middleground = a1->m_middleground;
if ( m_middleground )
{
*(_WORD *)&v29.r = 25700;
v29.b = 100;
GJMGLayer::updateGroundColor(m_middleground, v29, v5);
LOWORD(v30) = -26986;
BYTE2(v30) = -106;
GJMGLayer::updateGroundColor(a1->m_middleground, (cocos2d::ccColor3B)v30, 0);
}
m_start = a1->m_sections.m_start;
v14 = 0;
m_finish = a1->m_sections.m_finish;
if ( m_finish - m_start )
{
do
{
v16 = m_start[v14];
if ( v16 )
{
v17 = v16->m_finish - v16->m_start;
if ( (int)v17 > 0 )
{
v18 = 0;
v19 = 4 * ((unsigned int)(v17 - 1) + 1LL);
do
{
v20 = m_start[v14]->m_start[v18 / 4];
if ( v20 )
{
v21 = a1->m_sectionSizes.m_start[v14]->m_start[v18 / 4];
if ( v21 > 0 )
{
v22 = 0;
v23 = 8 * ((unsigned int)(v21 - 1) + 1LL);
do
{
v24 = v20->m_start[v22 / 8];
v22 += 8LL;
v24->updateStartValues(v24);
v24->resetObject(v24);
}
while ( v22 != v23 );
m_start = a1->m_sections.m_start;
}
}
v18 += 4LL;
}
while ( v18 != v19 );
m_finish = a1->m_sections.m_finish;
}
}
++v14;
}
while ( v14 < m_finish - m_start );
}
if ( !*((_BYTE *)v2 + 2225) )
{
v25 = 0;
for ( i = LevelEditorLayer::getAllObjects(a1);
v25 < (unsigned int)cocos2d::CCArray::count(i);
*(_BYTE *)(cocos2d::CCArray::objectAtIndex(i, v27) + 1133) = 1 )
{
v27 = v25++;
}
}
LevelEditorLayer::resetToggledGroups(a1);
LevelEditorLayer::updatePreviewParticles(a1);
}