//
// EditorUI::toggleSpecialEditButtons from 0x1003e6484 to 0x1003e6640 (444 bytes)
//
// 2 xrefs:
// > EditorUI::toggleEnableRotate @ 0x1003c7460
// > EditorUI::updateButtons @ 0x1003e5ad4
//
// 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)
{
unsigned __int64 v1; // x22
unsigned int v3; // w20
GameObject *v4; // x0
cocos2d::CCDictionary **p_m_editButtonDict; // x24
bool canRotateFree; // w20
GameObject *m_selectedObject; // x0
__int64 v8; // x25
unsigned int i; // w26
int v10; // w8
cocos2d::CCDictionary *v11; // x23
cocos2d::CCString *v12; // x0
char *CString; // x0
__int64 v14; // x0
__int64 v15; // x23
ButtonSprite *v16; // x0
GameManager *v17; // x0
cocos2d::CCObject *v18; // x1
void *__p[2]; // [xsp+8h] [xbp-68h] BYREF
char v20; // [xsp+1Fh] [xbp-51h]
if ( (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
{
if ( (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
{
v3 = 0;
do
{
v4 = (GameObject *)sub_10024A388((__int64)a1->m_selectedObjects, v3);
if ( !GameObject::canRotateFree(v4) )
goto LABEL_10;
}
while ( ++v3 < (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) );
}
p_m_editButtonDict = &a1->m_editButtonDict;
canRotateFree = 1;
}
else
{
m_selectedObject = a1->m_selectedObject;
if ( !m_selectedObject )
{
LABEL_10:
canRotateFree = 0;
v8 = 10921638;
p_m_editButtonDict = &a1->m_editButtonDict;
goto LABEL_12;
}
canRotateFree = GameObject::canRotateFree(m_selectedObject);
p_m_editButtonDict = &a1->m_editButtonDict;
if ( !canRotateFree )
{
v8 = 10921638;
goto LABEL_12;
}
}
v8 = 0xFFFFFF;
LABEL_12:
for ( i = -1; i != 3; ++i )
{
if ( i > 2 )
v10 = 27;
else
v10 = dword_100647444[i];
v11 = *p_m_editButtonDict;
v12 = (cocos2d::CCString *)sub_100268F4C("%i", v10);
CString = (char *)cocos2d::CCString::getCString(v12);
sub_100009900(__p, CString);
v14 = cocos2d::CCDictionary::objectForKey_1(v11, __p);
v15 = v14;
if ( (v20 & 0x80000000) == 0 )
{
if ( !v14 )
continue;
LABEL_18:
v16 = (ButtonSprite *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v15 + 1056LL))(v15);
v1 = v1 & 0xFFFFFFFFFF000000LL | v8;
ButtonSprite::setColor(v16, (cocos2d::ccColor3B)v1);
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v15 + 1040LL))(v15, canRotateFree);
continue;
}
operator delete(__p[0]);
if ( v15 )
goto LABEL_18;
}
if ( canRotateFree )
{
v17 = GameManager::sharedState();
if ( GameManager::getGameVariable(v17, "0007") )
EditorUI::activateRotationControl(a1, v18);
}
else
{
EditorUI::deactivateRotationControl(a1);
}
EditorUI::updateGridNodeSize(a1);
}