//
// GJBaseGameLayer::damagingObjectsInRect from 0x1001e536c to 0x1001e575c (1008 bytes)
//
// 1 xrefs:
// > PlayerObject::spiderTestJumpInternal @ 0x100224df4
//
// 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!
cocos2d::CCArray *__fastcall GJBaseGameLayer::damagingObjectsInRect(GJBaseGameLayer *a1, cocos2d::CCRect a2, bool a3)
{
int v3; // w2
int v4; // w19
float *v5; // x20
double v7; // d0
__int64 v8; // x0
float v9; // s0
float m_sectionXFactor; // s1
float v11; // s1
int v12; // w8
float v13; // s1
float v14; // s0
float v15; // s0
float v16; // s2
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer end; // x9
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer begin; // x10
float v19; // s0
float v20; // s0
float v21; // s0
float v22; // s1
float m_sectionYFactor; // s2
float v24; // s2
float v25; // s2
float v26; // s1
float v27; // s1
__int64 v28; // x28
std::vector *, std::allocator *>> *v29; // x8
__int64 v30; // x9
int v31; // w8
__int64 v32; // x25
std::vector *v33; // x27
__int64 v34; // x8
unsigned __int64 v35; // x26
__int64 v36; // x22
GameObject *v37; // x23
__int64 v38; // x0
float ObjectRadius; // s8
GJBaseGameLayer *v40; // x0
float v41; // s6
OBB2D *v42; // x0
float v44; // s1
float v45; // s2
float v46; // s3
int v47; // [xsp+18h] [xbp-B8h]
int v48; // [xsp+24h] [xbp-ACh]
int v49; // [xsp+28h] [xbp-A8h]
int v50; // [xsp+34h] [xbp-9Ch]
cocos2d::CCArray *v51; // [xsp+38h] [xbp-98h]
__int64 v52; // [xsp+40h] [xbp-90h] BYREF
__int64 v53; // [xsp+48h] [xbp-88h] BYREF
__int64 v54; // [xsp+58h] [xbp-78h] BYREF
float v55[4]; // [xsp+60h] [xbp-70h] BYREF
cocos2d::CCRect v56; // 0:kr00_16.16
cocos2d::CCPoint v57; // 0:s4.4,4:s5.4
cocos2d::CCRect v58; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v4 = v3;
v5 = (float *)a3;
v7 = sub_100022B98(v55, a3);
v56.origin.x = *(float *)&v7;
v56.origin.y = v44;
v56.size.width = v45;
v56.size.height = v46;
GJBaseGameLayer::updateOBB2(a1, v56);
v51 = (cocos2d::CCArray *)sub_10024A15C(v8);
v9 = *v5;
if ( *v5 <= 0.0
|| ((m_sectionXFactor = a1->m_sectionXFactor, v9 >= 10000000.0)
? (v11 = m_sectionXFactor * 10000000.0)
: (v11 = v9 * m_sectionXFactor),
(float)(v11 + -1.0) <= 0.0) )
{
v12 = 0;
}
else
{
v12 = (int)(float)(v11 + -1.0);
}
v13 = v9 + v5[2];
v14 = 0.0;
if ( v13 > 0.0 )
{
v15 = a1->m_sectionXFactor;
if ( v13 >= 10000000.0 )
v14 = v15 * 10000000.0;
else
v14 = v13 * v15;
}
v16 = v14 + 1.0;
end = a1->m_nonEffectObjects.__end_;
begin = a1->m_nonEffectObjects.__begin_;
v19 = (float)(unsigned __int64)(end - begin - 1);
if ( v16 <= v19 )
{
v20 = 0.0;
if ( v13 > 0.0 )
{
v21 = a1->m_sectionXFactor;
if ( v13 >= 10000000.0 )
v20 = v21 * 10000000.0;
else
v20 = v13 * v21;
}
v19 = v20 + 1.0;
}
v22 = v5[1];
if ( v22 <= 0.0
|| ((m_sectionYFactor = a1->m_sectionYFactor, v22 >= 10000000.0)
? (v24 = m_sectionYFactor * 10000000.0)
: (v24 = v22 * m_sectionYFactor),
(float)(v24 + -1.0) <= 0.0) )
{
v49 = 0;
}
else
{
v49 = (int)(float)(v24 + -1.0);
}
v25 = v22 + v5[3];
v26 = 0.0;
if ( v25 > 0.0 )
{
v27 = a1->m_sectionYFactor;
if ( v25 >= 10000000.0 )
v26 = v27 * 10000000.0;
else
v26 = v25 * v27;
}
if ( begin != end && v12 <= (int)v19 )
{
v47 = (int)(float)(v26 + 1.0);
v28 = v12;
v48 = (int)v19 + 1;
while ( 1 )
{
v29 = a1->m_nonEffectObjects.__begin_[v28];
if ( v29 )
{
v30 = (char *)v29->__end_ - (char *)v29->__begin_;
v31 = v47;
if ( (v30 >> 3) - 1 < (unsigned __int64)v47 )
v31 = ((unsigned __int64)v30 >> 3) - 1;
}
else
{
v31 = -1;
}
if ( v49 <= v31 )
break;
LABEL_57:
if ( v48 == (_DWORD)++v28 )
return v51;
}
v50 = v31 + 1;
v32 = v49;
while ( 1 )
{
v33 = a1->m_nonEffectObjects.__begin_[v28]->__begin_[v32];
if ( v33 )
{
v34 = (unsigned int)a1->m_nonEffectObjectsSizes.__begin_[v28]->__begin_[v32];
if ( (int)v34 >= 1 )
break;
}
LABEL_56:
if ( v50 == (_DWORD)++v32 )
goto LABEL_57;
}
v35 = 0;
v36 = 8 * v34;
while ( 1 )
{
v37 = v33->__begin_[v35 / 8];
if ( ((unsigned int (__fastcall *)(GameObject *))v37->getType)(v37) != 2
&& ((unsigned int (__fastcall *)(GameObject *))v37->getType)(v37) != 47
|| !v37->m_isActivated && (!v4 || GameObject::getGroupDisabled(v37)) )
{
goto LABEL_55;
}
v38 = ((__int64 (__fastcall *)(GameObject *))v37->getObjectRect)(v37);
sub_100022B98(v55, v38);
if ( v37->m_objectRadius <= 0.0 )
{
if ( !sub_100022CB0(v5, v55) )
goto LABEL_55;
if ( v37->m_shouldUseOuterOb )
{
v42 = (OBB2D *)((__int64 (__fastcall *)(GameObject *))v37->getOrientedBox)(v37);
if ( !OBB2D::overlaps1Way(v42) || !OBB2D::overlaps1Way(a1->m_obb2) )
goto LABEL_55;
}
}
else
{
ObjectRadius = GameObject::getObjectRadius(v37);
((void (__fastcall *)(__int64 *__return_ptr, GameObject *))v37->getRealPosition)(&v54, v37);
sub_100022B98(&v53, (__int64)v5);
sub_1000229B8(&v52, &v54);
v58.origin.x = ObjectRadius;
if ( !GJBaseGameLayer::rectIntersectsCircle(v40, v58, v57, v41) )
goto LABEL_55;
}
sub_10024A2D0(v51, v37);
LABEL_55:
v35 += 8LL;
if ( v36 == v35 )
goto LABEL_56;
}
}
return v51;
}