//
// GJBaseGameLayer::updateCollisionBlocks from 0x9a4568 to 0x9a4a4c (1252 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::loadUpToPosition @ 0x9ebe50
// > GJBaseGameLayer::update @ 0x9edde0
// > ??> @ 0xe8db0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 12:58:09 +0000
//
unsigned __int64 __fastcall GJBaseGameLayer::updateCollisionBlocks(cocos2d::CCArray **this)
{
unsigned __int64 result; // x0
unsigned int *v3; // x1
__int64 v4; // x20
int v5; // w0
int v6; // w23
int v7; // w25
int v8; // w21
int v9; // w23
__int64 v10; // x19
unsigned __int64 v11; // x0
int v12; // w19
int v13; // w22
__int64 v14; // x27
_QWORD *v15; // x0
__int64 v16; // x19
unsigned __int64 v17; // x1
int v18; // w19
__int64 v19; // x24
int v20; // w26
__int64 v21; // x25
_QWORD *v22; // x3
int v23; // w3
int v24; // w3
cocos2d::CCRect *ObjectRectPointer; // x19
float v26; // s0
float v27; // s0
_BOOL4 v28; // w0
float v29; // s0
float v30; // s0
float v31; // s0
float v32; // s0
float v33; // s0
float v34; // s1
float v35; // s0
float v36; // s0
_BOOL4 v37; // w0
float v38; // s0
float v39; // s0
float v40; // s0
float v41; // s0
float v42; // s0
float v43; // s0
float v44; // s0
float v45; // s0
float v46; // s0
float v47; // s0
float v48; // s0
float v49; // s0
float v50; // s0
unsigned __int64 v51; // [xsp+A0h] [xbp+A0h]
__int64 *v52; // [xsp+C0h] [xbp+C0h]
int v53; // [xsp+CCh] [xbp+CCh]
result = cocos2d::CCArray::count(*(this + 411));
if ( (_DWORD)result )
{
++*((_DWORD *)this + 824);
GJBaseGameLayer::updatePlayerCollisionBlocks((GJBaseGameLayer *)this);
result = (unsigned __int64)*(this + 411);
if ( result )
{
v3 = *(unsigned int **)(result + 56);
result = *v3;
if ( (_DWORD)result )
{
v52 = *((__int64 **)v3 + 2);
result = (unsigned __int64)&v52[(unsigned int)result - 1];
v51 = result;
if ( (unsigned __int64)v52 <= result )
{
v4 = *v52;
if ( *v52 )
{
do
{
v5 = *(unsigned __int8 *)(v4 + 650);
*(_DWORD *)(v4 + 1836) = *((_DWORD *)this + 824);
if ( !v5 )
{
if ( *(_BYTE *)(v4 + 1345) )
{
v24 = *((_DWORD *)this + 3382);
if ( v24 > 0 )
GJBaseGameLayer::checkCollisionBlocks(this, v4, this + 1688, v24);
}
else
{
v6 = *(_DWORD *)(v4 + 628);
v7 = *(_DWORD *)(v4 + 632);
if ( v6 <= 1 )
v8 = 0;
else
v8 = v6 - 1;
v9 = v6 + 1;
v10 = (*(this + 1678) - *(this + 1677)) >> 3;
v11 = v10 - 1;
v12 = v10 - 1;
if ( v11 < v9 )
v9 = v12;
if ( v7 <= 1 )
v13 = 0;
else
v13 = v7 - 1;
if ( *(_BYTE *)(v4 + 636) )
{
ObjectRectPointer = (cocos2d::CCRect *)GameObject::getObjectRectPointer((GameObject *)v4);
cocos2d::CCRect::getMinX(ObjectRectPointer);
if ( v26 > 0.0
&& ((cocos2d::CCRect::getMinX(ObjectRectPointer), v27 < 10000000.0)
? (cocos2d::CCRect::getMinX(ObjectRectPointer),
v28 = (float)((float)(v46 * *((float *)this + 3408)) + -1.0) > 0.0)
: (v28 = (float)((float)(*((float *)this + 3408) * 10000000.0) + -1.0) > 0.0),
v28) )
{
v8 = -1;
cocos2d::CCRect::getMinX(ObjectRectPointer);
if ( v29 > 0.0 )
{
cocos2d::CCRect::getMinX(ObjectRectPointer);
if ( v30 < 10000000.0 )
{
cocos2d::CCRect::getMinX(ObjectRectPointer);
v8 = (int)(float)((float)(v48 * *((float *)this + 3408)) + -1.0);
}
else
{
v8 = (int)(float)((float)(*((float *)this + 3408) * 10000000.0) + -1.0);
}
}
}
else
{
v8 = 0;
}
cocos2d::CCRect::getMaxX(ObjectRectPointer);
if ( v31 <= 0.0 )
{
v33 = 1.0;
}
else
{
cocos2d::CCRect::getMaxX(ObjectRectPointer);
if ( v32 < 10000000.0 )
{
cocos2d::CCRect::getMaxX(ObjectRectPointer);
v33 = (float)(v45 * *((float *)this + 3408)) + 1.0;
}
else
{
v33 = (float)(*((float *)this + 3408) * 10000000.0) + 1.0;
}
}
v34 = (float)(unsigned __int64)(((*(this + 1678) - *(this + 1677)) >> 3) - 1);
if ( v34 >= v33 )
{
v9 = 1;
cocos2d::CCRect::getMaxX(ObjectRectPointer);
if ( v42 > 0.0 )
{
cocos2d::CCRect::getMaxX(ObjectRectPointer);
if ( v43 < 10000000.0 )
{
cocos2d::CCRect::getMaxX(ObjectRectPointer);
v9 = (int)(float)((float)(v49 * *((float *)this + 3408)) + 1.0);
}
else
{
v9 = (int)(float)((float)(*((float *)this + 3408) * 10000000.0) + 1.0);
}
}
}
else
{
v9 = (int)v34;
}
cocos2d::CCRect::getMinY(ObjectRectPointer);
if ( v35 > 0.0
&& ((cocos2d::CCRect::getMinY(ObjectRectPointer), v36 < 10000000.0)
? (cocos2d::CCRect::getMinY(ObjectRectPointer),
v37 = (float)((float)(v44 * *((float *)this + 3409)) + -1.0) > 0.0)
: (v37 = (float)((float)(*((float *)this + 3409) * 10000000.0) + -1.0) > 0.0),
v37) )
{
v13 = -1;
cocos2d::CCRect::getMinY(ObjectRectPointer);
if ( v38 > 0.0 )
{
cocos2d::CCRect::getMinY(ObjectRectPointer);
if ( v39 < 10000000.0 )
{
cocos2d::CCRect::getMinY(ObjectRectPointer);
v13 = (int)(float)((float)(v50 * *((float *)this + 3409)) + -1.0);
}
else
{
v13 = (int)(float)((float)(*((float *)this + 3409) * 10000000.0) + -1.0);
}
}
}
else
{
v13 = 0;
}
v53 = 1;
cocos2d::CCRect::getMaxY(ObjectRectPointer);
if ( v40 > 0.0 )
{
cocos2d::CCRect::getMaxY(ObjectRectPointer);
if ( v41 < 10000000.0 )
{
cocos2d::CCRect::getMaxY(ObjectRectPointer);
v53 = (int)(float)((float)(v47 * *((float *)this + 3409)) + 1.0);
}
else
{
v53 = (int)(float)((float)(*((float *)this + 3409) * 10000000.0) + 1.0);
}
}
}
else
{
v53 = v7 + 1;
}
if ( v9 >= v8 )
{
v14 = 8LL * v8;
do
{
v15 = *(_QWORD **)((char *)*(this + 1677) + v14);
if ( v15 )
{
v16 = (__int64)(v15[1] - *v15) >> 3;
v17 = v16 - 1;
v18 = v16 - 1;
if ( v53 <= v17 )
v18 = v53;
}
else
{
v18 = -1;
}
if ( v18 >= v13 )
{
v19 = 4LL * v13;
v20 = v13;
v21 = 8LL * v13;
while ( 1 )
{
++v20;
v22 = *(_QWORD **)(*v15 + v21);
v21 += 8;
if ( v22 )
GJBaseGameLayer::checkCollisionBlocks(
this,
v4,
v22,
*(_DWORD *)(**(_QWORD **)((char *)*(this + 1698) + v14) + v19));
v19 += 4;
if ( v20 > v18 )
break;
v15 = *(_QWORD **)((char *)*(this + 1677) + v14);
}
}
++v8;
v14 += 8;
}
while ( v8 <= v9 );
}
v23 = *((_DWORD *)this + 3374);
if ( v23 > 0 )
GJBaseGameLayer::checkCollisionBlocks(this, v4, this + 1684, v23);
}
}
result = (unsigned __int64)(v52 + 1);
v52 = (__int64 *)result;
if ( v51 < result )
break;
v4 = *(_QWORD *)result;
}
while ( *(_QWORD *)result );
}
}
}
}
}
return result;
}