//
// GJBaseGameLayer::updateCollisionBlocks from 0x5931a8 to 0x59361e (1142 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::loadUpToPosition @ 0x5bcaa2
// > GJBaseGameLayer::update @ 0x5bde8c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:53:07 +0000
//
float __fastcall GJBaseGameLayer::updateCollisionBlocks(cocos2d::CCArray **this)
{
float result; // r0
int v3; // r3
_DWORD *v4; // r3
int v5; // r6
int v6; // r5
int v7; // r1
_DWORD *v8; // r8
int v9; // r3
unsigned int v10; // r1
int v11; // s17
int v12; // r7
unsigned int v13; // s16
char *ObjectRectPointer; // r9
float *v15; // r5
float v16; // s14
float v17; // s15
float *v18; // r7
float v19; // s15
float v20; // s17
float v21; // s15
float *v22; // r7
float v23; // s14
float v24; // s17
float v25; // r0
float *v26; // r7
float v27; // s14
float v28; // s15
float v29; // s15
float *v30; // r10
float v31; // s14
int v32; // r9
_DWORD *v33; // r2
unsigned int v34; // r3
int v35; // r10
int v36; // r12
_DWORD *v37; // r2
int v38; // r3
cocos2d::CCArray **v39; // r0
int v40; // r1
char *v41; // r2
int *v42; // [sp+4h] [bp-18h]
signed int v43; // [sp+8h] [bp-14h]
int *v44; // [sp+Ch] [bp-10h]
int v45; // [sp+14h] [bp-8h]
result = COERCE_FLOAT(cocos2d::CCArray::count(*(this + 523)));
if ( result != 0.0 )
{
*(this + 524) = (cocos2d::CCArray *)((char *)*(this + 524) + 1);
result = COERCE_FLOAT(GJBaseGameLayer::updatePlayerCollisionBlocks((GJBaseGameLayer *)this));
v3 = (int)*(this + 523);
if ( v3 )
{
v4 = *(_DWORD **)(v3 + 52);
if ( *v4 )
{
v42 = (int *)v4[3];
v44 = &v42[*v4 - 1];
while ( 1 )
{
while ( 1 )
{
do
{
if ( v42 > v44 )
return result;
v5 = *v42++;
if ( !v5 )
return result;
*(_DWORD *)(v5 + 1644) = *(this + 524);
}
while ( *(_BYTE *)(v5 + 550) );
v6 = *(unsigned __int8 *)(v5 + 1165);
if ( !*(_BYTE *)(v5 + 1165) )
break;
v38 = (int)*(this + 2843);
if ( v38 > 0 )
{
v39 = this;
v41 = (char *)(this + 2840);
v40 = v5;
LABEL_78:
result = COERCE_FLOAT(GJBaseGameLayer::checkCollisionBlocks(v39, v40, v41, v38));
}
}
v7 = *(_DWORD *)(v5 + 528);
v8 = this + 2829;
v9 = *(_DWORD *)(v5 + 532);
if ( v7 > 1 )
v6 = v7 - 1;
v10 = v7 + 1;
if ( v10 >= ((*(this + 2830) - *(this + 2829)) >> 2) - 1 )
v10 = ((*(this + 2830) - *(this + 2829)) >> 2) - 1;
v11 = v10;
v12 = v9 <= 1 ? 0 : v9 - 1;
if ( *(_BYTE *)(v5 + 536) )
break;
v13 = v9 + 1;
LABEL_61:
v32 = 4 * v6;
while ( v6 <= v11 )
{
v33 = *(_DWORD **)(*v8 + v32);
if ( v33 )
{
v34 = ((v33[1] - *v33) >> 2) - 1;
if ( v34 >= v13 )
v34 = v13;
}
else
{
v34 = -1;
}
v35 = 4 * v12;
v36 = v12;
v43 = v34;
while ( v36 <= v43 )
{
v37 = *(_DWORD **)(**(_DWORD **)(*v8 + v32) + v35);
if ( v37 )
{
v45 = v36;
result = COERCE_FLOAT(
GJBaseGameLayer::checkCollisionBlocks(
this,
v5,
v37,
*(_DWORD *)(**(_DWORD **)((char *)*(this + 2850) + v32) + v35)));
v36 = v45;
}
++v36;
v35 += 4;
}
++v6;
v32 += 4;
}
v38 = (int)*(this + 2839);
if ( v38 > 0 )
{
v39 = this;
v40 = v5;
v41 = (char *)(this + 2836);
goto LABEL_78;
}
}
ObjectRectPointer = GameObject::getObjectRectPointer((GameObject *)v5);
if ( COERCE_FLOAT(cocos2d::CCRect::getMinX((cocos2d::CCRect *)ObjectRectPointer)) <= 0.0
|| ((v15 = (float *)(this + 2856),
COERCE_FLOAT(cocos2d::CCRect::getMinX((cocos2d::CCRect *)ObjectRectPointer)) < 10000000.0)
? (v16 = (float)(COERCE_FLOAT(cocos2d::CCRect::getMinX((cocos2d::CCRect *)ObjectRectPointer)) * *v15) - 1.0)
: (v16 = (float)(*v15 * 10000000.0) - 1.0),
v16 <= 0.0) )
{
v6 = 0;
}
else if ( COERCE_FLOAT(cocos2d::CCRect::getMinX((cocos2d::CCRect *)ObjectRectPointer)) <= 0.0 )
{
v6 = -1;
}
else
{
if ( COERCE_FLOAT(cocos2d::CCRect::getMinX((cocos2d::CCRect *)ObjectRectPointer)) < 10000000.0 )
v17 = (float)(COERCE_FLOAT(cocos2d::CCRect::getMinX((cocos2d::CCRect *)ObjectRectPointer)) * *v15) - 1.0;
else
v17 = (float)(*v15 * 10000000.0) - 1.0;
v6 = (int)v17;
}
if ( COERCE_FLOAT(cocos2d::CCRect::getMaxX((cocos2d::CCRect *)ObjectRectPointer)) <= 0.0 )
{
v19 = 1.0;
}
else
{
v18 = (float *)(this + 2856);
if ( COERCE_FLOAT(cocos2d::CCRect::getMaxX((cocos2d::CCRect *)ObjectRectPointer)) < 10000000.0 )
v19 = (float)(COERCE_FLOAT(cocos2d::CCRect::getMaxX((cocos2d::CCRect *)ObjectRectPointer)) * *v18) + 1.0;
else
v19 = (float)(*v18 * 10000000.0) + 1.0;
}
v20 = (float)(unsigned int)(((*(this + 2830) - *(this + 2829)) >> 2) - 1);
if ( v19 <= v20 )
{
if ( COERCE_FLOAT(cocos2d::CCRect::getMaxX((cocos2d::CCRect *)ObjectRectPointer)) <= 0.0 )
{
v11 = 1;
LABEL_43:
if ( COERCE_FLOAT(cocos2d::CCRect::getMinY((cocos2d::CCRect *)ObjectRectPointer)) <= 0.0
|| ((v26 = (float *)(this + 2857),
COERCE_FLOAT(cocos2d::CCRect::getMinY((cocos2d::CCRect *)ObjectRectPointer)) < 10000000.0)
? (v27 = (float)(COERCE_FLOAT(cocos2d::CCRect::getMinY((cocos2d::CCRect *)ObjectRectPointer)) * *v26)
- 1.0)
: (v27 = (float)(*v26 * 10000000.0) - 1.0),
v27 <= 0.0) )
{
v12 = 0;
}
else if ( COERCE_FLOAT(cocos2d::CCRect::getMinY((cocos2d::CCRect *)ObjectRectPointer)) <= 0.0 )
{
v12 = -1;
}
else
{
if ( COERCE_FLOAT(cocos2d::CCRect::getMinY((cocos2d::CCRect *)ObjectRectPointer)) < 10000000.0 )
v28 = (float)(COERCE_FLOAT(cocos2d::CCRect::getMinY((cocos2d::CCRect *)ObjectRectPointer)) * *v26) - 1.0;
else
v28 = (float)(*v26 * 10000000.0) - 1.0;
v12 = (int)v28;
}
result = COERCE_FLOAT(cocos2d::CCRect::getMaxY((cocos2d::CCRect *)ObjectRectPointer));
if ( result <= 0.0 )
{
v13 = 1;
}
else
{
result = COERCE_FLOAT(cocos2d::CCRect::getMaxY((cocos2d::CCRect *)ObjectRectPointer));
v29 = 10000000.0;
v30 = (float *)(this + 2857);
if ( result < 10000000.0 )
{
result = COERCE_FLOAT(cocos2d::CCRect::getMaxY((cocos2d::CCRect *)ObjectRectPointer));
v29 = *v30;
v31 = result;
}
else
{
v31 = *v30;
}
v13 = (int)(float)((float)(v31 * v29) + 1.0);
}
goto LABEL_61;
}
v21 = 10000000.0;
v22 = (float *)(this + 2856);
if ( COERCE_FLOAT(cocos2d::CCRect::getMaxX((cocos2d::CCRect *)ObjectRectPointer)) < 10000000.0 )
{
v24 = 1.0;
v25 = COERCE_FLOAT(cocos2d::CCRect::getMaxX((cocos2d::CCRect *)ObjectRectPointer));
v21 = *v22;
v23 = v25;
}
else
{
v23 = *v22;
v24 = 1.0;
}
v20 = v24 + (float)(v23 * v21);
}
v11 = (int)v20;
goto LABEL_43;
}
}
}
return result;
}