//
// GJUINode::activeRangeTouchTest from 0x5c6678 to 0x5c683c (452 bytes)
//
// 2 xrefs:
// > GJUINode::activeTouchTest @ 0x5c68d0
// > ??> @ 0x73f38
//
// 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
//
// local variable allocation has failed, the output may be wrong!
int GJUINode::activeRangeTouchTest(GJUINode *a1, cocos2d::CCPoint a2)
{
float *v2; // x1
float *v3; // x22
float *v5; // x0
float v6; // s8
float v7; // s1
float v8; // s2
float x; // s0
int v10; // w22
float width; // s1
float v12; // s2
float v13; // s1
float v14; // s4
float v15; // s2
float height; // s1
float v17; // s4
float v18; // s0
float y; // s1
cocos2d::CCSprite *m_firstSprite; // x2
float m_radius; // s0
float v23; // s2
cocos2d::CCPoint v24; // [xsp+40h] [xbp+40h] BYREF
v3 = v2;
v5 = (float *)((__int64 (__fastcall *)(cocos2d::CCSprite *, long double, long double))a1->m_firstSprite->getPosition)(
a1->m_firstSprite,
*(long double *)&a2.x,
*(long double *)&a2.y);
cocos2d::CCPoint::CCPoint(&v24, *v5, v3[1] + 40.0);
v6 = *v3;
v7 = v6 - a1->m_firstSprite->getPosition(a1->m_firstSprite)->x;
v8 = fabsf(v7);
if ( v8 < a1->m_deadzone )
{
x = v24.x;
v10 = 0;
goto LABEL_3;
}
m_radius = a1->m_radius;
if ( v8 > m_radius )
{
if ( v7 > 0.0 )
{
v23 = *v3;
v10 = 3;
x = v23 - m_radius;
goto LABEL_3;
}
x = m_radius + *v3;
}
else
{
x = v24.x;
}
if ( v7 <= 0.0 )
v10 = 2;
else
v10 = 3;
LABEL_3:
width = a1->m_rect.size.width;
v12 = -width;
v13 = width * 0.5;
v14 = x;
v15 = v12 * 0.5;
if ( v13 <= x )
v14 = v13;
if ( v14 > v15 )
{
v15 = x;
if ( v13 <= x )
v15 = v13;
}
height = a1->m_rect.size.height;
v17 = (float)(height * 0.5) + 40.0;
v24.x = v15;
v18 = 40.0 - (float)(height * 0.5);
y = v24.y;
if ( v17 <= v24.y )
y = v17;
if ( y > v18 )
{
v18 = v24.y;
if ( v17 <= v24.y )
v18 = v17;
}
m_firstSprite = a1->m_firstSprite;
v24.y = v18;
m_firstSprite->setVisible(m_firstSprite, 1);
a1->m_firstSprite->setPosition(a1->m_firstSprite, &v24);
return v10;
}