//
// GJBaseGameLayer::damagingObjectsInRect from 0x100122880 to 0x100122d7b (1275 bytes)
//
// 3 xrefs:
// > PlayerObject::spiderTestJumpInternal @ 0x10040da5c
// > PlayerObject::spiderTestJumpX @ 0x10040ef9e
// > PlayerObject::spiderTestJumpY @ 0x10040fdf1
//
// 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; // edx
float v4; // xmm3_4
GJBaseGameLayer *v5; // r14
OBB2D *m_obb2; // rbx
__int64 v7; // rax
float v8; // xmm4_4
float v9; // xmm0_4
int v10; // eax
float m_sectionXFactor; // xmm1_4
float v12; // xmm1_4
float v13; // xmm0_4
float v14; // xmm4_4
float v15; // xmm4_4
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer begin; // rcx
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer end; // rdx
__int64 v18; // rsi
cocos2d::CCPoint v19; // xmm2_8
float v20; // xmm0_4
float m_sectionYFactor; // xmm3_4
float v22; // xmm0_4
__int64 v23; // rdx
std::vector *, std::allocator *>> *v24; // rcx
__int64 v25; // rax
int v26; // esi
__int64 v27; // rcx
std::__vector_base *, std::allocator *>>::pointer v28; // rax
std::vector *v29; // rbx
__int64 v30; // r13
__int64 v31; // r15
GameObject *v32; // r14
double v33; // xmm0_8
OBB2D *v34; // r12
_BYTE v36[16]; // [rsp+0h] [rbp-C0h] BYREF
char v37; // [rsp+10h] [rbp-B0h] BYREF
char v38[8]; // [rsp+18h] [rbp-A8h] BYREF
std::vector *v39; // [rsp+20h] [rbp-A0h]
__int64 v40; // [rsp+28h] [rbp-98h]
unsigned __int64 v41; // [rsp+30h] [rbp-90h]
__int64 v42; // [rsp+38h] [rbp-88h]
__int64 v43; // [rsp+40h] [rbp-80h]
__int64 v44; // [rsp+48h] [rbp-78h]
char v45[8]; // [rsp+50h] [rbp-70h] BYREF
float v46; // [rsp+58h] [rbp-68h]
float v47; // [rsp+5Ch] [rbp-64h]
float ObjectRadius; // [rsp+60h] [rbp-60h]
int v49; // [rsp+64h] [rbp-5Ch]
int v50; // [rsp+68h] [rbp-58h]
int v51; // [rsp+6Ch] [rbp-54h]
cocos2d::CCArray *v52; // [rsp+70h] [rbp-50h]
GJBaseGameLayer *v53; // [rsp+78h] [rbp-48h]
int width; // [rsp+84h] [rbp-3Ch]
__int64 v55; // [rsp+88h] [rbp-38h]
int v56; // [rsp+94h] [rbp-2Ch]
cocos2d::CCRect v57; // 0:xmm0_8.8,8:xmm1_8.8
v49 = v3;
v5 = a1;
sub_10028D180(v45);
m_obb2 = a1->m_obb2;
sub_10028CBE0(v38, v46 * 0.5, 0.5 * v47);
sub_10028CCE0(v36, v45);
OBB2D::calculateWithCenter(m_obb2, (cocos2d::CCPoint)LODWORD(v46), v47, 0.0, v4);
v7 = sub_10071F9E0(m_obb2, v36);
v8 = 0.0;
v52 = (cocos2d::CCArray *)v7;
v55 = a3;
v9 = *(float *)a3;
v10 = 0;
if ( *(float *)a3 > 0.0 )
{
m_sectionXFactor = a1->m_sectionXFactor;
v12 = v9 >= 10000000.0 ? m_sectionXFactor * 10000000.0 : m_sectionXFactor * v9;
v4 = 0.0;
if ( (float)(v12 + -1.0) > 0.0 )
v10 = (int)(float)(v12 + -1.0);
}
v13 = v9 + *(float *)(v55 + 8);
if ( v13 > 0.0 )
{
v14 = a1->m_sectionXFactor;
if ( v13 >= 10000000.0 )
v8 = v14 * 10000000.0;
else
v8 = v14 * v13;
}
v15 = v8 + 1.0;
begin = a1->m_nonEffectObjects.__begin_;
end = a1->m_nonEffectObjects.__end_;
v18 = end - begin - 1;
if ( v18 < 0 )
{
v57.size.height = 0.0;
v57.size.width = (float)(int)(((unsigned __int64)v18 >> 1) | v18 & 1)
+ (float)(int)(((unsigned __int64)v18 >> 1) | v18 & 1);
if ( v15 > v57.size.width )
goto LABEL_20;
}
else
{
v57.size.height = 0.0;
v57.size.width = (float)(int)v18;
if ( v15 > (float)(int)v18 )
goto LABEL_20;
}
v57.size = 0;
if ( v13 > 0.0 )
{
v57.size = (cocos2d::CCSize)LODWORD(a1->m_sectionXFactor);
if ( v13 >= 10000000.0 )
v57.size.width = v57.size.width * 10000000.0;
else
v57.size.width = v57.size.width * v13;
}
v57.size.width = v57.size.width + 1.0;
LABEL_20:
v19 = (cocos2d::CCPoint)*(unsigned int *)(v55 + 4);
v56 = 0;
v20 = 0.0;
if ( v19.x > 0.0 )
{
m_sectionYFactor = a1->m_sectionYFactor;
v4 = v19.x >= 10000000.0 ? m_sectionYFactor * 10000000.0 : m_sectionYFactor * v19.x;
if ( (float)(v4 + -1.0) > 0.0 )
{
v4 = v4 + -1.0;
v56 = (int)v4;
}
}
v19.x = v19.x + *(float *)(v55 + 12);
if ( v19.x <= 0.0 )
{
LABEL_29:
if ( begin == end )
return v52;
goto LABEL_30;
}
v22 = a1->m_sectionYFactor;
if ( v19.x < 10000000.0 )
{
v20 = v22 * v19.x;
goto LABEL_29;
}
v20 = v22 * 10000000.0;
if ( begin == end )
return v52;
LABEL_30:
width = (int)v57.size.width;
if ( v10 <= (int)v57.size.width )
{
v51 = (int)(float)(v20 + 1.0);
v41 = v51;
v42 = v56;
v23 = v10;
++width;
v53 = a1;
while ( 1 )
{
v24 = v5->m_nonEffectObjects.__begin_[v23];
if ( v24 )
break;
v26 = -1;
if ( v56 <= -1 )
goto LABEL_39;
LABEL_32:
if ( width == (_DWORD)++v23 )
return v52;
}
v25 = v24->__end_ - v24->__begin_;
v26 = v51;
if ( v25 - 1 < v41 )
v26 = v25 - 1;
if ( v56 > v26 )
goto LABEL_32;
LABEL_39:
v27 = v42;
v44 = v23;
v50 = v26 + 1;
do
{
v28 = v5->m_nonEffectObjects.__begin_[v23]->__begin_;
v43 = v27;
v29 = v28[v27];
if ( v29 )
{
v30 = v53->m_nonEffectObjectsSizes.__begin_[v44]->__begin_[v43];
if ( v30 > 0 )
{
v31 = 0;
v39 = v28[v27];
v40 = v30;
do
{
v32 = v29->__begin_[v31];
if ( (((unsigned int (__fastcall *)(GameObject *))v32->getType)(v32) == 2
|| ((unsigned int (__fastcall *)(GameObject *))v32->getType)(v32) == 47)
&& (v32->m_isActivated || (_BYTE)v49 && !GameObject::getGroupDisabled(v32)) )
{
((void (__fastcall *)(GameObject *))v32->getObjectRect)(v32);
sub_10028D180(v45);
*(_QWORD *)&v33 = LODWORD(v32->m_objectRadius);
if ( *(float *)&v33 <= 0.0 )
{
if ( (unsigned __int8)sub_10028D320(v55, v45, v33) )
{
if ( !v32->m_shouldUseOuterOb
|| (v34 = (OBB2D *)((__int64 (__fastcall *)(GameObject *))v32->getOrientedBox)(v32),
OBB2D::overlaps1Way(v34))
&& OBB2D::overlaps1Way(v53->m_obb2) )
{
sub_10071FCD0(v52, v32);
}
}
}
else
{
ObjectRadius = GameObject::getObjectRadius(v32);
((void (__fastcall *)(char *, GameObject *))v32->getRealPosition)(v38, v32);
sub_10028D180(v36);
sub_10028CC60(&v37);
v57.origin = (cocos2d::CCPoint)LODWORD(ObjectRadius);
if ( GJBaseGameLayer::rectIntersectsCircle((GJBaseGameLayer *)&v37, v57, v19, v4) )
sub_10071FCD0(v52, v32);
v29 = v39;
v30 = v40;
}
}
++v31;
}
while ( v30 != v31 );
}
}
v27 = v43 + 1;
v5 = v53;
v23 = v44;
}
while ( v50 != (_DWORD)v43 + 1 );
goto LABEL_32;
}
return v52;
}