//
// GJBaseGameLayer::damagingObjectsInRect from 0x140211620 to 0x140211d48 (1832 bytes)
//
// 5 xrefs:
// > PlayerObject::spiderTestJumpInternal @ 0x1403948c4
// > ??> @ 0x14067f04c
// > ??> @ 0x14067f05c
// > ??> @ 0x14067f098
// > ??> @ 0x1406ccf60
//
// 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
//
cocos2d::CCArray *GJBaseGameLayer::damagingObjectsInRect(GJBaseGameLayer *a1, cocos2d::CCRect *a2, bool a3)
{
float v3; // xmm0_4
__int64 v5; // rbx
__int64 v6; // rcx
__int64 v7; // rax
struct cocos2d::CCRect *v8; // rbx
cocos2d::CCArray *v9; // r14
float x; // xmm1_4
float v11; // xmm3_4
float m_sectionXFactor; // xmm3_4
float v13; // xmm3_4
float v14; // xmm3_4
float v15; // xmm3_4
float v16; // xmm1_4
int v17; // r10d
float v18; // xmm3_4
float v19; // xmm3_4
std::_Vector_val *, std::allocator *>> *>>::pointer Mylast; // r8
std::_Vector_val *, std::allocator *>> *>>::pointer Myfirst; // r9
__int64 v22; // rcx
float v23; // xmm0_4
float v24; // xmm0_4
float v25; // xmm0_4
float y; // xmm1_4
float *p_m_sectionYFactor; // rax
int v28; // edx
float v29; // xmm3_4
float v30; // xmm3_4
float v31; // xmm3_4
float v32; // xmm3_4
float v33; // xmm3_4
float v34; // xmm1_4
int v35; // ecx
__m128 y_low; // xmm0
int v37; // r11d
__int64 v38; // r9
__int64 v39; // r10
std::_Simple_types *, std::allocator *>> *>::value_type v40; // rcx
__int64 v41; // rdx
int v42; // edx
__int64 v43; // r8
std::_Simple_types *>::value_type v44; // r12
__int64 v45; // rbp
__int64 v46; // r15
float *v47; // rdi
const struct cocos2d::CCRect *v48; // rax
float v49; // xmm6_4
float v50; // xmm1_4
const struct cocos2d::CCPoint *v51; // rax
const struct cocos2d::CCPoint *v52; // rsi
cocos2d::CCRect *v53; // rbx
float MaxX; // xmm7_4
float MinX; // xmm8_4
float MaxY; // xmm10_4
__m128 v57; // xmm9
cocos2d *v58; // rax
const struct cocos2d::CCPoint *v59; // r8
cocos2d *v60; // rax
const struct cocos2d::CCPoint *v61; // r8
cocos2d *v62; // rax
const struct cocos2d::CCPoint *v63; // r8
cocos2d *v64; // rax
const struct cocos2d::CCPoint *v65; // r8
const struct cocos2d::CCPoint *v66; // r8
float v67; // xmm0_4
OBB2D *v69; // rax
OBB2D *v70; // r9
__int64 v71; // [rsp+30h] [rbp-138h]
_BYTE v72[8]; // [rsp+38h] [rbp-130h] BYREF
__int64 v73; // [rsp+40h] [rbp-128h]
__int64 v74; // [rsp+48h] [rbp-120h]
__int64 v75; // [rsp+50h] [rbp-118h]
cocos2d::CCRect v76; // [rsp+58h] [rbp-110h] BYREF
cocos2d::CCPoint v77; // [rsp+68h] [rbp-100h] BYREF
cocos2d::CCRect v78; // [rsp+90h] [rbp-D8h] BYREF
cocos2d::CCPoint v79; // [rsp+170h] [rbp+8h] BYREF
cocos2d::CCRect *v80; // [rsp+178h] [rbp+10h]
int v81; // [rsp+180h] [rbp+18h]
__int64 v82; // [rsp+188h] [rbp+20h]
LOBYTE(v81) = a3;
v80 = a2;
v5 = cocos2d::CCRect::CCRect(&v76, a2);
cocos2d::CCPoint::CCPoint(v3, *(float *)(v5 + 8) * 0.5);
cocos2d::CCPoint::operator+(v5, &v79);
OBB2D::calculateWithCenter(a1->m_obb2, (cocos2d::CCPoint)&v79, *(float *)(v5 + 8), *(float *)(v5 + 12), 0.0);
v7 = cocos2d::CCArray::create(v6);
v8 = v80;
v9 = (cocos2d::CCArray *)v7;
x = v80->origin.x;
if ( v80->origin.x > 0.0 )
{
m_sectionXFactor = a1->m_sectionXFactor;
if ( x < 10000000.0 )
v11 = x * m_sectionXFactor;
else
v11 = m_sectionXFactor * 10000000.0;
}
else
{
v11 = 0.0;
}
if ( (float)(v11 - 1.0) >= 0.0 )
{
if ( x > 0.0 )
{
v15 = a1->m_sectionXFactor;
if ( x < 10000000.0 )
v14 = x * v15;
else
v14 = v15 * 10000000.0;
}
else
{
v14 = 0.0;
}
v13 = v14 - 1.0;
}
else
{
v13 = 0.0;
}
v16 = x + v80->size.width;
v17 = (int)v13;
if ( v16 > 0.0 )
{
v19 = a1->m_sectionXFactor;
if ( v16 < 10000000.0 )
v18 = v19 * v16;
else
v18 = v19 * 10000000.0;
}
else
{
v18 = 0.0;
}
Mylast = a1->m_nonEffectObjects._Mypair._Myval2._Mylast;
Myfirst = a1->m_nonEffectObjects._Mypair._Myval2._Myfirst;
v22 = Mylast - Myfirst - 1;
if ( v22 < 0 )
v23 = (float)(v22 & 1 | (unsigned int)((unsigned __int64)v22 >> 1))
+ (float)(v22 & 1 | (unsigned int)((unsigned __int64)v22 >> 1));
else
v23 = (float)(int)v22;
if ( v23 > (float)(v18 + 1.0) )
{
if ( v16 > 0.0 )
{
v25 = a1->m_sectionXFactor;
if ( v16 < 10000000.0 )
v24 = v25 * v16;
else
v24 = v25 * 10000000.0;
}
else
{
v24 = 0.0;
}
v23 = v24 + 1.0;
}
y = v80->origin.y;
p_m_sectionYFactor = &a1->m_sectionYFactor;
v28 = (int)v23;
if ( y > 0.0 )
{
v30 = *p_m_sectionYFactor;
if ( y < 10000000.0 )
v29 = y * v30;
else
v29 = v30 * 10000000.0;
}
else
{
v29 = 0.0;
}
if ( (float)(v29 - 1.0) >= 0.0 )
{
if ( y > 0.0 )
{
v33 = *p_m_sectionYFactor;
if ( y < 10000000.0 )
v32 = y * v33;
else
v32 = v33 * 10000000.0;
}
else
{
v32 = 0.0;
}
v31 = v32 - 1.0;
}
else
{
v31 = 0.0;
}
v34 = y + v80->size.height;
v35 = (int)v31;
if ( v34 > 0.0 )
{
y_low = (__m128)*(unsigned int *)p_m_sectionYFactor;
if ( v34 < 10000000.0 )
y_low.m128_f32[0] = y_low.m128_f32[0] * v34;
else
y_low.m128_f32[0] = y_low.m128_f32[0] * 10000000.0;
}
else
{
y_low = 0;
}
v37 = (int)(float)(y_low.m128_f32[0] + 1.0);
v81 = v37;
if ( Myfirst != Mylast )
{
v38 = v17;
v71 = v17;
v75 = v28;
if ( v17 <= (__int64)v28 )
{
v39 = v35;
v74 = v35;
do
{
v40 = a1->m_nonEffectObjects._Mypair._Myval2._Myfirst[v38];
if ( v40 )
{
v41 = v40->_Mypair._Myval2._Mylast - v40->_Mypair._Myval2._Myfirst;
if ( v37 >= (unsigned __int64)(v41 - 1) )
v42 = v41 - 1;
else
v42 = v37;
}
else
{
v42 = -1;
}
v43 = v39;
v82 = v39;
v73 = v42;
if ( v39 <= v42 )
{
do
{
v44 = a1->m_nonEffectObjects._Mypair._Myval2._Myfirst[v38]->_Mypair._Myval2._Myfirst[v43];
if ( v44 )
{
v45 = 0;
v46 = a1->m_nonEffectObjectsSizes._Mypair._Myval2._Myfirst[v38]->_Mypair._Myval2._Myfirst[v43];
if ( v46 > 0 )
{
do
{
v47 = (float *)v44->_Mypair._Myval2._Myfirst[v45];
if ( ((*(unsigned int (__fastcall **)(float *))(*(_QWORD *)v47 + 1632LL))(v47) == 2
|| (*(unsigned int (__fastcall **)(float *))(*(_QWORD *)v47 + 1632LL))(v47) == 47)
&& (*((_BYTE *)v47 + 773) || !*((_BYTE *)v47 + 654)) )
{
v48 = (const struct cocos2d::CCRect *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v47 + 1168LL))(v47);
cocos2d::CCRect::CCRect(&v76, v48);
v49 = v47[227];
if ( v49 <= 0.0 )
{
if ( cocos2d::CCRect::intersectsRect(v8, &v76) )
{
if ( !*((_BYTE *)v47 + 744)
|| (v69 = (OBB2D *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v47 + 1392LL))(v47),
OBB2D::overlaps1Way(v69))
&& OBB2D::overlaps1Way(v70) )
{
cocos2d::CCArray::addObject(v9, (struct cocos2d::CCObject *)v47);
}
}
}
else
{
v50 = v47[290];
if ( v50 != 1.0 || (y_low = (__m128)*((unsigned int *)v47 + 291), y_low.m128_f32[0] != 1.0) )
v49 = fmaxf(v50, v47[291]) * v49;
(*(void (__fastcall **)(float *, _BYTE *))(*(_QWORD *)v47 + 1192LL))(v47, v72);
*(double *)y_low.m128_u64 = cocos2d::CCPoint::CCPoint(&v77);
v52 = v51;
v53 = (cocos2d::CCRect *)cocos2d::CCRect::CCRect(&v78, v8);
MaxX = cocos2d::CCRect::getMaxX(v53);
MinX = cocos2d::CCRect::getMinX(v53);
MaxY = cocos2d::CCRect::getMaxY(v53);
y_low.m128_f32[0] = cocos2d::CCRect::getMinY(v53);
v57 = y_low;
if ( cocos2d::CCRect::containsPoint(v53, v52) )
goto LABEL_80;
*(double *)y_low.m128_u64 = cocos2d::CCPoint::CCPoint(y_low.m128_f32[0], MaxX);
y_low.m128_f32[0] = cocos2d::ccpDistance(v58, v52, v59);
y_low = _mm_and_ps(y_low, (__m128)0x7FFFFFFFu);
if ( v49 > y_low.m128_f32[0] )
goto LABEL_80;
*(double *)y_low.m128_u64 = cocos2d::CCPoint::CCPoint(y_low.m128_f32[0], MaxX);
y_low.m128_f32[0] = cocos2d::ccpDistance(v60, v52, v61);
y_low = _mm_and_ps(y_low, (__m128)0x7FFFFFFFu);
if ( v49 > y_low.m128_f32[0] )
goto LABEL_80;
*(double *)y_low.m128_u64 = cocos2d::CCPoint::CCPoint(y_low.m128_f32[0], MinX);
y_low.m128_f32[0] = cocos2d::ccpDistance(v62, v52, v63);
y_low = _mm_and_ps(y_low, (__m128)0x7FFFFFFFu);
if ( v49 > y_low.m128_f32[0] )
goto LABEL_80;
*(double *)y_low.m128_u64 = cocos2d::CCPoint::CCPoint(y_low.m128_f32[0], MinX);
y_low.m128_f32[0] = cocos2d::ccpDistance(v64, v52, v65);
y_low = _mm_and_ps(y_low, (__m128)0x7FFFFFFFu);
if ( v49 > y_low.m128_f32[0] )
goto LABEL_80;
cocos2d::CCPoint::CCPoint(&v79);
v67 = v79.x;
if ( v79.x > MaxX )
{
v79.x = MaxX;
v67 = MaxX;
}
if ( MinX > v67 )
v79.x = MinX;
y_low = (__m128)LODWORD(v79.y);
if ( v57.m128_f32[0] > v79.y )
{
y_low = v57;
LODWORD(v79.y) = v57.m128_i32[0];
}
if ( y_low.m128_f32[0] > MaxY )
v79.y = MaxY;
if ( v49 > cocos2d::ccpDistance((cocos2d *)&v79, v52, v66) )
LABEL_80:
cocos2d::CCArray::addObject(v9, (struct cocos2d::CCObject *)v47);
v8 = v80;
}
}
++v45;
}
while ( v45 < v46 );
v43 = v82;
v38 = v71;
}
}
v82 = ++v43;
}
while ( v43 <= v73 );
v39 = v74;
v37 = v81;
}
v71 = ++v38;
}
while ( v38 <= v75 );
}
}
return v9;
}