//
// GJBaseGameLayer::rectIntersectsCircle from 0x8591b8 to 0x8593a4 (492 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::damagingObjectsInRect @ 0x859838
// > ??> @ 0x2d7c8
//
// 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 GJBaseGameLayer::rectIntersectsCircle(GJBaseGameLayer *a1, cocos2d::CCRect a2, cocos2d::CCPoint a3, float a4)
{
cocos2d::CCRect *v4; // x1
const cocos2d::CCPoint *v5; // x2
cocos2d::CCRect *v6; // x19
float x; // s11
const cocos2d::CCPoint *v8; // x21
float v9; // s0
float v10; // s8
float v11; // s0
float v12; // s12
float v13; // s0
float v14; // s10
float v15; // s0
float v16; // s9
float v18; // s0
float y; // s0
cocos2d::CCPoint v20; // [xsp+58h] [xbp+58h] BYREF
cocos2d::CCPoint v21; // [xsp+60h] [xbp+60h] BYREF
cocos2d::CCPoint v22; // [xsp+68h] [xbp+68h] BYREF
cocos2d::CCPoint v23; // [xsp+70h] [xbp+70h] BYREF
v6 = v4;
x = a2.origin.x;
v8 = v5;
cocos2d::CCRect::getMaxX(v4);
v10 = v9;
cocos2d::CCRect::getMinX(v6);
v12 = v11;
cocos2d::CCRect::getMaxY(v6);
v14 = v13;
cocos2d::CCRect::getMinY(v6);
v16 = v15;
if ( (unsigned __int8)cocos2d::CCRect::containsPoint(v6, v8) )
return 1;
cocos2d::CCPoint::CCPoint(&v20, v10, v14);
if ( fabsf(cocos2d::ccpDistance(&v20, v8)) < x )
return 1;
cocos2d::CCPoint::CCPoint(&v21, v10, v16);
if ( x > fabsf(cocos2d::ccpDistance(&v21, v8)) )
return 1;
cocos2d::CCPoint::CCPoint(&v22, v12, v16);
if ( x > fabsf(cocos2d::ccpDistance(&v22, v8)) )
return 1;
cocos2d::CCPoint::CCPoint(&v23, v12, v14);
if ( x > fabsf(cocos2d::ccpDistance(&v23, v8)) )
return 1;
cocos2d::CCPoint::CCPoint(&v23, v8);
v18 = v23.x;
if ( v10 < v23.x )
{
v18 = v10;
v23.x = v10;
}
if ( v12 > v18 )
v23.x = v12;
y = v23.y;
if ( v16 > v23.y )
{
y = v16;
v23.y = v16;
}
if ( v14 < y )
v23.y = v14;
return x > cocos2d::ccpDistance(&v23, v8);
}