//
// GJBaseGameLayer::damagingObjectsInRect from 0x46e9f0 to 0x46edea (1018 bytes)
//
// 3 xrefs:
// > PlayerObject::spiderTestJumpInternal @ 0x348dfc
// > PlayerObject::spiderTestJumpY @ 0x34a3c6
// > PlayerObject::spiderTestJumpX @ 0x34ac66
//
// 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; // s12
float v4; // s13
cocos2d::CCRect *x_low; // r6
cocos2d::CCArray *v7; // r0
cocos2d::CCArray *v8; // r0
float x; // s14
float *p_m_sectionXFactor; // r3
float m_sectionXFactor; // s12
float v12; // s11
int v13; // r4
float v14; // s13
float v15; // s13
float v16; // s16
float v17; // s14
float *v18; // r3
float v19; // s13
std::vector *, std::allocator *>> *, std::allocator *, std::allocator *>> *>> *p_m_nonEffectObjects; // r8
std::vector *, std::allocator *>> **m_start; // r1
std::vector *, std::allocator *>> **m_finish; // r2
int v23; // s13
float v24; // s17
float v25; // s14
float *v26; // r3
int v27; // s17
float v28; // s14
float *p_m_sectionYFactor; // r7
float m_sectionYFactor; // s12
float v31; // s11
int v32; // r3
float v33; // s13
float v34; // s12
float v35; // s13
float v36; // s14
float v37; // s13
float *v38; // r3
unsigned int v39; // s16
int v41; // r7
std::vector *, std::allocator *>> *v42; // r2
unsigned int v43; // r3
int v44; // r9
GameObject *v45; // r10
const cocos2d::CCRect *v46; // r0
_BOOL4 v47; // r0
float v48; // r2
float v49; // r3
float v50; // [sp+0h] [bp-64h]
cocos2d::CCPoint v51; // [sp+4h] [bp-60h]
float v52; // [sp+Ch] [bp-58h]
cocos2d::CCArray *v53; // [sp+10h] [bp-54h]
signed int v54; // [sp+14h] [bp-50h]
_DWORD *v55; // [sp+18h] [bp-4Ch]
int v56; // [sp+28h] [bp-3Ch]
float v57; // [sp+2Ch] [bp-38h]
float y; // [sp+30h] [bp-34h]
OBB2D *v59; // [sp+38h] [bp-2Ch]
float ObjectRadius; // [sp+3Ch] [bp-28h]
cocos2d::CCPoint v61; // [sp+44h] [bp-20h] BYREF
cocos2d::CCPoint v62; // [sp+4Ch] [bp-18h] BYREF
cocos2d::CCRect v63; // [sp+54h] [bp-10h] BYREF
cocos2d::CCRect v64; // [sp+64h] [bp+0h] BYREF
cocos2d::CCRect v65; // 0:kr00_16.16
cocos2d::CCRect v66; // 0:r1.12,12:^0.4
x_low = (cocos2d::CCRect *)LODWORD(a2.origin.x);
y = a2.origin.y;
cocos2d::CCRect::CCRect(&v64, (const cocos2d::CCRect *)LODWORD(a2.origin.x));
LODWORD(v65.origin.x) = &v64;
v65.origin.y = v48;
v65.size.width = v49;
v65.size.height = v50;
GJBaseGameLayer::updateOBB2(a1, v65);
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
x = x_low->origin.x;
v53 = v8;
if ( x_low->origin.x <= 0.0 )
{
v13 = 0;
}
else
{
v4 = 10000000.0;
p_m_sectionXFactor = &a1->m_sectionXFactor;
m_sectionXFactor = a1->m_sectionXFactor;
if ( x < 10000000.0 )
v12 = (float)(x * m_sectionXFactor) - 1.0;
else
v12 = (float)(m_sectionXFactor * 10000000.0) - 1.0;
v13 = v12 > 0.0;
v3 = v12;
if ( v12 > 0.0 )
{
if ( x <= 0.0 )
{
v13 = -1;
}
else
{
if ( x < 10000000.0 )
v14 = *p_m_sectionXFactor;
else
v14 = 10000000.0;
if ( x < 10000000.0 )
{
v3 = 1.0;
}
else
{
v12 = 1.0;
v3 = *p_m_sectionXFactor;
}
if ( x < 10000000.0 )
v3 = (float)(x * v14) - v3;
else
v12 = (float)(v3 * v14) - v12;
if ( x < 10000000.0 )
v15 = v3;
else
v15 = v12;
LODWORD(v4) = (int)v15;
v13 = LODWORD(v4);
}
}
}
v16 = x + x_low->size.width;
if ( v16 <= 0.0 )
{
v17 = 1.0;
}
else
{
v17 = 10000000.0;
v18 = &a1->m_sectionXFactor;
if ( v16 < 10000000.0 )
{
v17 = *v18;
v4 = 1.0;
}
else
{
v3 = 1.0;
}
if ( v16 < 10000000.0 )
v19 = v4 + (float)(v16 * v17);
else
v19 = *v18;
if ( v16 < 10000000.0 )
v17 = v19;
else
v3 = v3 + (float)(v19 * v17);
if ( v16 >= 10000000.0 )
v17 = v3;
}
p_m_nonEffectObjects = &a1->m_nonEffectObjects;
m_start = a1->m_nonEffectObjects.m_start;
m_finish = a1->m_nonEffectObjects.m_finish;
v23 = m_finish - m_start - 1;
v24 = (float)(unsigned int)v23;
if ( v17 > (float)(unsigned int)v23 )
goto LABEL_44;
if ( v16 > 0.0 )
{
v25 = 10000000.0;
v26 = &a1->m_sectionXFactor;
if ( v16 < 10000000.0 )
v25 = *v26;
else
v23 = *(int *)v26;
if ( v16 < 10000000.0 )
v24 = (float)(v16 * v25) + 1.0;
else
v24 = (float)(*(float *)&v23 * v25) + 1.0;
LABEL_44:
v27 = (int)v24;
goto LABEL_46;
}
v27 = 1;
LABEL_46:
v28 = x_low->origin.y;
if ( v28 <= 0.0 )
{
v32 = 0;
}
else
{
p_m_sectionYFactor = &a1->m_sectionYFactor;
m_sectionYFactor = a1->m_sectionYFactor;
if ( v28 < 10000000.0 )
v31 = (float)(v28 * m_sectionYFactor) - 1.0;
else
v31 = (float)(m_sectionYFactor * 10000000.0) - 1.0;
v32 = v31 > 0.0;
if ( v31 > 0.0 )
{
if ( v28 > 0.0 )
{
if ( v28 < 10000000.0 )
v33 = *p_m_sectionYFactor;
else
v33 = 10000000.0;
if ( v28 < 10000000.0 )
{
v34 = 1.0;
}
else
{
v31 = 1.0;
v34 = *p_m_sectionYFactor;
}
if ( v28 < 10000000.0 )
v34 = (float)(v28 * v33) - v34;
else
v31 = (float)(v34 * v33) - v31;
if ( v28 < 10000000.0 )
v35 = v34;
else
v35 = v31;
LODWORD(v51.x) = (int)v35;
goto LABEL_68;
}
v32 = -1;
}
}
LODWORD(v51.x) = v32;
LABEL_68:
v36 = v28 + x_low->size.height;
if ( v36 <= 0.0 )
{
v39 = 1;
}
else
{
v37 = 10000000.0;
v38 = &a1->m_sectionYFactor;
if ( v36 < 10000000.0 )
v37 = *v38;
else
v36 = *v38;
v39 = (int)(float)((float)(v36 * v37) + 1.0);
}
if ( m_start != m_finish )
{
v41 = v13;
LODWORD(v57) = 4 * LODWORD(v51.x);
while ( 1 )
{
if ( v13 > v27 )
return v53;
v42 = p_m_nonEffectObjects->m_start[v41];
if ( v42 )
{
v43 = v42->m_finish - v42->m_start - 1;
if ( v43 >= v39 )
v43 = v39;
}
else
{
v43 = -1;
}
v54 = v43;
v51.y = v57;
v52 = v51.x;
while ( SLODWORD(v52) <= v54 )
{
v55 = *(std::vector **)((char *)p_m_nonEffectObjects->m_start[v41]->m_start + LODWORD(v51.y));
if ( v55 )
{
v44 = 0;
v56 = *(int *)((char *)a1->m_nonEffectObjectsSizes.m_start[v41]->m_start + LODWORD(v51.y));
while ( 1 )
{
if ( v44 >= v56 )
goto LABEL_98;
v45 = *(GameObject **)(*v55 + 4 * v44);
if ( (v45->getType(v45) == Hazard || v45->getType(v45) == AnimatedHazard)
&& (v45->m_isActivated || y != 0.0 && !GameObject::getGroupDisabled(v45)) )
{
break;
}
LABEL_97:
++v44;
}
v46 = v45->getObjectRect(v45);
cocos2d::CCRect::CCRect(&v63, v46);
if ( v45->m_objectRadius <= 0.0 )
{
if ( !cocos2d::CCRect::intersectsRect(x_low, &v63) )
goto LABEL_97;
if ( v45->m_shouldUseOuterOb )
{
v59 = v45->getOrientedBox(v45);
if ( !OBB2D::overlaps1Way(v59) )
goto LABEL_97;
v47 = OBB2D::overlaps1Way(a1->m_obb2);
goto LABEL_105;
}
}
else
{
ObjectRadius = GameObject::getObjectRadius(v45);
v45->getRealPosition(&v61, v45);
cocos2d::CCRect::CCRect(&v64, x_low);
cocos2d::CCPoint::CCPoint(&v62, &v61);
LODWORD(v66.origin.x) = &v64;
LODWORD(v66.origin.y) = &v62;
v66.size.width = ObjectRadius;
v47 = GJBaseGameLayer::rectIntersectsCircle(a1, v66, v51, v52);
LABEL_105:
if ( !v47 )
goto LABEL_97;
}
cocos2d::CCArray::addObject(v53, v45);
goto LABEL_97;
}
LABEL_98:
++LODWORD(v52);
LODWORD(v51.y) += 4;
}
++v13;
++v41;
}
}
return v53;
}