//
// EditorUI::ccTouchMoved from 0x10004f4c0 to 0x10004fa2d (1389 bytes)
//
// 2 xrefs:
// > sub_10004FA30 @ 0x10004fa3c
// > ??> @ 0x1008b0480
//
// 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::ccTouchMoved(EditorUI *a1, cocos2d::CCTouch *a2, cocos2d::CCEvent *a3)
{
int m_nId; // eax
void *m_rotationControl; // rdi
LevelEditorLayer *m_editorLayer; // rcx
cocos2d::CCDirector *v8; // rax
double v9; // xmm0_8
bool m_continueSwipe; // al
double v11; // xmm0_8
cocos2d::CCDirector *v12; // rax
double v13; // xmm0_8
GameManager *v14; // rax
GameObject *m_snapObject; // rdi
unsigned int v16; // r15d
GameObject *v17; // r14
cocos2d::CCPoint v18; // xmm0_8
cocos2d::CCPoint v19; // xmm0_8
GameObject *m_selectedObject; // r14
cocos2d::CCPoint v21; // xmm0_8
double v22; // xmm0_8
void *m_scaleControl; // r14
__int64 v24; // rax
GJTransformControl *m_transformControl; // r14
__int64 v26; // rax
_BYTE v27[8]; // [rsp+0h] [rbp-50h] BYREF
cocos2d::CCPoint *p_m_cameraTest; // [rsp+8h] [rbp-48h]
cocos2d::CCPoint v29; // [rsp+10h] [rbp-40h] BYREF
char v30; // [rsp+18h] [rbp-38h] BYREF
__int16 v31; // [rsp+20h] [rbp-30h] BYREF
char v32; // [rsp+22h] [rbp-2Eh]
cocos2d::CCPoint TouchPoint; // 0:xmm0_8.8
m_nId = a2->m_nId;
if ( a1->m_rotationTouchID == m_nId )
{
cocos2d::CCNode::stopActionByTag(a1, 123);
m_rotationControl = a1->m_rotationControl;
LABEL_9:
(*(void (__fastcall **)(void *, cocos2d::CCTouch *, cocos2d::CCEvent *))(*(_QWORD *)m_rotationControl + 888LL))(
m_rotationControl,
a2,
a3);
return;
}
if ( a1->m_scaleTouchID == m_nId )
{
cocos2d::CCNode::stopActionByTag(a1, 123);
m_rotationControl = a1->m_scaleControl;
goto LABEL_9;
}
if ( a1->m_transformTouchID == m_nId )
{
cocos2d::CCNode::stopActionByTag(a1, 123);
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 )
{
cocos2d::CCTouch::getLocationInView((cocos2d::CCTouch *)&v29);
v8 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::convertToGL((cocos2d::CCDirector *)&v31, (const cocos2d::CCPoint *)v8);
sub_10028CC90();
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v31, (const cocos2d::CCPoint *)a1);
v9 = sub_10028CC90();
if ( a1->m_snapObjectExists )
{
m_continueSwipe = a1->m_continueSwipe;
if ( !m_continueSwipe )
{
if ( fabs(cocos2d::ccpDistance(&v29, &a1->m_swipeStart)) >= 4.0 )
{
a1->m_continueSwipe = 1;
LABEL_28:
cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)&v31,
(const cocos2d::CCPoint *)a1->m_editorLayer->m_objectLayer);
v13 = sub_10028CC90();
if ( !(unsigned __int8)sub_10028CDB0(&v29) )
{
if ( !a1->m_continuousSnap )
{
if ( a1->m_snapObject )
{
v14 = GameManager::sharedState();
if ( GameManager::getGameVariable(v14, "0008")
&& __ROR4__(
-1527099483
* (int)((float (__fastcall *)(GameObject *, double))a1->m_snapObject->getRotation)(
a1->m_snapObject,
v13)
+ 47721858,
1) <= 0x2D82D82u )
{
m_snapObject = a1->m_snapObject;
v32 = 50;
v31 = -25601;
((void (__fastcall *)(GameObject *, __int16 *))m_snapObject->setObjectColor)(m_snapObject, &v31);
}
}
}
a1->m_continuousSnap = 1;
p_m_cameraTest = &a1->m_cameraTest;
sub_10028CD00(&v31, &v29, &a1->m_cameraTest);
if ( (unsigned int)sub_100720070(a1->m_selectedObjects) )
{
if ( (unsigned int)sub_100720070(a1->m_selectedObjects) )
{
v16 = 0;
do
{
v17 = (GameObject *)sub_1007200C0(a1->m_selectedObjects, v16);
*(double *)&v18 = sub_10028CC60(&v30);
EditorUI::moveObject(a1, v17, v18);
++v16;
}
while ( v16 < (unsigned int)sub_100720070(a1->m_selectedObjects) );
}
}
else
{
m_selectedObject = a1->m_selectedObject;
*(double *)&v21 = sub_10028CC60(&v30);
EditorUI::moveObject(a1, m_selectedObject, v21);
}
sub_10028CC90();
sub_10028CCE0(&v30, &a1->m_pivotPoint);
v22 = sub_10028CC90();
if ( ((unsigned __int8 (__fastcall *)(GJRotationControl *, char *, double))a1->m_rotationControl->isVisible)(
a1->m_rotationControl,
&v30,
v22) )
{
m_scaleControl = a1->m_rotationControl;
}
else
{
if ( !((unsigned __int8 (__fastcall *)(GJScaleControl *))a1->m_scaleControl->isVisible)(a1->m_scaleControl) )
{
if ( ((unsigned __int8 (__fastcall *)(GJTransformControl *))a1->m_transformControl->isVisible)(a1->m_transformControl) )
{
m_transformControl = a1->m_transformControl;
v26 = ((__int64 (__fastcall *)(GJTransformControl *))m_transformControl->getPosition)(m_transformControl);
sub_10028CCE0(&v30, v26);
((void (__fastcall *)(GJTransformControl *, char *))m_transformControl->setPosition)(
m_transformControl,
&v30);
GJTransformControl::refreshControl(a1->m_transformControl);
}
goto LABEL_46;
}
m_scaleControl = a1->m_scaleControl;
}
v24 = (*(__int64 (__fastcall **)(void *))(*(_QWORD *)m_scaleControl + 192LL))(m_scaleControl);
sub_10028CCE0(&v30, v24);
(*(void (__fastcall **)(void *, char *))(*(_QWORD *)m_scaleControl + 184LL))(m_scaleControl, &v30);
}
LABEL_46:
cocos2d::CCNode::stopActionByTag(a1, 123);
return;
}
m_continueSwipe = a1->m_continueSwipe;
}
if ( !m_continueSwipe )
goto LABEL_46;
goto LABEL_28;
}
if ( !a1->m_spaceSwiping )
{
if ( a1->m_swipeEnabled
|| (v12 = cocos2d::CCDirector::sharedDirector(),
*(_BYTE *)(((__int64 (__fastcall *)(cocos2d::CCDirector *, __int16 *, double))v12->getKeyboardDispatcher)(
v12,
&v31,
v9)
+ 88))
|| a1->m_swipeModeTriggered )
{
EditorUI::getTouchPoint((EditorUI *)&v31, (cocos2d::CCTouch *)a1, (cocos2d::CCEvent *)a2);
if ( a1->m_selectedMode == 3 )
{
sub_10028CC90();
}
else
{
*(double *)&v19 = sub_10028CC60(v27);
EditorUI::getGridSnappedPos((EditorUI *)&v30, v19);
sub_10028CC90();
sub_10028CC90();
TouchPoint = EditorUI::getTouchPoint((EditorUI *)&v30, (cocos2d::CCTouch *)a1, (cocos2d::CCEvent *)a2);
EditorUI::clickOnPosition(a1, TouchPoint);
}
goto LABEL_46;
}
}
if ( a1->m_isDraggingCamera )
{
sub_10028CD00(&v31, &v29, &a1->m_cameraTest);
((void (__fastcall *)(cocos2d::CCLayer *, double))a1->m_editorLayer->m_objectLayer->getPosition)(
a1->m_editorLayer->m_objectLayer,
v9);
v11 = sub_10028CC60(&v30);
sub_10028CCE0(v27, &v30);
((void (__fastcall *)(cocos2d::CCLayer *, _BYTE *, double))a1->m_editorLayer->m_objectLayer->setPosition)(
a1->m_editorLayer->m_objectLayer,
v27,
v11);
EditorUI::constrainGameLayerPosition(a1, -100.0, -100.0);
sub_10028CC90();
EditorUI::updateSlider(a1);
return;
}
if ( fabs(cocos2d::ccpDistance(&v29, &a1->m_swipeStart)) >= 20.0 )
{
sub_10028CC90();
a1->m_isDraggingCamera = 1;
goto LABEL_46;
}
}
}