//
// GJTransformControl::ccTouchBegan from 0x39d5fc to 0x39d72c (304 bytes)
//
// 1 xrefs:
// > `non-virtual thunk to'GJTransformControl::ccTouchBegan @ 0x39d734
//
// 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
//
bool GJTransformControl::ccTouchBegan(GJTransformControl *a1, cocos2d::CCTouch *a2, cocos2d::CCEvent *a3)
{
int v5; // r5
const cocos2d::CCPoint *v6; // r1
cocos2d::CCSprite *v7; // r0
int v8; // r2
bool v9; // r3
__int16 m_transformButtonType; // r1
cocos2d::CCSprite *v11; // r0
int v12; // r0
int v13; // r2
bool v14; // r3
cocos2d::CCSprite *v15; // r0
float v16; // r0
int v17; // r2
bool v18; // r3
cocos2d::CCSprite *v19; // r0
float v20; // r0
int v21; // r2
bool v22; // r3
GJTransformControlDelegate *m_delegate; // r0
bool result; // r0
cocos2d::CCPoint v25; // [sp+Ch] [bp-40h] BYREF
cocos2d::CCPoint v26; // [sp+14h] [bp-38h] BYREF
cocos2d::CCPoint v27; // [sp+1Ch] [bp-30h] BYREF
cocos2d::CCPoint v28; // [sp+24h] [bp-28h] BYREF
cocos2d::CCPoint v29; // [sp+2Ch] [bp-20h] BYREF
cocos2d::CCRect v30; // [sp+34h] [bp-18h] BYREF
if ( a1->m_touchID != -1 )
return 0;
cocos2d::CCTouch::getLocation(&v25, a2);
cocos2d::CCNode::convertToNodeSpace(&v26, a1->m_mainNodeParent, &v25);
cocos2d::CCNode::convertToNodeSpace(&v27, a1, &v25);
cocos2d::CCPoint::CCPoint(&v28);
v5 = 1;
while ( 1 )
{
if ( v5 == 12 )
v6 = &v27;
else
v6 = v5 == 1 ? &v27 : &v26;
cocos2d::CCPoint::CCPoint(&v29, v6);
v7 = GJTransformControl::spriteByTag(a1, v5);
cocos2d::CCNode::boundingBox(&v30, v7);
if ( cocos2d::CCRect::containsPoint(&v30, &v29) )
break;
if ( ++v5 == 13 )
goto LABEL_11;
}
a1->m_transformButtonType = v5;
cocos2d::CCPoint::operator=((PlayerObject *)&v28, COERCE_FLOAT(&v29), v8, v9);
LABEL_11:
m_transformButtonType = a1->m_transformButtonType;
if ( !m_transformButtonType )
return 0;
a1->m_touchID = a2->m_nId;
v11 = GJTransformControl::spriteByTag(a1, m_transformButtonType);
v12 = (int)v11->getPosition(v11);
cocos2d::CCPoint::operator-(&v30, v12, &v28);
cocos2d::CCPoint::operator=((PlayerObject *)&a1->m_cursorDifference, COERCE_FLOAT(&v30), v13, v14);
v15 = GJTransformControl::spriteByTag(a1, 7);
v16 = ((float (__fastcall *)(cocos2d::CCSprite *))v15->getPosition)(v15);
cocos2d::CCPoint::operator=((PlayerObject *)&a1->m_topRightPosition, v16, v17, v18);
v19 = GJTransformControl::spriteByTag(a1, 8);
v20 = ((float (__fastcall *)(cocos2d::CCSprite *))v19->getPosition)(v19);
cocos2d::CCPoint::operator=((PlayerObject *)&a1->m_bottomLeftPosition, v20, v21, v22);
m_delegate = a1->m_delegate;
if ( m_delegate )
m_delegate->transformChangeBegin(m_delegate);
result = 1;
if ( a1->m_transformButtonType == 12 )
a1->m_rotationX = a1->m_rotationY;
return result;
}