//
// GJUINode::activeRangeTouchTest from 0x30cfc0 to 0x30d122 (354 bytes)
//
// 1 xrefs:
// > GJUINode::activeTouchTest @ 0x30d174
//
// 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
//
int GJUINode::activeRangeTouchTest(GJUINode *a1, cocos2d::CCPoint a2)
{
float x; // r6
float *v4; // r0
float v5; // s17
float v6; // s14
float v7; // s15
float m_radius; // s13
float v9; // s15
int v10; // r6
float width; // s15
float v12; // s12
float v13; // s15
float v14; // s11
float height; // s15
float v16; // s16
float v17; // s13
float y; // s12
cocos2d::CCSprite *m_firstSprite; // r0
cocos2d::CCPoint v21; // [sp+4h] [bp+0h] BYREF
x = a2.x;
v4 = (float *)((int (__fastcall *)(cocos2d::CCSprite *, _DWORD, _DWORD))a1->m_firstSprite->getPosition)(
a1->m_firstSprite,
LODWORD(a2.x),
LODWORD(a2.y));
cocos2d::CCPoint::CCPoint(&v21, *v4, *(float *)(LODWORD(x) + 4) + 40.0);
v5 = *(float *)LODWORD(x);
v6 = v5 - a1->m_firstSprite->getPosition(a1->m_firstSprite)->x;
v7 = fabsf(v6);
if ( v7 >= a1->m_deadzone )
{
m_radius = a1->m_radius;
if ( v7 > m_radius )
{
v9 = *(float *)LODWORD(x);
if ( v6 > 0.0 )
{
v10 = 3;
v21.x = v9 - m_radius;
goto LABEL_10;
}
v21.x = v9 + m_radius;
}
if ( v6 <= 0.0 )
v10 = 2;
else
v10 = 3;
goto LABEL_10;
}
v10 = 0;
LABEL_10:
width = a1->m_rect.size.width;
v12 = -(float)(width * 0.5);
v13 = width * 0.5;
if ( v13 > v21.x )
v14 = v21.x;
else
v14 = v13;
if ( v12 < v14 )
{
if ( v13 > v21.x )
v12 = v21.x;
else
v12 = v13;
}
height = a1->m_rect.size.height;
v21.x = v12;
v16 = (float)(height * 0.5) + 40.0;
v17 = 40.0 - (float)(height * 0.5);
if ( v16 > v21.y )
y = v21.y;
else
y = (float)(height * 0.5) + 40.0;
if ( v17 < y )
{
if ( v16 > v21.y )
v17 = v21.y;
else
v17 = (float)(height * 0.5) + 40.0;
}
m_firstSprite = a1->m_firstSprite;
v21.y = v17;
m_firstSprite->setVisible(m_firstSprite, 1);
a1->m_firstSprite->setPosition(a1->m_firstSprite, &v21);
return v10;
}