//
// EditorUI::updateButtons from 0x10002c780 to 0x10002cf8c (2060 bytes)
//
// 23 xrefs:
// > EditorUI::init @ 0x10000b3db
// > EditorUI::undoLastAction @ 0x10000c0a8
// > EditorUI::redoLastAction @ 0x10000c108
// > EditorUI::onDeleteSelected @ 0x10000c2be
// > EditorUI::onGroupSticky @ 0x10000c905
// > EditorUI::onUngroupSticky @ 0x10000c955
// > EditorUI::onStickyToggle @ 0x10000c9ae
// > EditorUI::onDuplicate @ 0x10002ad97
// > EditorUI::onCopyState @ 0x10002c344
// > EditorUI::clickOnPosition @ 0x10002dc01
// > EditorUI::onDeleteSelectedType @ 0x100031d56
// > EditorUI::deselectAll @ 0x100032d6a
// > EditorUI::selectAll @ 0x10003d01e
// > EditorUI::selectAllWithDirection @ 0x10003d415
// > EditorUI::doCopyObjects @ 0x10003e139
// > EditorUI::doPasteObjects @ 0x10003e406
// > EditorUI::doPasteInPlace @ 0x10003e4e7
// > EditorUI::createSmartObjectsFromTemplate @ 0x10004332b
// > EditorUI::createSmartObjectsFromType @ 0x1000441cb
// > EditorUI::moveObjectCall_1 @ 0x10004a60f
// > EditorUI::ccTouchEnded @ 0x10005020f
// > EditorUI::keyDown @ 0x10005082d
// > EditorUI::keyDown @ 0x100050bf3
//
// 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)
{
bool v2; // al
CCMenuItemSpriteExtra *m_editObjectBtn; // rdi
void *v4; // rsi
unsigned int v5; // r14d
unsigned int v6; // r12d
bool v7; // al
CCMenuItemSpriteExtra *m_editSpecialBtn; // rdi
void *v9; // rsi
void *v10; // r13
CCMenuItemSpriteExtra *m_deselectBtn; // rdi
int v12; // eax
unsigned __int16 *v13; // r12
char v14; // r14
unsigned int v15; // r14d
bool hasAction; // al
CCMenuItemSpriteExtra *m_undoBtn; // rdi
void *v18; // rsi
unsigned int v19; // r15d
ButtonSprite *v20; // rax
CCMenuItemSpriteExtra *m_trashBtn; // rdi
bool v22; // al
CCMenuItemSpriteExtra *m_redoBtn; // rdi
void *v24; // rsi
unsigned int v25; // r15d
CCMenuItemSpriteExtra *m_editGroupBtn; // rdi
bool v27; // zf
CCMenuItemSpriteExtra *m_copyValuesBtn; // rdi
unsigned int v29; // r14d
CCMenuItemSpriteExtra *m_goToLayerBtn; // rdi
void *v31; // r15
void *v32; // r13
unsigned __int8 v33; // r14
void *v34; // rsi
cocos2d::CCArray *m_selectedObjects; // r14
unsigned int v36; // r12d
int v37; // r15d
int v38; // eax
cocos2d::CCArray *v39; // r14
unsigned int v40; // r12d
int v41; // r15d
int v42; // eax
bool v43; // zf
CCMenuItemSpriteExtra *v44; // rdi
unsigned int v45; // r14d
GameManager *v46; // rax
CCMenuItemSpriteExtra *m_pasteStateBtn; // rdi
unsigned __int8 v48; // r14
char v49; // r15
int v50; // eax
CCMenuItemSpriteExtra *m_pasteColorBtn; // rdi
__int64 v52; // r14
cocos2d::CCSpriteFrameCache *v53; // rax
const char *v54; // rsi
cocos2d::CCSpriteFrame *v55; // rax
__int64 v56; // rsi
bool m_linkControlsDisabled; // r14
bool v58; // al
bool v59; // r15
CCMenuItemSpriteExtra *m_linkBtn; // rdi
void *v61; // rsi
unsigned int v62; // r14d
__int64 v63; // rsi
CCMenuItemSpriteExtra *m_unlinkBtn; // rdi
void *v65; // rsi
CCMenuItemSpriteExtra **p_m_unlinkBtn; // r15
GameObject *m_selectedObject; // rax
bool v68; // cc
cocos2d::CCArray *v69; // rax
cocos2d::ccArray *data; // rax
__int64 num; // rcx
unsigned __int64 arr; // rax
unsigned __int64 v73; // rcx
unsigned __int8 v74; // [rsp+14h] [rbp-2Ch]
v2 = EditorUI::editButtonUsable(a1);
m_editObjectBtn = a1->m_editObjectBtn;
m_editObjectBtn->m_animationEnabled = v2;
v4 = &unk_100815543;
if ( v2 )
v4 = &unk_100815540;
v5 = 175;
v6 = 175;
if ( v2 )
v6 = 255;
((void (__fastcall *)(CCMenuItemSpriteExtra *, void *))m_editObjectBtn->setColor)(m_editObjectBtn, v4);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_editObjectBtn->setOpacity)(a1->m_editObjectBtn, v6);
v7 = EditorUI::editButton2Usable(a1);
m_editSpecialBtn = a1->m_editSpecialBtn;
m_editSpecialBtn->m_animationEnabled = v7;
v9 = &unk_100815543;
if ( v7 )
{
v9 = &unk_100815540;
v5 = 255;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, void *))m_editSpecialBtn->setColor)(m_editSpecialBtn, v9);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_editSpecialBtn->setOpacity)(a1->m_editSpecialBtn, v5);
EditorUI::updateEditColorButton(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 )
{
v10 = &unk_100815543;
m_deselectBtn = a1->m_deselectBtn;
m_deselectBtn->m_animationEnabled = 1;
LABEL_10:
v13 = (unsigned __int16 *)&unk_100815540;
v14 = 1;
goto LABEL_11;
}
v12 = sub_100720070(a1->m_selectedObjects);
m_deselectBtn = a1->m_deselectBtn;
m_deselectBtn->m_animationEnabled = v12 != 0;
v10 = &unk_100815543;
if ( v12 )
goto LABEL_10;
v14 = 0;
v13 = (unsigned __int16 *)&unk_100815543;
LABEL_11:
v74 = v14;
((void (__fastcall *)(CCMenuItemSpriteExtra *, unsigned __int16 *))m_deselectBtn->setColor)(m_deselectBtn, v13);
v27 = v14 == 0;
v15 = 175;
if ( !v27 )
v15 = 255;
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_deselectBtn->setOpacity)(a1->m_deselectBtn, v15);
hasAction = LevelEditorLayer::hasAction(a1->m_editorLayer, 1);
m_undoBtn = a1->m_undoBtn;
m_undoBtn->m_animationEnabled = hasAction;
v18 = &unk_100815543;
if ( hasAction )
v18 = &unk_100815540;
v19 = 175;
if ( hasAction )
v19 = 255;
((void (__fastcall *)(CCMenuItemSpriteExtra *, void *))m_undoBtn->setColor)(m_undoBtn, v18);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_undoBtn->setOpacity)(a1->m_undoBtn, v19);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_deleteButton->setEnabled)(a1->m_deleteButton, v74);
v20 = (ButtonSprite *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_deleteButton->getNormalImage)(a1->m_deleteButton);
ButtonSprite::setColor(v20, (cocos2d::ccColor3B)(*v13 | (*((unsigned __int8 *)v13 + 2) << 16)));
m_trashBtn = a1->m_trashBtn;
m_trashBtn->m_animationEnabled = v74;
((void (__fastcall *)(CCMenuItemSpriteExtra *, unsigned __int16 *))m_trashBtn->setColor)(m_trashBtn, v13);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_trashBtn->setOpacity)(a1->m_trashBtn, v15);
v22 = LevelEditorLayer::hasAction(a1->m_editorLayer, 0);
m_redoBtn = a1->m_redoBtn;
m_redoBtn->m_animationEnabled = v22;
v24 = &unk_100815543;
if ( v22 )
v24 = &unk_100815540;
v25 = 175;
if ( v22 )
v25 = 255;
((void (__fastcall *)(CCMenuItemSpriteExtra *, void *))m_redoBtn->setColor)(m_redoBtn, v24);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_redoBtn->setOpacity)(a1->m_redoBtn, v25);
m_editGroupBtn = a1->m_editGroupBtn;
m_editGroupBtn->m_animationEnabled = v74;
((void (__fastcall *)(CCMenuItemSpriteExtra *, unsigned __int16 *))m_editGroupBtn->setColor)(m_editGroupBtn, v13);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_editGroupBtn->setOpacity)(a1->m_editGroupBtn, v15);
v27 = a1->m_selectedObject == nullptr;
m_copyValuesBtn = a1->m_copyValuesBtn;
m_copyValuesBtn->m_animationEnabled = a1->m_selectedObject != nullptr;
if ( !v27 )
v10 = &unk_100815540;
v29 = 175;
if ( !v27 )
v29 = 255;
((void (__fastcall *)(CCMenuItemSpriteExtra *, void *))m_copyValuesBtn->setColor)(m_copyValuesBtn, v10);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_copyValuesBtn->setOpacity)(a1->m_copyValuesBtn, v29);
if ( a1->m_selectedObject )
{
LABEL_26:
m_goToLayerBtn = a1->m_goToLayerBtn;
m_goToLayerBtn->m_animationEnabled = 1;
v31 = &unk_100815540;
v32 = &unk_100815543;
LABEL_27:
v33 = -1;
v34 = &unk_100815540;
goto LABEL_53;
}
if ( (unsigned int)sub_100720070(a1->m_selectedObjects) )
{
m_selectedObjects = a1->m_selectedObjects;
v32 = &unk_100815543;
if ( !m_selectedObjects )
goto LABEL_51;
if ( (unsigned int)sub_100720070(a1->m_selectedObjects) )
{
v36 = 0;
v37 = -1;
do
{
v38 = *(__int16 *)(sub_1007200C0(m_selectedObjects, v36) + 1202);
if ( v37 == -1 )
{
v37 = v38;
}
else if ( v37 != v38 )
{
goto LABEL_40;
}
++v36;
}
while ( v36 < (unsigned int)sub_100720070(m_selectedObjects) );
if ( v37 > 0 )
goto LABEL_26;
}
LABEL_40:
v39 = a1->m_selectedObjects;
v32 = &unk_100815543;
if ( !v39 || !(unsigned int)sub_100720070(a1->m_selectedObjects) )
goto LABEL_51;
v40 = 0;
v41 = -1;
do
{
v42 = *(__int16 *)(sub_1007200C0(v39, v40) + 1204);
if ( v41 == -1 )
{
v41 = v42;
}
else if ( v41 != v42 )
{
goto LABEL_51;
}
++v40;
}
while ( v40 < (unsigned int)sub_100720070(v39) );
if ( v41 != -1 )
{
m_goToLayerBtn = a1->m_goToLayerBtn;
m_goToLayerBtn->m_animationEnabled = v41 > 0;
if ( v41 > 0 )
{
v31 = &unk_100815540;
goto LABEL_27;
}
}
else
{
LABEL_51:
m_goToLayerBtn = a1->m_goToLayerBtn;
m_goToLayerBtn->m_animationEnabled = 0;
}
v34 = &unk_100815543;
v33 = -81;
v31 = &unk_100815540;
}
else
{
m_goToLayerBtn = a1->m_goToLayerBtn;
m_goToLayerBtn->m_animationEnabled = 0;
v34 = &unk_100815543;
v33 = -81;
v31 = &unk_100815540;
v32 = &unk_100815543;
}
LABEL_53:
((void (__fastcall *)(CCMenuItemSpriteExtra *, void *))m_goToLayerBtn->setColor)(m_goToLayerBtn, v34);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_goToLayerBtn->setOpacity)(a1->m_goToLayerBtn, v33);
v43 = a1->m_selectedObject == nullptr;
v44 = a1->m_copyValuesBtn;
v44->m_animationEnabled = a1->m_selectedObject != nullptr;
if ( v43 )
v31 = &unk_100815543;
v45 = 175;
if ( !v43 )
v45 = 255;
((void (__fastcall *)(CCMenuItemSpriteExtra *, void *))v44->setColor)(v44, v31);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_copyValuesBtn->setOpacity)(a1->m_copyValuesBtn, v45);
v46 = GameManager::sharedState();
if ( !LevelEditorLayer::canPasteState(v46->m_levelEditorLayer) )
{
m_pasteStateBtn = a1->m_pasteStateBtn;
m_pasteStateBtn->m_animationEnabled = 0;
v48 = -81;
v49 = 0;
goto LABEL_63;
}
if ( a1->m_selectedObject )
{
m_pasteStateBtn = a1->m_pasteStateBtn;
m_pasteStateBtn->m_animationEnabled = 1;
LABEL_62:
v32 = &unk_100815540;
v48 = -1;
v49 = 1;
goto LABEL_63;
}
v50 = sub_100720070(a1->m_selectedObjects);
m_pasteStateBtn = a1->m_pasteStateBtn;
m_pasteStateBtn->m_animationEnabled = v50 != 0;
if ( v50 )
goto LABEL_62;
v49 = 0;
v48 = -81;
LABEL_63:
((void (__fastcall *)(CCMenuItemSpriteExtra *, void *))m_pasteStateBtn->setColor)(m_pasteStateBtn, v32);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_pasteStateBtn->setOpacity)(a1->m_pasteStateBtn, v48);
m_pasteColorBtn = a1->m_pasteColorBtn;
m_pasteColorBtn->m_animationEnabled = v49;
((void (__fastcall *)(CCMenuItemSpriteExtra *, void *))m_pasteColorBtn->setColor)(m_pasteColorBtn, v32);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_pasteColorBtn->setOpacity)(a1->m_pasteColorBtn, v48);
if ( a1->m_stickyControlsEnabled )
{
v52 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_enableLinkBtn->getNormalImage)(a1->m_enableLinkBtn);
v53 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v54 = "gj_linkEnableBtn_001.png";
if ( a1->m_linkControlsDisabled )
v54 = "gj_linkDisableBtn_001.png";
v55 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v53, v54);
(*(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v52 + 1144LL))(v52, v55);
v56 = 255;
if ( a1->m_linkControlsDisabled )
v56 = 200;
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_enableLinkBtn->setOpacity)(a1->m_enableLinkBtn, v56);
m_linkControlsDisabled = a1->m_linkControlsDisabled;
if ( (unsigned int)sub_100720070(a1->m_selectedObjects) )
{
v58 = a1->m_linkControlsDisabled;
v59 = !v58;
m_linkBtn = a1->m_linkBtn;
m_linkBtn->m_animationEnabled = !v58;
v61 = &unk_100815540;
if ( v58 )
v61 = &unk_100815543;
}
else
{
m_linkBtn = a1->m_linkBtn;
m_linkBtn->m_animationEnabled = 0;
v61 = &unk_100815543;
v59 = 0;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, void *))m_linkBtn->setColor)(m_linkBtn, v61);
v27 = !m_linkControlsDisabled;
v62 = 175;
if ( !v27 )
v62 = 75;
v63 = 255;
if ( !v59 )
v63 = v62;
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_linkBtn->setOpacity)(a1->m_linkBtn, v63);
if ( !a1->m_linkControlsDisabled )
{
m_selectedObject = a1->m_selectedObject;
if ( m_selectedObject )
{
p_m_unlinkBtn = &a1->m_unlinkBtn;
v68 = m_selectedObject->m_linkedGroup <= 0;
m_unlinkBtn = a1->m_unlinkBtn;
m_unlinkBtn->m_animationEnabled = m_selectedObject->m_linkedGroup > 0;
if ( v68 )
{
v65 = &unk_100815543;
}
else
{
LABEL_82:
v65 = &unk_100815540;
LOBYTE(v62) = -1;
}
goto LABEL_93;
}
if ( (unsigned int)sub_100720070(a1->m_selectedObjects) )
{
v69 = a1->m_selectedObjects;
if ( v69 )
{
data = v69->data;
num = data->num;
if ( data->num )
{
arr = (unsigned __int64)data->arr;
v73 = arr + 8 * num - 8;
while ( *(_QWORD *)arr )
{
if ( *(int *)(*(_QWORD *)arr + 872LL) > 0 )
{
m_unlinkBtn = a1->m_unlinkBtn;
m_unlinkBtn->m_animationEnabled = 1;
p_m_unlinkBtn = &a1->m_unlinkBtn;
goto LABEL_82;
}
arr += 8LL;
if ( arr > v73 )
break;
}
}
}
}
}
m_unlinkBtn = a1->m_unlinkBtn;
m_unlinkBtn->m_animationEnabled = 0;
v65 = &unk_100815543;
p_m_unlinkBtn = &a1->m_unlinkBtn;
LABEL_93:
((void (__fastcall *)(CCMenuItemSpriteExtra *, void *))m_unlinkBtn->setColor)(m_unlinkBtn, v65);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))(*p_m_unlinkBtn)->setOpacity)(
*p_m_unlinkBtn,
(unsigned __int8)v62);
}
}