//
// EditorUI::toggleSpecialEditButtons from 0x10002d420 to 0x10002d985 (1381 bytes)
//
// 2 xrefs:
// > EditorUI::toggleEnableRotate @ 0x10000c07c
// > EditorUI::updateButtons @ 0x10002c869
//
// 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::toggleSpecialEditButtons(EditorUI *a1)
{
double v1; // xmm0_8
unsigned int v3; // r14d
GameObject *v4; // rax
char *v5; // r13
GameObject *m_selectedObject; // rdi
bool canRotateFree; // al
cocos2d::CCDictionary *v8; // r12
cocos2d::CCString *v9; // rax
const char *CString; // r15
size_t v11; // rax
size_t v12; // r14
char *v13; // r12
size_t v14; // r13
__int64 v15; // r14
ButtonSprite *v16; // rax
cocos2d::CCDictionary *v17; // r14
cocos2d::CCString *v18; // rax
const char *v19; // r12
size_t v20; // rax
size_t v21; // r15
size_t v22; // r14
void *v23; // r13
__int64 v24; // r14
ButtonSprite *v25; // rax
cocos2d::CCDictionary *v26; // r14
cocos2d::CCString *v27; // rax
const char *v28; // r12
size_t v29; // rax
size_t v30; // r15
size_t v31; // r14
void *v32; // r13
__int64 v33; // r14
ButtonSprite *v34; // rax
cocos2d::CCDictionary *v35; // r14
cocos2d::CCString *v36; // rax
const char *v37; // r12
size_t v38; // rax
size_t v39; // r15
size_t v40; // r13
__int64 v41; // r14
ButtonSprite *v42; // rax
GameManager *v43; // rax
GJRotationControl *m_rotationControl; // r15
cocos2d::CCSprite *m_controlSprite; // r14
cocos2d::CCSpriteFrameCache *v46; // rax
cocos2d::CCSpriteFrame *v47; // rax
GJRotationControlDelegate *m_delegate; // rdi
char v49; // [rsp+0h] [rbp-70h]
void *v50; // [rsp+0h] [rbp-70h]
void *v51; // [rsp+0h] [rbp-70h]
cocos2d::CCDictionary *v52; // [rsp+8h] [rbp-68h]
cocos2d::CCDictionary *v53; // [rsp+8h] [rbp-68h]
cocos2d::CCDictionary *v54; // [rsp+10h] [rbp-60h]
cocos2d::CCDictionary **p_m_editButtonDict; // [rsp+18h] [rbp-58h]
char v56; // [rsp+24h] [rbp-4Ch]
size_t __dst; // [rsp+28h] [rbp-48h] BYREF
size_t v58; // [rsp+30h] [rbp-40h]
void *__p; // [rsp+38h] [rbp-38h]
int v60; // [rsp+44h] [rbp-2Ch]
if ( (unsigned int)sub_100720070(a1->m_selectedObjects) )
{
if ( (unsigned int)sub_100720070(a1->m_selectedObjects) )
{
v3 = 0;
do
{
v4 = (GameObject *)sub_1007200C0(a1->m_selectedObjects, v3);
if ( !GameObject::canRotateFree(v4) )
goto LABEL_10;
}
while ( ++v3 < (unsigned int)sub_100720070(a1->m_selectedObjects) );
}
p_m_editButtonDict = &a1->m_editButtonDict;
v56 = 1;
v5 = (char *)&__dst + 1;
LABEL_9:
v60 = 0xFFFFFF;
goto LABEL_11;
}
m_selectedObject = a1->m_selectedObject;
if ( m_selectedObject )
{
canRotateFree = GameObject::canRotateFree(m_selectedObject);
p_m_editButtonDict = &a1->m_editButtonDict;
v60 = 10921638;
v5 = (char *)&__dst + 1;
v56 = canRotateFree;
if ( !canRotateFree )
goto LABEL_11;
goto LABEL_9;
}
LABEL_10:
p_m_editButtonDict = &a1->m_editButtonDict;
v60 = 10921638;
v5 = (char *)&__dst + 1;
v56 = 0;
LABEL_11:
v8 = *p_m_editButtonDict;
v9 = (cocos2d::CCString *)sub_1007AB580("%i", v49);
CString = cocos2d::CCString::getCString(v9);
v11 = strlen(CString);
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_67;
v12 = v11;
v54 = v8;
if ( v11 >= 0x17 )
{
v14 = 26;
if ( (v11 | 7) != 0x17 )
v14 = (v11 | 7) + 1;
v13 = (char *)operator new(v14);
__p = v13;
__dst = v14 + 1;
v5 = (char *)&__dst + 1;
v58 = v12;
goto LABEL_18;
}
LOBYTE(__dst) = 2 * v11;
v13 = (char *)&__dst + 1;
if ( v11 )
LABEL_18:
memmove(v13, CString, v12);
v13[v12] = 0;
v15 = cocos2d::CCDictionary::objectForKey_1(v54, &__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( v15 )
{
v16 = (ButtonSprite *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v15 + 1056LL))(v15);
ButtonSprite::setColor(v16, (cocos2d::ccColor3B)v60);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v15 + 1040LL))(v15, v56 & 1);
}
v17 = *p_m_editButtonDict;
v18 = (cocos2d::CCString *)sub_1007AB580("%i", (char)&__dst + 1);
v19 = cocos2d::CCString::getCString(v18);
v20 = strlen(v19);
if ( v20 > 0xFFFFFFFFFFFFFFF7LL )
LABEL_67:
sub_100006BF0(v1);
v21 = v20;
if ( v20 >= 0x17 )
{
v52 = v17;
v22 = 26;
if ( (v20 | 7) != 0x17 )
v22 = (v20 | 7) + 1;
v5 = (char *)operator new(v22);
__p = v5;
__dst = v22 + 1;
v17 = v52;
v58 = v21;
goto LABEL_30;
}
LOBYTE(__dst) = 2 * v20;
if ( v20 )
LABEL_30:
memmove(v5, v19, v21);
v5[v21] = 0;
v23 = v50;
v24 = cocos2d::CCDictionary::objectForKey_1(v17, &__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( v24 )
{
v25 = (ButtonSprite *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v24 + 1056LL))(v24);
ButtonSprite::setColor(v25, (cocos2d::ccColor3B)v60);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v24 + 1040LL))(v24, v56 & 1);
}
v26 = *p_m_editButtonDict;
v27 = (cocos2d::CCString *)sub_1007AB580("%i", (char)v50);
v28 = cocos2d::CCString::getCString(v27);
v29 = strlen(v28);
if ( v29 > 0xFFFFFFFFFFFFFFF7LL )
goto LABEL_67;
v30 = v29;
if ( v29 >= 0x17 )
{
v53 = v26;
v31 = 26;
if ( (v29 | 7) != 0x17 )
v31 = (v29 | 7) + 1;
v23 = operator new(v31);
__p = v23;
__dst = v31 + 1;
v26 = v53;
v58 = v30;
goto LABEL_42;
}
LOBYTE(__dst) = 2 * v29;
if ( v29 )
LABEL_42:
memmove(v23, v28, v30);
*((_BYTE *)v23 + v30) = 0;
v32 = v51;
v33 = cocos2d::CCDictionary::objectForKey_1(v26, &__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( v33 )
{
v34 = (ButtonSprite *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v33 + 1056LL))(v33);
ButtonSprite::setColor(v34, (cocos2d::ccColor3B)v60);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v33 + 1040LL))(v33, v56 & 1);
}
v35 = *p_m_editButtonDict;
v36 = (cocos2d::CCString *)sub_1007AB580("%i", (char)v51);
v37 = cocos2d::CCString::getCString(v36);
v38 = strlen(v37);
if ( v38 > 0xFFFFFFFFFFFFFFF7LL )
goto LABEL_67;
v39 = v38;
if ( v38 >= 0x17 )
{
v40 = 26;
if ( (v38 | 7) != 0x17 )
v40 = (v38 | 7) + 1;
__p = operator new(v40);
__dst = v40 + 1;
v32 = __p;
v58 = v39;
goto LABEL_54;
}
LOBYTE(__dst) = 2 * v38;
if ( v38 )
LABEL_54:
memmove(v32, v37, v39);
*((_BYTE *)v32 + v39) = 0;
v41 = cocos2d::CCDictionary::objectForKey_1(v35, &__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( v41 )
{
v42 = (ButtonSprite *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v41 + 1056LL))(v41);
ButtonSprite::setColor(v42, (cocos2d::ccColor3B)v60);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v41 + 1040LL))(v41, v56 & 1);
}
if ( (v56 & 1) != 0 )
{
v43 = GameManager::sharedState();
if ( GameManager::getGameVariable(v43, "0007") )
EditorUI::activateRotationControl(a1, (cocos2d::CCObject *)"0007");
}
else
{
a1->m_rotationTouchID = -1;
if ( ((unsigned __int8 (__fastcall *)(GJRotationControl *))a1->m_rotationControl->isVisible)(a1->m_rotationControl) )
{
((void (__fastcall *)(GJRotationControl *, _QWORD))a1->m_rotationControl->setVisible)(a1->m_rotationControl, 0);
m_rotationControl = a1->m_rotationControl;
if ( m_rotationControl->m_touchID != -1 )
{
m_rotationControl->m_touchID = -1;
m_controlSprite = m_rotationControl->m_controlSprite;
v46 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v47 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v46, "GJ_rotationControlBtn01_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSpriteFrame *))m_controlSprite->setDisplayFrame)(
m_controlSprite,
v47);
m_delegate = m_rotationControl->m_delegate;
if ( m_delegate )
((void (__fastcall *)(GJRotationControlDelegate *))m_delegate->angleChangeEnded)(m_delegate);
}
}
}
EditorUI::updateGridNodeSize_1(a1);
}