//
// EditorUI::updateButtons from 0x1003e5a80 to 0x1003e6070 (1520 bytes)
//
// 21 xrefs:
// > EditorUI::init @ 0x1003c6ca8
// > EditorUI::undoLastAction @ 0x1003c7480
// > EditorUI::redoLastAction @ 0x1003c74e4
// > EditorUI::onDeleteSelected @ 0x1003c7688
// > EditorUI::onStickyToggle @ 0x1003c7b4c
// > EditorUI::onGroupSticky @ 0x1003c7b84
// > EditorUI::onUngroupSticky @ 0x1003c7bc8
// > EditorUI::onDuplicate @ 0x1003e47b4
// > EditorUI::onCopyState @ 0x1003e5778
// > EditorUI::clickOnPosition @ 0x1003e683c
// > EditorUI::onDeleteSelectedType @ 0x1003e91a8
// > EditorUI::deselectAll @ 0x1003e9d30
// > EditorUI::selectAll @ 0x1003ee148
// > EditorUI::selectAllWithDirection @ 0x1003ee35c
// > EditorUI::doCopyObjects @ 0x1003eeb70
// > EditorUI::doPasteObjects @ 0x1003eed60
// > EditorUI::createSmartObjectsFromTemplate @ 0x1003f1e6c
// > EditorUI::createSmartObjectsFromType @ 0x1003f28dc
// > EditorUI::moveObjectCall_1 @ 0x1003f6090
// > EditorUI::ccTouchEnded @ 0x1003f9740
// > EditorUI::keyDown @ 0x1003fa3f0
//
// 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 EditorUI::updateButtons(EditorUI *a1)
{
CCMenuItemSpriteExtra *m_deselectBtn; // x0
int v3; // w8
__int16 *v4; // x20
__int64 v5; // x21
__int64 v6; // x22
_BOOL4 hasAction; // w0
CCMenuItemSpriteExtra *m_undoBtn; // x8
__int16 *v9; // x1
__int64 v10; // x23
ButtonSprite *v11; // x0
CCMenuItemSpriteExtra *m_trashBtn; // x0
_BOOL4 v13; // w0
CCMenuItemSpriteExtra *m_redoBtn; // x8
__int16 *v15; // x1
__int64 v16; // x23
CCMenuItemSpriteExtra *m_editGroupBtn; // x0
GameObject *m_selectedObject; // x8
CCMenuItemSpriteExtra *m_copyValuesBtn; // x0
__int16 *v20; // x1
__int64 v21; // x20
CCMenuItemSpriteExtra *m_goToLayerBtn; // x0
__int16 *v23; // x1
__int64 v24; // x20
GameObject *v25; // x8
CCMenuItemSpriteExtra *v26; // x0
__int16 *v27; // x1
__int64 v28; // x20
GameManager *v29; // x0
CCMenuItemSpriteExtra *m_pasteStateBtn; // x0
char v31; // w22
__int16 *v32; // x21
__int64 v33; // x20
EditorUI *v34; // x0
EditorUI *v35; // x0
int v36; // w8
int v37; // w8
CCMenuItemSpriteExtra *m_pasteColorBtn; // x0
__int64 v39; // x20
cocos2d::CCSpriteFrameCache *v40; // x0
const char *v41; // x1
cocos2d::CCSpriteFrame *v42; // x0
__int64 v43; // x1
_BOOL4 m_linkControlsDisabled; // w20
_BOOL4 v45; // w8
int v46; // w21
CCMenuItemSpriteExtra *m_linkBtn; // x0
__int16 *v48; // x1
unsigned __int8 v49; // w20
unsigned __int8 v50; // w8
CCMenuItemSpriteExtra **p_m_unlinkBtn; // x21
CCMenuItemSpriteExtra *m_unlinkBtn; // x0
__int16 *v53; // x1
GameObject *v54; // x8
int m_linkedGroup; // w8
cocos2d::CCArray *m_selectedObjects; // x8
cocos2d::ccArray *data; // x8
__int64 num; // x9
unsigned __int64 arr; // x8
unsigned __int64 v60; // x9
EditorUI::toggleEditObjectButton(a1);
EditorUI::toggleDuplicateButton(a1);
((void (__fastcall *)(cocos2d::CCMenu *, bool))a1->m_deleteMenu->setVisible)(
a1->m_deleteMenu,
a1->m_selectedMode == 1);
EditorUI::updateDeleteButtons(a1);
EditorUI::toggleSpecialEditButtons(a1);
if ( a1->m_selectedObject )
{
m_deselectBtn = a1->m_deselectBtn;
m_deselectBtn->m_animationEnabled = 1;
LABEL_4:
v4 = &word_100647392;
v5 = 1;
goto LABEL_5;
}
v3 = sub_10024A36C((__int64)a1->m_selectedObjects);
m_deselectBtn = a1->m_deselectBtn;
m_deselectBtn->m_animationEnabled = v3 != 0;
if ( v3 )
goto LABEL_4;
v5 = 0;
v4 = &word_100647395;
LABEL_5:
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int16 *))m_deselectBtn->setColor)(m_deselectBtn, v4);
if ( (_DWORD)v5 )
v6 = 255;
else
v6 = 175;
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_deselectBtn->setOpacity)(a1->m_deselectBtn, v6);
hasAction = LevelEditorLayer::hasAction(a1->m_editorLayer, 1);
m_undoBtn = a1->m_undoBtn;
m_undoBtn->m_animationEnabled = hasAction;
if ( hasAction )
v9 = &word_100647392;
else
v9 = &word_100647395;
if ( hasAction )
v10 = 255;
else
v10 = 175;
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int16 *))m_undoBtn->setColor)(m_undoBtn, v9);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_undoBtn->setOpacity)(a1->m_undoBtn, v10);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_deleteButton->setEnabled)(a1->m_deleteButton, v5);
v11 = (ButtonSprite *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_deleteButton->getNormalImage)(a1->m_deleteButton);
ButtonSprite::setColor(v11, (cocos2d::ccColor3B)((unsigned __int16)*v4 | (*((unsigned __int8 *)v4 + 2) << 16)));
m_trashBtn = a1->m_trashBtn;
m_trashBtn->m_animationEnabled = v5;
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int16 *))m_trashBtn->setColor)(m_trashBtn, v4);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_trashBtn->setOpacity)(a1->m_trashBtn, v6);
v13 = LevelEditorLayer::hasAction(a1->m_editorLayer, 0);
m_redoBtn = a1->m_redoBtn;
m_redoBtn->m_animationEnabled = v13;
if ( v13 )
v15 = &word_100647392;
else
v15 = &word_100647395;
if ( v13 )
v16 = 255;
else
v16 = 175;
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int16 *))m_redoBtn->setColor)(m_redoBtn, v15);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_redoBtn->setOpacity)(a1->m_redoBtn, v16);
m_editGroupBtn = a1->m_editGroupBtn;
m_editGroupBtn->m_animationEnabled = v5;
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int16 *))m_editGroupBtn->setColor)(m_editGroupBtn, v4);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_editGroupBtn->setOpacity)(a1->m_editGroupBtn, v6);
m_selectedObject = a1->m_selectedObject;
m_copyValuesBtn = a1->m_copyValuesBtn;
m_copyValuesBtn->m_animationEnabled = m_selectedObject != nullptr;
if ( m_selectedObject )
v20 = &word_100647392;
else
v20 = &word_100647395;
if ( m_selectedObject )
v21 = 255;
else
v21 = 175;
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int16 *))m_copyValuesBtn->setColor)(m_copyValuesBtn, v20);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_copyValuesBtn->setOpacity)(a1->m_copyValuesBtn, v21);
if ( a1->m_selectedObject )
goto LABEL_27;
v34 = (EditorUI *)sub_10024A36C((__int64)a1->m_selectedObjects);
if ( (_DWORD)v34 )
{
v35 = (EditorUI *)EditorUI::editorLayerForArray(v34, a1->m_selectedObjects, 0);
if ( (int)v35 >= 1 )
{
LABEL_27:
m_goToLayerBtn = a1->m_goToLayerBtn;
m_goToLayerBtn->m_animationEnabled = 1;
LABEL_28:
v23 = &word_100647392;
v24 = 255;
goto LABEL_29;
}
v36 = EditorUI::editorLayerForArray(v35, a1->m_selectedObjects, 1);
m_goToLayerBtn = a1->m_goToLayerBtn;
m_goToLayerBtn->m_animationEnabled = v36 > 0;
if ( v36 >= 1 )
goto LABEL_28;
}
else
{
m_goToLayerBtn = a1->m_goToLayerBtn;
m_goToLayerBtn->m_animationEnabled = 0;
}
v23 = &word_100647395;
v24 = 175;
LABEL_29:
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int16 *))m_goToLayerBtn->setColor)(m_goToLayerBtn, v23);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_goToLayerBtn->setOpacity)(a1->m_goToLayerBtn, v24);
v25 = a1->m_selectedObject;
v26 = a1->m_copyValuesBtn;
v26->m_animationEnabled = v25 != nullptr;
if ( v25 )
v27 = &word_100647392;
else
v27 = &word_100647395;
if ( v25 )
v28 = 255;
else
v28 = 175;
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int16 *))v26->setColor)(v26, v27);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_copyValuesBtn->setOpacity)(a1->m_copyValuesBtn, v28);
v29 = GameManager::sharedState();
if ( !LevelEditorLayer::canPasteState(v29->m_levelEditorLayer) )
{
v31 = 0;
m_pasteStateBtn = a1->m_pasteStateBtn;
m_pasteStateBtn->m_animationEnabled = 0;
goto LABEL_39;
}
if ( !a1->m_selectedObject )
{
v37 = sub_10024A36C((__int64)a1->m_selectedObjects);
m_pasteStateBtn = a1->m_pasteStateBtn;
m_pasteStateBtn->m_animationEnabled = v37 != 0;
if ( v37 )
goto LABEL_45;
v31 = 0;
LABEL_39:
v32 = &word_100647395;
v33 = 175;
goto LABEL_46;
}
m_pasteStateBtn = a1->m_pasteStateBtn;
m_pasteStateBtn->m_animationEnabled = 1;
LABEL_45:
v32 = &word_100647392;
v33 = 255;
v31 = 1;
LABEL_46:
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int16 *))m_pasteStateBtn->setColor)(m_pasteStateBtn, v32);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_pasteStateBtn->setOpacity)(a1->m_pasteStateBtn, v33);
m_pasteColorBtn = a1->m_pasteColorBtn;
m_pasteColorBtn->m_animationEnabled = v31;
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int16 *))m_pasteColorBtn->setColor)(m_pasteColorBtn, v32);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_pasteColorBtn->setOpacity)(a1->m_pasteColorBtn, v33);
if ( a1->m_stickyControlsEnabled )
{
v39 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_enableLinkBtn->getNormalImage)(a1->m_enableLinkBtn);
v40 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
if ( a1->m_linkControlsDisabled )
v41 = "gj_linkDisableBtn_001.png";
else
v41 = "gj_linkEnableBtn_001.png";
v42 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v40, v41);
(*(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v39 + 1144LL))(v39, v42);
if ( a1->m_linkControlsDisabled )
v43 = 200;
else
v43 = 255;
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_enableLinkBtn->setOpacity)(a1->m_enableLinkBtn, v43);
m_linkControlsDisabled = a1->m_linkControlsDisabled;
if ( (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
{
v45 = a1->m_linkControlsDisabled;
v46 = !v45;
m_linkBtn = a1->m_linkBtn;
m_linkBtn->m_animationEnabled = !v45;
if ( v45 )
v48 = &word_100647395;
else
v48 = &word_100647392;
}
else
{
v46 = 0;
m_linkBtn = a1->m_linkBtn;
m_linkBtn->m_animationEnabled = 0;
v48 = &word_100647395;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int16 *))m_linkBtn->setColor)(m_linkBtn, v48);
if ( m_linkControlsDisabled )
v49 = 75;
else
v49 = -81;
if ( v46 )
v50 = -1;
else
v50 = v49;
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_linkBtn->setOpacity)(a1->m_linkBtn, v50);
if ( !a1->m_linkControlsDisabled )
{
v54 = a1->m_selectedObject;
if ( v54 )
{
m_linkedGroup = v54->m_linkedGroup;
p_m_unlinkBtn = &a1->m_unlinkBtn;
m_unlinkBtn = a1->m_unlinkBtn;
m_unlinkBtn->m_animationEnabled = m_linkedGroup > 0;
if ( m_linkedGroup > 0 )
{
LABEL_70:
v53 = &word_100647392;
v49 = -1;
goto LABEL_71;
}
LABEL_67:
v53 = &word_100647395;
LABEL_71:
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int16 *))m_unlinkBtn->setColor)(m_unlinkBtn, v53);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))(*p_m_unlinkBtn)->setOpacity)(*p_m_unlinkBtn, v49);
return;
}
if ( (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
{
m_selectedObjects = a1->m_selectedObjects;
if ( m_selectedObjects )
{
data = m_selectedObjects->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (unsigned __int64)data->arr;
v60 = arr + 8 * num - 8;
while ( *(_QWORD *)arr )
{
if ( *(int *)(*(_QWORD *)arr + 872LL) >= 1 )
{
p_m_unlinkBtn = &a1->m_unlinkBtn;
m_unlinkBtn = a1->m_unlinkBtn;
m_unlinkBtn->m_animationEnabled = 1;
goto LABEL_70;
}
arr += 8LL;
if ( arr > v60 )
break;
}
}
}
}
}
p_m_unlinkBtn = &a1->m_unlinkBtn;
m_unlinkBtn = a1->m_unlinkBtn;
m_unlinkBtn->m_animationEnabled = 0;
goto LABEL_67;
}
}