//
// LevelEditorLayer::updateEditor from 0x1402d8aa0 to 0x1402d8e63 (963 bytes)
//
// 4 xrefs:
// > LevelEditorLayer::init @ 0x1402d2e1f
// > ??> @ 0x14068e5d0
// > ??> @ 0x14068e628
// > ??> @ 0x1406d31d0
//
// 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::updateEditor(LevelEditorLayer *a1, float a2)
{
float ModifiedDelta; // xmm7_4
bool v4; // al
cocos2d::CCLayer **p_m_aboveShaderObjectLayer; // rbx
cocos2d::CCLayer **p_m_objectLayer; // rsi
EditorUI *m_editorUI; // rax
double m_keyTime; // xmm6_8
float v9; // xmm2_4
_BOOL8 v10; // rdx
_BOOL8 v11; // rdx
float v12; // xmm0_4
cocos2d::CCLayer *m_objectLayer; // rcx
__int64 v14; // rax
cocos2d::CCPoint v15; // rax
__int64 v16; // rax
ShaderLayer *m_shaderLayer; // rax
cocos2d::CCNode *v18; // rsi
cocos2d::CCNode_vtbl *v19; // rbx
unsigned int v20; // eax
char v21; // [rsp+70h] [rbp+8h] BYREF
char v22; // [rsp+80h] [rbp+18h] BYREF
cocos2d::CCPoint v23; // [rsp+88h] [rbp+20h] BYREF
ModifiedDelta = a2;
if ( a1->m_unk3b22 )
{
++a1->m_unk3b24;
a1->m_unk3b22 = 0;
}
v4 = a1->m_playbackMode == Playing;
a1->m_started = v4;
if ( v4 )
{
((void (__fastcall *)(LevelEditorLayer *))a1->update)(a1);
((void (__fastcall *)(DrawGridLayer *))a1->m_drawGridLayer->update)(a1->m_drawGridLayer);
p_m_aboveShaderObjectLayer = &a1->m_aboveShaderObjectLayer;
p_m_objectLayer = &a1->m_objectLayer;
LABEL_26:
m_shaderLayer = a1->m_shaderLayer;
if ( !m_shaderLayer || !m_shaderLayer->m_state.m_usesShaders )
p_m_aboveShaderObjectLayer = p_m_objectLayer;
v18 = *p_m_aboveShaderObjectLayer;
if ( a1->m_drawGridLayer->getParent(a1->m_drawGridLayer) != v18 )
{
cocos2d::CCObject::retain(a1->m_drawGridLayer);
a1->m_drawGridLayer->removeFromParentAndCleanup(a1->m_drawGridLayer, 0);
v19 = v18->__vftable;
v20 = a1->m_drawGridLayer->getZOrder(a1->m_drawGridLayer);
v19->addChild_0(v18, a1->m_drawGridLayer, v20);
cocos2d::CCObject::release(a1->m_drawGridLayer);
}
return;
}
if ( a1->m_resumeTimer <= 0 && a1->m_audioPaused )
{
GJBaseGameLayer::resumeAudio(a1);
a1->m_audioPaused = 0;
}
if ( a1->m_playbackActive )
ModifiedDelta = GJBaseGameLayer::getModifiedDelta(a1, a2);
else
a1->m_extraDelta = 0.0;
if ( ModifiedDelta > 0.0 )
{
m_editorUI = a1->m_editorUI;
a1->m_gameState.m_totalTime = ModifiedDelta + a1->m_gameState.m_totalTime;
if ( m_editorUI )
{
m_keyTime = m_editorUI->m_keyTime;
v9 = sub_14003CF30() - m_keyTime;
if ( v9 < 10.0 )
a1->m_sessionTime = ModifiedDelta + a1->m_sessionTime;
}
a1->m_gameState.m_unkFloat5 = 0.1;
a1->m_gameState.m_unkFloat6 = 0.1;
LevelEditorLayer::updateGameObjects(a1);
((void (__fastcall *)(LevelEditorLayer *))a1->updateVisibility)(a1);
LevelEditorLayer::updateGridLayerParent(a1);
if ( a1->m_inShaderParent->getChildrenCount(a1->m_inShaderParent) > 1
|| a1->m_inShaderObjectLayer->getChildrenCount(a1->m_inShaderObjectLayer) )
{
LOBYTE(v10) = 1;
}
else
{
v10 = 0;
}
a1->m_inShaderParent->setVisible(a1->m_inShaderParent, v10);
if ( a1->m_aboveShaderParent->getChildrenCount(a1->m_aboveShaderParent) > 1
|| (p_m_aboveShaderObjectLayer = &a1->m_aboveShaderObjectLayer,
a1->m_aboveShaderObjectLayer->getChildrenCount(a1->m_aboveShaderObjectLayer)) )
{
LOBYTE(v11) = 1;
p_m_aboveShaderObjectLayer = &a1->m_aboveShaderObjectLayer;
}
else
{
v11 = 0;
}
a1->m_aboveShaderParent->setVisible(a1->m_aboveShaderParent, v11);
GJBaseGameLayer::updateGradientLayers(a1);
GJBaseGameLayer::updateExtraGameLayers(a1);
a1->m_groundLayer2->setVisible(a1->m_groundLayer2, 0);
p_m_objectLayer = &a1->m_objectLayer;
v12 = a1->m_objectLayer->getScale(a1->m_objectLayer);
m_objectLayer = a1->m_objectLayer;
a1->m_gameState.m_cameraZoom = v12;
v14 = (__int64)m_objectLayer->getPosition_0(m_objectLayer);
cocos2d::CCPoint::operator-(v14, &v22, &stru_1406C2140);
cocos2d::CCPoint::operator*(&v22, &v23);
cocos2d::CCPoint::operator-(&a1->m_gameState.m_cameraPosition2, &v21, &v23);
if ( a1->m_gameState.m_cameraZoom != a1->m_gameState.m_unkFloat4 )
cocos2d::CCPoint::operator=(&v21, &a1->m_gameState.m_cameraPosition2);
cocos2d::CCPoint::CCPoint(&v23);
GJBaseGameLayer::updateCameraBGArt(a1, v15, a1->m_gameState.m_cameraZoom);
a1->m_gameState.m_unkFloat4 = a1->m_gameState.m_cameraZoom;
cocos2d::CCPoint::operator=(&a1->m_gameState.m_cameraPosition2, &v21);
v16 = (__int64)(*p_m_objectLayer)->getPosition_0(*p_m_objectLayer);
cocos2d::CCPoint::operator=(&stru_1406C2140, v16);
((void (__fastcall *)(DrawGridLayer *))a1->m_drawGridLayer->update)(a1->m_drawGridLayer);
goto LABEL_26;
}
}