//
// GJBaseGameLayer::damagingObjectsInRect from 0x859440 to 0x8599f8 (1464 bytes)
//
// 4 xrefs:
// > PlayerObject::spiderTestJumpInternal @ 0x634180
// > PlayerObject::spiderTestJumpY @ 0x635f4c
// > PlayerObject::spiderTestJumpX @ 0x636a38
// > ??> @ 0xac740
//
// 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 *GJBaseGameLayer::damagingObjectsInRect(GJBaseGameLayer *a1, cocos2d::CCRect a2, bool a3)
{
unsigned __int8 v3; // w2
float *v5; // x19
cocos2d::CCArray *v6; // x0
float v7; // s2
float m_sectionXFactor; // s0
_BOOL4 v9; // w0
float v10; // s2
std::vector *, std::allocator *>> **m_start; // x19
std::vector *, std::allocator *>> **m_finish; // x25
float v13; // s1
float y; // s0
float v15; // s0
float v17; // s0
float m_sectionYFactor; // s1
_BOOL4 v19; // w0
std::vector *, std::allocator *>> *v20; // x19
__int64 v21; // x0
unsigned __int64 v22; // x1
int v23; // w0
__int64 v24; // x28
std::vector *v25; // x21
int v26; // w20
unsigned __int64 v27; // x19
__int64 v28; // x20
GameObject *v29; // x27
const cocos2d::CCRect *v30; // x0
float v31; // s6
int v32; // [xsp+84h] [xbp+84h]
int v33; // [xsp+88h] [xbp+88h]
int v34; // [xsp+8Ch] [xbp+8Ch]
cocos2d::CCArray *v35; // [xsp+90h] [xbp+90h]
int v36; // [xsp+98h] [xbp+98h]
int i; // [xsp+9Ch] [xbp+9Ch]
__int64 v38; // [xsp+A0h] [xbp+A0h]
cocos2d::CCRect *v39; // [xsp+A8h] [xbp+A8h]
int v40; // [xsp+B0h] [xbp+B0h]
int v41; // [xsp+B4h] [xbp+B4h]
__int64 v42; // [xsp+B8h] [xbp+B8h]
float ObjectRadius; // [xsp+C0h] [xbp+C0h]
OBB2D *v44; // [xsp+C0h] [xbp+C0h]
cocos2d::CCPoint v45; // [xsp+D8h] [xbp+D8h] BYREF
cocos2d::CCPoint v46; // [xsp+E0h] [xbp+E0h] BYREF
cocos2d::CCRect v47; // [xsp+E8h] [xbp+E8h] BYREF
cocos2d::CCRect v48; // [xsp+F8h] [xbp+F8h] BYREF
cocos2d::CCPoint v49; // 0:s4.4,4:s5.4
cocos2d::CCRect v50; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
cocos2d::CCRect v51; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v41 = v3;
v39 = (cocos2d::CCRect *)a3;
v5 = (float *)a3;
cocos2d::CCRect::CCRect(&v48, (const cocos2d::CCRect *)a3);
GJBaseGameLayer::updateOBB2(a1, v50);
v35 = (cocos2d::CCArray *)cocos2d::CCArray::create(v6);
v7 = *v5;
if ( *v5 > 0.0
&& ((m_sectionXFactor = a1->m_sectionXFactor, v7 < 10000000.0)
? (v9 = (float)((float)(v7 * m_sectionXFactor) + -1.0) > 0.0)
: (v9 = (float)((float)(m_sectionXFactor * 10000000.0) + -1.0) > 0.0),
v9) )
{
if ( v7 <= 0.0 )
{
v36 = -1;
}
else
{
if ( v7 >= 10000000.0 )
{
v36 = (int)(float)((float)(m_sectionXFactor * 10000000.0) + -1.0);
v10 = v7 + v39->size.width;
if ( v10 <= 0.0 )
goto LABEL_8;
goto LABEL_15;
}
v36 = (int)(float)((float)(v7 * m_sectionXFactor) + -1.0);
}
}
else
{
v36 = 0;
}
v10 = v7 + v39->size.width;
if ( v10 <= 0.0 )
{
LABEL_8:
m_start = a1->m_nonEffectObjects.m_start;
m_finish = a1->m_nonEffectObjects.m_finish;
v13 = (float)(unsigned __int64)(m_finish - m_start - 1);
if ( v13 >= 1.0 )
goto LABEL_9;
goto LABEL_17;
}
LABEL_15:
v17 = a1->m_sectionXFactor;
if ( v10 >= 10000000.0 )
{
m_start = a1->m_nonEffectObjects.m_start;
m_finish = a1->m_nonEffectObjects.m_finish;
v13 = (float)(unsigned __int64)(m_finish - m_start - 1);
if ( (float)((float)(v17 * 10000000.0) + 1.0) > v13 )
goto LABEL_17;
}
else
{
m_start = a1->m_nonEffectObjects.m_start;
m_finish = a1->m_nonEffectObjects.m_finish;
v13 = (float)(unsigned __int64)(m_finish - m_start - 1);
if ( (float)((float)(v10 * v17) + 1.0) > v13 )
{
LABEL_17:
v34 = (int)v13;
goto LABEL_18;
}
}
if ( v10 <= 0.0 )
{
LABEL_9:
v34 = 1;
y = v39->origin.y;
if ( y <= 0.0 )
goto LABEL_10;
goto LABEL_19;
}
if ( v10 < 10000000.0 )
v34 = (int)(float)((float)(v10 * v17) + 1.0);
else
v34 = (int)(float)((float)(v17 * 10000000.0) + 1.0);
LABEL_18:
y = v39->origin.y;
if ( y <= 0.0 )
goto LABEL_10;
LABEL_19:
m_sectionYFactor = a1->m_sectionYFactor;
if ( y < 10000000.0 )
v19 = (float)((float)(y * m_sectionYFactor) + -1.0) > 0.0;
else
v19 = (float)((float)(m_sectionYFactor * 10000000.0) + -1.0) > 0.0;
if ( !v19 )
{
LABEL_10:
v33 = 0;
v15 = y + v39->size.height;
if ( v15 <= 0.0 )
goto LABEL_11;
goto LABEL_26;
}
if ( y <= 0.0 )
{
v33 = -1;
}
else if ( y < 10000000.0 )
{
v33 = (int)(float)((float)(y * m_sectionYFactor) + -1.0);
}
else
{
v33 = (int)(float)((float)(m_sectionYFactor * 10000000.0) + -1.0);
}
v15 = y + v39->size.height;
if ( v15 <= 0.0 )
{
LABEL_11:
v32 = 1;
if ( m_start == m_finish )
return v35;
goto LABEL_29;
}
LABEL_26:
if ( v15 < 10000000.0 )
v32 = (int)(float)((float)(v15 * a1->m_sectionYFactor) + 1.0);
else
v32 = (int)(float)((float)(a1->m_sectionYFactor * 10000000.0) + 1.0);
if ( m_start != m_finish )
{
LABEL_29:
if ( v36 > v34 )
return v35;
v38 = v36;
v20 = m_start[v38];
if ( !v20 )
goto LABEL_62;
LABEL_31:
v21 = v20->m_finish - v20->m_start;
v22 = v21 - 1;
v23 = v21 - 1;
if ( v32 <= v22 )
v23 = v32;
for ( i = v23; v33 > i; i = -1 )
{
LABEL_60:
++v38;
if ( v34 < ++v36 )
return v35;
v20 = a1->m_nonEffectObjects.m_start[v38];
if ( v20 )
goto LABEL_31;
LABEL_62:
;
}
v24 = v33;
v42 = v33;
v40 = v33;
while ( 1 )
{
v25 = v20->m_start[v24];
if ( v25 )
{
v26 = a1->m_nonEffectObjectsSizes.m_start[v38]->m_start[v42];
if ( v26 > 0 )
break;
}
LABEL_48:
++v24;
++v40;
++v42;
if ( i < v40 )
goto LABEL_60;
v20 = a1->m_nonEffectObjects.m_start[v38];
}
v27 = 0;
v28 = 8 * ((unsigned int)(v26 - 1) + 1LL);
while ( 1 )
{
while ( 1 )
{
v29 = v25->m_start[v27 / 8];
if ( v29->getType(v29) != Hazard && v29->getType(v29) != AnimatedHazard
|| !v29->m_isActivated && (!v41 || GameObject::getGroupDisabled(v29)) )
{
goto LABEL_40;
}
v30 = v29->getObjectRect(v29);
cocos2d::CCRect::CCRect(&v47, v30);
if ( v29->m_objectRadius > 0.0 )
break;
if ( (unsigned __int8)cocos2d::CCRect::intersectsRect(v39, &v47) )
{
if ( !v29->m_shouldUseOuterOb )
goto LABEL_47;
v44 = v29->getOrientedBox(v29);
if ( OBB2D::overlaps1Way(v44) && OBB2D::overlaps1Way(a1->m_obb2) )
goto LABEL_47;
}
LABEL_40:
v27 += 8LL;
if ( v27 == v28 )
goto LABEL_48;
}
ObjectRadius = GameObject::getObjectRadius(v29);
((void (__fastcall *)(cocos2d::CCPoint *__return_ptr, GameObject *))v29->getRealPosition)(&v45, v29);
cocos2d::CCRect::CCRect(&v48, v39);
cocos2d::CCPoint::CCPoint(&v46, &v45);
v51.origin.x = ObjectRadius;
if ( !GJBaseGameLayer::rectIntersectsCircle(a1, v51, v49, v31) )
goto LABEL_40;
LABEL_47:
v27 += 8LL;
cocos2d::CCArray::addObject(v35, v29);
if ( v27 == v28 )
goto LABEL_48;
}
}
return v35;
}