//
// EditorUI::transformObject from 0x10004b8d0 to 0x10004be9b (1483 bytes)
//
// 4 xrefs:
// > EditorUI::flipObjectsY @ 0x1000434f1
// > EditorUI::flipObjectsX @ 0x1000436c1
// > EditorUI::transformObjectCall_1 @ 0x10004ab7a
// > EditorUI::transformObjectCall_1 @ 0x10004ac0c
//
// 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::transformObject(EditorUI *a1, GameObject *a2, EditCommand a3, bool a4)
{
__m128 v4; // xmm0
GameObject *v6; // rbx
bool v7; // r14
char v8; // r13
bool isSpecialSnapObject; // al
__int64 v10; // rax
float v11; // xmm0_4
__m128 v12; // xmm1
__m128 v13; // xmm0
char v14; // cl
EditCommand v15; // eax
float v16; // xmm0_4
GameObject_vtbl *v17; // rax
double v18; // xmm0_8
double (__fastcall **p_getRotation)(GameObject *); // rax
__int64 v20; // r14
double v21; // xmm0_8
int v22; // xmm0_4
float v23; // xmm0_4
cocos2d::CCArray *m_selectedObjects; // r15
float v25; // xmm0_4
float v26; // xmm0_4
float v27; // xmm0_4
GameObject_vtbl *v28; // rax
float v29; // xmm0_4
__int64 v30; // r14
__int64 v31; // rax
float v32; // xmm0_4
__int64 v33; // rax
cocos2d::CCPoint v34; // xmm0_8
char v35; // [rsp+4h] [rbp-3Ch] BYREF
char v36; // [rsp+Ch] [rbp-34h] BYREF
float v37; // [rsp+14h] [rbp-2Ch]
cocos2d::CCPoint v38; // 0:xmm0_8.8
double v39; // 0:xmm0_8.8
cocos2d::CCPoint v40; // 0:xmm0_8.8
double v41; // 0:xmm0_8.8
v6 = a2;
v7 = 1;
v8 = 1;
if ( !a4 )
{
LODWORD(a2) = a2->m_objectID;
isSpecialSnapObject = EditorUI::isSpecialSnapObject(a1, (int)a2);
if ( (unsigned int)(a3 - 21) > 1 || (v8 = 1, !isSpecialSnapObject) )
{
((void (__fastcall *)(GameObject *))v6->getRotation)(v6);
v8 = 1;
if ( a3 != RotateSnap )
{
v4 = _mm_and_ps(v4, (__m128)xmmword_100815500);
v8 = 1;
if ( !((int)v4.f32[0] % 90) )
{
v38 = EditorUI::offsetForKey((EditorUI *)&v36, (int)a2);
*(cocos2d::CCPoint *)&v39 = GameToolbox::getRelativeOffset((GameObject *)&v35, v38);
v10 = ((__int64 (__fastcall *)(GameObject *, GameObject *, double))v6->getPosition)(v6, v6, v39);
sub_10028CD00(&v36, v10, &v35);
((void (__fastcall *)(GameObject *, char *))v6->setPosition)(v6, &v36);
LODWORD(a2) = (_DWORD)v6;
GJBaseGameLayer::reorderObjectSection(a1->m_editorLayer, v6);
v8 = 0;
}
}
}
}
v37 = ((float (__fastcall *)(GameObject *))v6->getRotationX)(v6);
v11 = ((float (__fastcall *)(GameObject *))v6->getRotationY)(v6);
v12.i64[0] = LODWORD(v37);
if ( v37 != v11 )
{
v15 = a3;
LABEL_16:
switch ( v15 )
{
case FlipX:
a2 = (GameObject *)(((unsigned __int8 (__fastcall *)(GameObject *))v6->isFlipX)(v6) ^ 1u);
((void (__fastcall *)(GameObject *, GameObject *))v6->setFlipX)(v6, a2);
if ( !v7 )
goto LABEL_24;
goto LABEL_20;
case FlipY:
goto LABEL_19;
case RotateCW:
*(float *)&v22 = 90.0;
goto LABEL_32;
case RotateCCW:
*(float *)&v22 = -90.0;
goto LABEL_32;
case RotateCW45:
*(float *)&v22 = 45.0;
goto LABEL_32;
case RotateCCW45:
*(float *)&v22 = -45.0;
LABEL_32:
v37 = *(float *)&v22;
v25 = ((float (__fastcall *)(GameObject *))v6->getRotationX)(v6);
((void (__fastcall *)(GameObject *, float))v6->setRotationX)(v6, v25 + v37);
v26 = ((float (__fastcall *)(GameObject *))v6->getRotationY)(v6);
((void (__fastcall *)(GameObject *, float))v6->setRotationY)(v6, v26 + v37);
if ( fabs(COERCE_FLOAT(COERCE_UNSIGNED_INT64(((double (__fastcall *)(GameObject *))v6->getRotationX)(v6)))) == 360.0 )
((void (__fastcall *)(GameObject *, double))v6->setRotationX)(v6, 0.0);
if ( fabs(COERCE_FLOAT(COERCE_UNSIGNED_INT64(((double (__fastcall *)(GameObject *))v6->getRotationY)(v6)))) == 360.0 )
((void (__fastcall *)(GameObject *, double))v6->setRotationY)(v6, 0.0);
break;
case RotateSnap:
LODWORD(a2) = (_DWORD)v6;
v23 = LevelEditorLayer::rotationForSlopeNearObject(a1->m_editorLayer, v6);
if ( v23 != -1.0 )
{
m_selectedObjects = a1->m_selectedObjects;
v37 = v23;
sub_10028CC60(&v36);
LODWORD(a2) = (_DWORD)m_selectedObjects;
EditorUI::rotateObjects(a1, m_selectedObjects, v37, *(cocos2d::CCPoint *)v12.f32);
}
break;
default:
goto LABEL_36;
}
goto LABEL_36;
}
*(double *)v4.i64 = ((double (__fastcall *)(GameObject *))v6->getRotation)(v6);
v13 = _mm_and_ps(v4, (__m128)xmmword_100815500);
v12 = _mm_cmpeq_ps((__m128)0x43870000u, v13);
v14 = _mm_cvtsi128_si32((__m128i)_mm_or_ps(_mm_cmpeq_ps((__m128)0x42B40000u, v13), v12));
v7 = __ROR4__(-1527099483 * (int)v13.f32[0] + 47721858, 1) >= 0x2D82D83u;
v15 = FlipX;
if ( (v14 & 1) == 0 )
v15 = a3;
if ( a3 != FlipY )
v15 = a3;
if ( a3 != FlipX || (v14 & 1) == 0 )
goto LABEL_16;
LABEL_19:
a2 = (GameObject *)(((unsigned __int8 (__fastcall *)(GameObject *))v6->isFlipY)(v6) ^ 1u);
((void (__fastcall *)(GameObject *, GameObject *))v6->setFlipY)(v6, a2);
if ( v7 )
{
LABEL_20:
v37 = ((float (__fastcall *)(GameObject *))v6->getRotationX)(v6);
v16 = ((float (__fastcall *)(GameObject *))v6->getRotationY)(v6);
v17 = v6->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v37 == v16 )
{
p_getRotation = (double (__fastcall **)(GameObject *))&v17->getRotation;
v20 = 344;
}
else
{
v18 = ((double (__fastcall *)(GameObject *))v17->getRotationX)(v6);
((void (__fastcall *)(GameObject *, double))v6->setRotationX)(
v6,
COERCE_DOUBLE(*(_QWORD *)&v18 ^ 0x8000000080000000LL));
p_getRotation = (double (__fastcall **)(GameObject *))&v6->getRotationY;
v20 = 376;
}
v21 = (*p_getRotation)(v6);
(*(void (__fastcall **)(GameObject *, double))((char *)&v6->copyWithZone + v20))(
v6,
COERCE_DOUBLE(*(_QWORD *)&v21 ^ 0x8000000080000000LL));
}
LABEL_24:
if ( v6->m_updateCustomContentSize )
{
LODWORD(a2) = 1;
((void (__fastcall *)(GameObject *, __int64))v6->setObjectRectDirty)(v6, 1);
}
LABEL_36:
v37 = ((float (__fastcall *)(GameObject *))v6->getRotationX)(v6);
v27 = ((float (__fastcall *)(GameObject *))v6->getRotationY)(v6);
v28 = v6->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v37 != v27 )
{
v32 = ((float (__fastcall *)(GameObject *))v28->getRotationX)(v6);
v37 = v32;
((void (__fastcall *)(GameObject *))v6->getRotationX)(v6);
if ( v37 < 360.0 )
{
if ( v32 > -360.0 )
{
LABEL_44:
v29 = ((float (__fastcall *)(GameObject *))v6->getRotationY)(v6);
v37 = v29;
((void (__fastcall *)(GameObject *))v6->getRotationY)(v6);
if ( v37 >= 360.0 )
{
v30 = 376;
goto LABEL_50;
}
if ( v29 > -360.0 )
goto LABEL_51;
v30 = 376;
v31 = 384;
goto LABEL_47;
}
v32 = ((float (__fastcall *)(GameObject *))v6->getRotationX)(v6);
}
((void (__fastcall *)(GameObject *, float))v6->setRotationX)(v6, (float)((int)v32 % 360));
goto LABEL_44;
}
v29 = ((float (__fastcall *)(GameObject *))v28->getRotation)(v6);
v37 = v29;
((void (__fastcall *)(GameObject *))v6->getRotation)(v6);
if ( v37 >= 360.0 )
{
v30 = 344;
goto LABEL_50;
}
if ( v29 > -360.0 )
goto LABEL_51;
v30 = 344;
v31 = 352;
LABEL_47:
(*(void (__fastcall **)(GameObject *))((char *)&v6->copyWithZone + v31))(v6);
LABEL_50:
(*(void (__fastcall **)(GameObject *, float))((char *)&v6->copyWithZone + v30))(v6, (float)((int)v29 % 360));
LABEL_51:
if ( !v8 )
{
v40 = EditorUI::offsetForKey((EditorUI *)&v36, (int)a2);
*(cocos2d::CCPoint *)&v41 = GameToolbox::getRelativeOffset((GameObject *)&v35, v40);
v33 = ((__int64 (__fastcall *)(GameObject *, GameObject *, double))v6->getPosition)(v6, v6, v41);
sub_10028CCE0(&v36, v33);
((void (__fastcall *)(GameObject *, char *))v6->setPosition)(v6, &v36);
GJBaseGameLayer::reorderObjectSection(a1->m_editorLayer, v6);
}
if ( a1->m_refreshPosition )
{
*(double *)&v34 = sub_10028CC60(&v36);
EditorUI::moveObject(a1, v6, v34);
}
}