//
// EditorUI::ccTouchEnded from 0x1003f90c0 to 0x1003f9824 (1892 bytes)
//
// 2 xrefs:
// > sub_1003F9824 @ 0x1003f9828
// > ??> @ 0x100813ec8
//
// 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::ccTouchEnded(EditorUI *a1, cocos2d::CCTouch *a2, cocos2d::CCEvent *a3)
{
int m_nId; // w8
void *m_rotationControl; // x0
LevelEditorLayer *m_editorLayer; // x9
GameManager *v9; // x0
_BOOL4 GameVariable; // w21
cocos2d::CCEvent *v11; // x2
bool v12; // w22
cocos2d::CCEvent *v13; // x2
cocos2d::CCEvent *v14; // x2
GameManager *v15; // x0
GameObject *m_snapObject; // x0
unsigned __int64 v17; // t2
EditorUI *v18; // x0
double v19; // d0
__int64 *v20; // x0
float v21; // s0
unsigned int v22; // w20
__int64 v23; // x0
GameObject *v24; // x21
double v25; // d0
void *m_scaleControl; // x20
cocos2d::CCLayer *m_objectLayer; // x21
float v28; // s0
float v29; // s1
cocos2d::CCEvent *v30; // x2
LevelEditorLayer *v31; // x20
cocos2d::CCArray *v32; // x0
GameObject *v33; // x0
GameObject *v34; // x20
cocos2d::CCArray *v35; // x0
float v36; // s0
LevelEditorLayer *v37; // x20
cocos2d::CCArray *v38; // x0
GameObject *CycledObject; // x0
double v40; // d0
float32x2_t *v41; // x0
double v42; // d0
float *v43; // x0
float32x2_t *v44; // x0
UndoObject *m_undoObject; // x1
UndoObject *v46; // x0
GameObject *v47; // x0
_BOOL4 m_canActivateControls; // w20
GJTransformControl *m_transformControl; // x20
float32x2_t *v50; // x0
double v51; // d0
GameObject *v52; // x0
float v53; // s1
float v54; // s2
float v55; // s3
cocos2d::CCPoint v56[2]; // [xsp+0h] [xbp-80h] BYREF
float32x2_t v57[2]; // [xsp+10h] [xbp-70h] BYREF
float32x2_t v58; // [xsp+20h] [xbp-60h] BYREF
float32x2_t v59; // [xsp+28h] [xbp-58h] BYREF
float32x2_t v60; // [xsp+30h] [xbp-50h] BYREF
float32x2_t v61; // [xsp+38h] [xbp-48h] BYREF
__int64 v62; // [xsp+40h] [xbp-40h] BYREF
cocos2d::CCPoint v63; // [xsp+48h] [xbp-38h] BYREF
cocos2d::CCRect v64; // 0:kr60_16.16
cocos2d::CCPoint v65; // 0:s0.4,4:s1.4
cocos2d::CCPoint v66; // 0:s0.4,4:s1.4
cocos2d::CCPoint v67; // 0:s0.4,4:s1.4
cocos2d::CCPoint v68; // 0:s0.4,4:s1.4
cocos2d::CCPoint v69; // 0:s0.4,4:s1.4
cocos2d::CCPoint v70; // 0:s0.4,4:s1.4
cocos2d::CCPoint v71; // 0:s2.4,4:s3.4
a1->m_canActivateControls = 0;
cocos2d::CCNode::stopActionByTag(a1, 123);
m_nId = a2->m_nId;
if ( a1->m_rotationTouchID == m_nId )
{
a1->m_rotationTouchID = -1;
m_rotationControl = a1->m_rotationControl;
LABEL_9:
(*(void (__fastcall **)(void *, cocos2d::CCTouch *, cocos2d::CCEvent *))(*(_QWORD *)m_rotationControl + 896LL))(
m_rotationControl,
a2,
a3);
return;
}
if ( a1->m_scaleTouchID == m_nId )
{
a1->m_scaleTouchID = -1;
m_rotationControl = a1->m_scaleControl;
goto LABEL_9;
}
if ( a1->m_transformTouchID == m_nId )
{
a1->m_transformTouchID = -1;
m_rotationControl = a1->m_transformControl;
goto LABEL_9;
}
m_editorLayer = a1->m_editorLayer;
if ( m_editorLayer->m_playbackMode == Playing )
{
m_rotationControl = m_editorLayer->m_uiLayer;
goto LABEL_9;
}
if ( a1->m_touchID == m_nId )
{
v9 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v9, "0059");
EditorUI::getTouchPoint(a1, a2, v11);
v12 = cocos2d::ccpDistance(&a1->m_swipeStart, &v63) < 8.0 && GameVariable;
if ( cocos2d::ccpDistance(&a1->m_lastTouchPoint, &v63) >= 8.0 )
GameVariable = 0;
a1->m_touchID = -1;
if ( a1->m_snapObjectExists && a1->m_continuousSnap && a1->m_snapObject )
{
sub_1000229B8((__int64 *)v57, (__int64 *)&dword_10086E8B0);
EditorUI::getTouchPoint(a1, a2, v14);
cocos2d::CCNode::convertToNodeSpace(a1->m_editorLayer->m_objectLayer, v56);
v15 = GameManager::sharedState();
if ( GameManager::getGameVariable(v15, "0008") )
{
m_snapObject = a1->m_snapObject;
if ( m_snapObject )
{
HIDWORD(v17) = -1527099483
* (int)((float (__fastcall *)(GameObject *))m_snapObject->getRotation)(m_snapObject)
+ 47721858;
LODWORD(v17) = HIDWORD(v17);
if ( (unsigned int)(v17 >> 1) <= 0x2D82D82 && !sub_100022A5C((float *)v56, (float *)&a1->m_swipeStart) )
{
v65.x = sub_1000229B8((__int64 *)&v60, &v62);
EditorUI::getGridSnappedPos(a1, v65);
EditorUI::getRelativeOffset(v18, a1->m_snapObject);
v66.x = sub_1000229B8((__int64 *)&v58, (__int64 *)&v61);
EditorUI::applySpecialOffset(a1, v66, (GameObject *)&v59, v71);
sub_1000229DC(&v61, &v60, &v59);
v19 = sub_1000229D0(&v61, (double *)&v59);
v20 = (__int64 *)((__int64 (__fastcall *)(GameObject *, double))a1->m_snapObject->getPosition)(
a1->m_snapObject,
v19);
v21 = sub_1000229B8((__int64 *)&v59, v20);
((void (__fastcall *)(GameObject *, float32x2_t *, float))a1->m_snapObject->setPosition)(
a1->m_snapObject,
&v61,
v21);
sub_1000229F0(&v61, &v59, &v58);
sub_1000229D0(v57, (double *)&v58);
if ( (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects)
&& (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
{
v22 = 0;
do
{
v23 = sub_10024A388((__int64)a1->m_selectedObjects, v22);
if ( *(_DWORD *)(v23 + 916) != a1->m_snapObject->m_uniqueID )
{
v24 = (GameObject *)v23;
v67.x = sub_1000229B8((__int64 *)&v58, (__int64 *)v57);
EditorUI::moveObject(a1, v24, v67);
}
++v22;
}
while ( v22 < (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) );
}
sub_1000229DC((float32x2_t *)&a1->m_pivotPoint, v57, &v58);
v25 = sub_1000229D0(&a1->m_pivotPoint, (double *)&v58);
if ( ((unsigned int (__fastcall *)(GJRotationControl *, double))a1->m_rotationControl->isVisible)(
a1->m_rotationControl,
v25) )
{
m_scaleControl = a1->m_rotationControl;
}
else
{
if ( !((unsigned int (__fastcall *)(GJScaleControl *))a1->m_scaleControl->isVisible)(a1->m_scaleControl) )
{
if ( ((unsigned int (__fastcall *)(GJTransformControl *))a1->m_transformControl->isVisible)(a1->m_transformControl) )
{
m_transformControl = a1->m_transformControl;
v50 = (float32x2_t *)((__int64 (__fastcall *)(GJTransformControl *))m_transformControl->getPosition)(m_transformControl);
*(float32x2_t *)&v51 = sub_1000229DC(v50, v57, &v58);
((void (__fastcall *)(GJTransformControl *, float32x2_t *, double))m_transformControl->setPosition)(
m_transformControl,
&v58,
v51);
GJTransformControl::refreshControl(a1->m_transformControl);
}
goto LABEL_61;
}
m_scaleControl = a1->m_scaleControl;
}
v41 = (float32x2_t *)(*(__int64 (__fastcall **)(void *))(*(_QWORD *)m_scaleControl + 192LL))(m_scaleControl);
*(float32x2_t *)&v42 = sub_1000229DC(v41, v57, &v58);
(*(void (__fastcall **)(void *, float32x2_t *, double))(*(_QWORD *)m_scaleControl + 184LL))(
m_scaleControl,
&v58,
v42);
}
}
}
LABEL_61:
v43 = (float *)((__int64 (__fastcall *)(GameObject *))a1->m_snapObject->getPosition)(a1->m_snapObject);
if ( sub_100022A5C(v43, (float *)&a1->m_snapPosition) )
a1->m_noSnapUndo = 1;
v44 = (float32x2_t *)((__int64 (__fastcall *)(GameObject *))a1->m_snapObject->getPosition)(a1->m_snapObject);
sub_1000229F0(v44, (float32x2_t *)&a1->m_snapPosition, &v61);
if ( !a1->m_noSnapUndo )
{
m_undoObject = a1->m_undoObject;
if ( m_undoObject )
{
LevelEditorLayer::addToUndoList(a1->m_editorLayer, m_undoObject, 0);
v46 = a1->m_undoObject;
if ( v46 )
{
cocos2d::CCObject::release(v46);
a1->m_undoObject = nullptr;
}
}
}
goto LABEL_67;
}
if ( v12 || !a1->m_swipeActive )
{
if ( a1->m_isDraggingCamera )
{
a1->m_isDraggingCamera = 0;
goto LABEL_67;
}
EditorUI::getTouchPoint(a1, a2, v13);
v36 = cocos2d::ccpDistance(&a1->m_swipeStart, (const cocos2d::CCPoint *)v57);
if ( !a1->m_swipeSelected || v36 < 20.0 )
{
if ( a1->m_selectedMode != 3 )
{
if ( !a1->m_swipeModeTriggered )
{
v70.x = sub_1000229B8((__int64 *)v57, (__int64 *)&a1->m_swipeStart);
EditorUI::clickOnPosition(a1, v70);
}
goto LABEL_67;
}
cocos2d::CCNode::convertToNodeSpace(a1->m_editorLayer->m_objectLayer, &a1->m_swipeStart);
if ( !a1->m_snapObject || !a1->m_editingObject )
{
v37 = a1->m_editorLayer;
v69.x = sub_1000229B8((__int64 *)v56, (__int64 *)v57);
v38 = LevelEditorLayer::objectsAtPosition(v37, v69);
CycledObject = EditorUI::getCycledObject(a1, v38, 0);
if ( CycledObject )
{
v34 = CycledObject;
EditorUI::createUndoSelectObject(a1, 0);
if ( !a1->m_swipeActive )
{
EditorUI::selectObject(a1, v34, 0);
goto LABEL_67;
}
if ( GameVariable )
{
if ( a1->m_selectedObject )
{
EditorUI::deselectObject_1(a1);
}
else
{
v52 = (GameObject *)sub_10024A398((__int64)a1->m_selectedObjects);
if ( v52 )
{
GameObject::deselectObject(v52);
sub_10024A430((__int64)a1->m_selectedObjects, 1);
}
}
}
goto LABEL_43;
}
}
}
}
else
{
m_objectLayer = a1->m_editorLayer->m_objectLayer;
cocos2d::CCNode::convertToNodeSpace(m_objectLayer, &a1->m_swipeStart);
cocos2d::CCNode::convertToNodeSpace(m_objectLayer, &a1->m_swipeEnd);
if ( *(float *)&v62 <= v61.f32[0] )
v28 = *(float *)&v62;
else
v28 = v61.f32[0];
if ( *((float *)&v62 + 1) <= v61.f32[1] )
v29 = *((float *)&v62 + 1);
else
v29 = v61.f32[1];
sub_100022990(
(float *)v57,
v28,
v29,
vabds_f32(*(float *)&v62, v61.f32[0]),
vabds_f32(*((float *)&v62 + 1), v61.f32[1]));
EditorUI::getTouchPoint(a1, a2, v30);
if ( cocos2d::ccpDistance(&a1->m_swipeStart, v56) >= 8.0 )
{
v40 = sub_100022B98(v56, (__int64)v57);
v64.origin.x = *(float *)&v40;
v64.origin.y = v53;
v64.size.width = v54;
v64.size.height = v55;
EditorUI::selectObjectsInRect(a1, v64);
goto LABEL_67;
}
v31 = a1->m_editorLayer;
v68.x = sub_1000229B8((__int64 *)v56, (__int64 *)&v61);
v32 = LevelEditorLayer::objectsAtPosition(v31, v68);
v33 = EditorUI::getCycledObject(a1, v32, 0);
if ( v33 )
{
v34 = v33;
EditorUI::createUndoSelectObject(a1, 0);
LABEL_43:
v35 = (cocos2d::CCArray *)sub_10024A1B8((__int64)v34);
EditorUI::selectObjects(a1, v35, 0);
}
}
LABEL_67:
v47 = a1->m_snapObject;
if ( v47 )
{
if ( a1->m_snapObjectExists && a1->m_continuousSnap )
{
if ( v47->m_isSelected )
((void (__fastcall *)(GameObject *, __int64))v47->selectObject)(v47, 65280);
else
GameObject::deselectObject(v47);
}
a1->m_snapObject = nullptr;
}
*(_WORD *)&a1->m_swipeActive = 0;
a1->m_snapObjectExists = 0;
a1->m_noSnapUndo = 0;
sub_1000229D0(&a1->m_createPosition, (double *)&dword_10086E8B0);
a1->m_continuousSnap = 0;
a1->m_editingObject = 0;
sub_1000229D0(&a1->m_swipePosition, (double *)&a1->m_swipeStart);
a1->m_continueSwipe = 0;
m_canActivateControls = a1->m_canActivateControls;
EditorUI::updateButtons(a1);
++a1->m_cycledObjectIndex;
sub_10024A45C((__int64)a1->m_snapPositions);
if ( m_canActivateControls )
{
EditorUI::updateObjectInfoLabel(a1);
((void (__fastcall *)(EditorUI *))a1->updateScaleControl)(a1);
((void (__fastcall *)(EditorUI *))a1->updateTransformControl)(a1);
a1->m_canActivateControls = 0;
}
sub_1000229D0(&a1->m_lastTouchPoint, (double *)&v63);
}
}