//
// LevelEditorLayer::updateEditorMode from 0x462778 to 0x462956 (478 bytes)
//
// 4 xrefs:
// > LevelEditorLayer::init @ 0x476606
// > EditorPauseLayer::toggleEditorColorMode @ 0x508f20
// > MapSelectLayer::init @ 0x640f1a
// > EditorUI::toggleViewOption @ 0x70c40e
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:48:53 +0000
//
unsigned int __fastcall LevelEditorLayer::updateEditorMode(LevelEditorLayer *this)
{
int v2; // r0
GameManager *v3; // r0
char *v4; // r8
int v5; // r7
GJGroundLayer *i; // r5
int v7; // r0
void (__fastcall *v8)(int, int *); // r2
char shouldBlend; // r1
int v10; // r0
_DWORD *v11; // r7
unsigned int j; // r6
_DWORD *v13; // r1
int v14; // r3
int v15; // r5
int k; // r8
_DWORD *v17; // r2
int v18; // r9
int v19; // r10
unsigned int v20; // r5
cocos2d::CCArray *AllObjects; // r6
int v23; // r0
int v24; // [sp+0h] [bp-24h]
_DWORD *v25; // [sp+8h] [bp-1Ch]
int v26; // [sp+Ch] [bp-18h]
int v27; // [sp+14h] [bp-10h]
int v28; // [sp+18h] [bp-Ch] BYREF
v2 = *((unsigned __int8 *)this + 11886);
if ( !v2 )
{
v3 = (GameManager *)GameManager::sharedState(nullptr);
LOBYTE(v2) = GameManager::getGameVariable(v3, "0036");
}
*((_BYTE *)this + 11885) = v2;
*((_BYTE *)this + 11884) = 1;
v4 = (char *)this + 11885;
v5 = 0;
(*(void (__fastcall **)(_DWORD, char *))(**((_DWORD **)this + 612) + 480))(*((_DWORD *)this + 612), &byte_BEBC8B);
for ( i = *((GJGroundLayer **)this + 614); ; i = *((GJGroundLayer **)this + 615) )
{
GJGroundLayer::updateGround01Color(i, 10921638);
GJGroundLayer::updateGround02Color(i, 10921638);
v7 = *((_DWORD *)i + 82);
v8 = *(void (__fastcall **)(int, int *))(*(_DWORD *)v7 + 480);
LOWORD(v28) = -7711;
BYTE2(v28) = -31;
v8(v7, &v28);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)i + 82) + 456))(*((_DWORD *)i + 82), 255);
shouldBlend = *v4;
if ( *v4 )
shouldBlend = LevelEditorLayer::shouldBlend(this, 1002);
GJGroundLayer::updateLineBlend(i, shouldBlend);
if ( v5 )
break;
v5 = 1;
}
v10 = *((_DWORD *)this + 616);
if ( v10 )
{
LOWORD(v27) = 25700;
BYTE2(v27) = 100;
GJMGLayer::updateGroundColor(v10, v27, v5);
LOWORD(v28) = -26986;
BYTE2(v28) = -106;
GJMGLayer::updateGroundColor(*((_DWORD *)this + 616), v28, 0);
}
v11 = (_DWORD *)((char *)this + 11292);
for ( j = 0; j < (*((_DWORD *)this + 2824) - *((_DWORD *)this + 2823)) >> 2; ++j )
{
v13 = *(_DWORD **)(*v11 + 4 * j);
v14 = 4 * j;
if ( v13 )
v15 = (v13[1] - *v13) >> 2;
else
v15 = -1;
for ( k = 0; k < v15; ++k )
{
v17 = *(_DWORD **)(**(_DWORD **)(*v11 + v14) + 4 * k);
if ( v17 )
{
v18 = 0;
v24 = *(_DWORD *)(**(_DWORD **)(*((_DWORD *)this + 2844) + v14) + 4 * k);
while ( v18 < v24 )
{
v26 = v14;
v25 = v17;
v19 = *(_DWORD *)(*v17 + 4 * v18++);
(*(void (__fastcall **)(int))(*(_DWORD *)v19 + 688))(v19);
(*(void (__fastcall **)(int))(*(_DWORD *)v19 + 644))(v19);
v14 = v26;
v17 = v25;
}
}
}
}
v20 = *((unsigned __int8 *)this + 11885);
if ( !*((_BYTE *)this + 11885) )
{
AllObjects = (cocos2d::CCArray *)LevelEditorLayer::getAllObjects(this);
while ( v20 < cocos2d::CCArray::count(AllObjects) )
{
v23 = cocos2d::CCArray::objectAtIndex(AllObjects, v20++);
*(_BYTE *)(v23 + 1005) = 1;
}
}
LevelEditorLayer::resetToggledGroups(this);
return LevelEditorLayer::updatePreviewParticles(this);
}