//
// GJBaseGameLayer::updateGroundShadows from 0x58bea4 to 0x58c50a (1638 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::preUpdateVisibility @ 0x5ae868
//
// 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:02 +0000
//
int __fastcall GJBaseGameLayer::updateGroundShadows(GJGroundLayer **this)
{
const cocos2d::CCPoint *v2; // r0
int v3; // r8
OBB2D *v4; // r9
OBB2D *v5; // r0
int v6; // r9
cocos2d::CCPoint *v7; // r0
float v8; // s15
float v9; // s13
float v10; // s12
float v11; // s12
float v12; // s14
float v13; // s10
int result; // r0
float v15; // s14
float v16; // s11
float v17; // s13
float v18; // s10
_BOOL4 v19; // r3
float v20; // s11
float v21; // s14
float v22; // s10
_BOOL4 v23; // r1
float v24; // s12
float v25; // s15
float v26; // s12
_BOOL4 v27; // r2
int v28; // r4
int v29; // r6
int v30; // r2
const cocos2d::CCPoint *v31; // r11
const cocos2d::CCPoint *v32; // r8
int v33; // r2
int v34; // r3
float v35; // s14
float v36; // s12
int v37; // r4
float v38; // s16
float v39; // s13
float v40; // s16
int v41; // r0
float v42; // s12
float v43; // s14
float v44; // s15
float v45; // s16
float v46; // [sp+14h] [bp-8h] BYREF
float v47; // [sp+18h] [bp-4h]
_BYTE v48[8]; // [sp+1Ch] [bp+0h] BYREF
_BYTE v49[8]; // [sp+24h] [bp+8h] BYREF
float v50; // [sp+2Ch] [bp+10h] BYREF
float v51; // [sp+30h] [bp+14h]
float v52; // [sp+34h] [bp+18h] BYREF
float v53; // [sp+38h] [bp+1Ch]
float v54; // [sp+3Ch] [bp+20h] BYREF
float v55; // [sp+40h] [bp+24h]
float v56; // [sp+44h] [bp+28h] BYREF
float v57; // [sp+48h] [bp+2Ch]
float v58[2]; // [sp+4Ch] [bp+30h] BYREF
float v59[2]; // [sp+54h] [bp+38h] BYREF
float v60[2]; // [sp+5Ch] [bp+40h] BYREF
float v61[2]; // [sp+64h] [bp+48h] BYREF
float v62[2]; // [sp+6Ch] [bp+50h] BYREF
float v63[2]; // [sp+74h] [bp+58h] BYREF
float v64[2]; // [sp+7Ch] [bp+60h] BYREF
float v65[2]; // [sp+84h] [bp+68h] BYREF
float v66[2]; // [sp+8Ch] [bp+70h] BYREF
float v67; // [sp+94h] [bp+78h] BYREF
float v68; // [sp+98h] [bp+7Ch]
float v69; // [sp+9Ch] [bp+80h] BYREF
float v70; // [sp+A0h] [bp+84h]
float v71; // [sp+A4h] [bp+88h] BYREF
float v72; // [sp+A8h] [bp+8Ch]
float v73; // [sp+ACh] [bp+90h] BYREF
float v74; // [sp+B0h] [bp+94h]
cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)this);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v46);
v2 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(_DWORD))(*(_DWORD *)*(this + 614) + 96))(*(this + 614));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v48, v2);
v3 = (*(int (__fastcall **)(_DWORD))(*(_DWORD *)*(this + 614) + 96))(*(this + 614));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v66, v46, 0.0);
cocos2d::CCPoint::operator+(v49, v3, v66);
v4 = *(this + 2726);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v66, v46 * 0.5, v47 * 0.5);
v5 = v4;
v6 = 0;
OBB2D::calculateWithCenter(v5, (int)v66, v46, v47, *((float *)this + 177) * 0.017453);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v50, (GJGroundLayer *)((char *)*(this + 2726) + 264));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, (GJGroundLayer *)((char *)*(this + 2726) + 272));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, (GJGroundLayer *)((char *)*(this + 2726) + 280));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v56, (GJGroundLayer *)((char *)*(this + 2726) + 288));
do
{
v7 = (cocos2d::CCPoint *)((char *)&v67 + v6);
v6 += 8;
cocos2d::CCPoint::CCPoint(v7);
}
while ( v6 != 32 );
cocos2d::ccpIntersectPoint(
(cocos2d *)v66,
(const cocos2d::CCPoint *)&v50,
(const cocos2d::CCPoint *)&v52,
(const cocos2d::CCPoint *)v48,
(const cocos2d::CCPoint *)v49);
cocos2d::CCPoint::operator=(&v67, v66);
cocos2d::ccpIntersectPoint(
(cocos2d *)v66,
(const cocos2d::CCPoint *)&v52,
(const cocos2d::CCPoint *)&v54,
(const cocos2d::CCPoint *)v48,
(const cocos2d::CCPoint *)v49);
cocos2d::CCPoint::operator=(&v69, v66);
cocos2d::ccpIntersectPoint(
(cocos2d *)v66,
(const cocos2d::CCPoint *)&v54,
(const cocos2d::CCPoint *)&v56,
(const cocos2d::CCPoint *)v48,
(const cocos2d::CCPoint *)v49);
cocos2d::CCPoint::operator=(&v71, v66);
cocos2d::ccpIntersectPoint(
(cocos2d *)v66,
(const cocos2d::CCPoint *)&v56,
(const cocos2d::CCPoint *)&v50,
(const cocos2d::CCPoint *)v48,
(const cocos2d::CCPoint *)v49);
cocos2d::CCPoint::operator=(&v73, v66);
v8 = v50;
v9 = v52;
if ( v50 > v52 )
v10 = v52;
else
v10 = v50;
if ( v67 < v10
|| (v50 < v52 ? (v11 = v52) : (v11 = v50),
v67 > v11 || ((v12 = v53, v51 > v53) ? (v13 = v53) : (v13 = v51), v68 < v13)) )
{
result = 0;
}
else
{
if ( v51 >= v53 )
v12 = v51;
result = v68 <= v12;
}
v15 = v54;
if ( v52 > v54 )
v16 = v54;
else
v16 = v52;
if ( v69 < v16 )
goto LABEL_33;
if ( v52 < v54 )
v9 = v54;
if ( v69 > v9 || ((v17 = v55, v53 > v55) ? (v18 = v55) : (v18 = v53), v70 < v18) )
{
LABEL_33:
v19 = 0;
}
else
{
if ( v53 >= v55 )
v17 = v53;
v19 = v70 <= v17;
}
if ( v54 > v56 )
v20 = v56;
else
v20 = v54;
if ( v71 < v20 )
goto LABEL_48;
if ( v54 < v56 )
v15 = v56;
if ( v71 > v15 || ((v21 = v57, v55 > v57) ? (v22 = v57) : (v22 = v55), v72 < v22) )
{
LABEL_48:
v23 = 0;
}
else
{
if ( v55 >= v57 )
v21 = v55;
v23 = v72 <= v21;
}
if ( v56 > v50 )
v24 = v50;
else
v24 = v56;
if ( v73 < v24 )
goto LABEL_63;
if ( v56 >= v50 )
v8 = v56;
if ( v73 > v8 || ((v25 = v51, v57 > v51) ? (v26 = v51) : (v26 = v57), v74 < v26) )
{
LABEL_63:
v27 = 0;
}
else
{
if ( v57 >= v51 )
v25 = v57;
v27 = v74 <= v25;
}
v28 = result + v19 + v23 + v27;
if ( v28 == 2 )
{
if ( result )
{
if ( v19 )
{
v29 = 0;
v28 = 1;
LABEL_68:
if ( *(&v67 + 2 * v29) > *(&v67 + 2 * v28) )
{
v30 = v29;
v29 = v28;
v28 = v30;
}
v31 = (const cocos2d::CCPoint *)(&v67 + 2 * v29);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v66, 0.0, -128.0);
v32 = (const cocos2d::CCPoint *)(&v67 + 2 * v28);
cocos2d::CCPoint::operator+(v58, v31, v66);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v66, 0.0, -128.0);
cocos2d::CCPoint::operator+(v59, v32, v66);
if ( v29 <= 2 )
v33 = v29 + 1;
else
v33 = v29 - 3;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v60, (GJGroundLayer *)((char *)*(this + 2726) + 8 * v33 + 264));
if ( v29 <= 1 )
v34 = v29 + 2;
else
v34 = v29 - 2;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v61, (GJGroundLayer *)((char *)*(this + 2726) + 8 * v34 + 264));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v62, v31);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v63, v32);
if ( v62[0] == 0.0 && v63[0] == 0.0 )
{
cocos2d::CCPoint::operator=(v62, v58);
cocos2d::CCPoint::operator=(v63, v59);
}
v35 = v61[0];
if ( v60[0] > v61[0] )
v36 = v61[0];
else
v36 = v60[0];
if ( v58[0] > v36 )
{
if ( v60[0] >= v61[0] )
v35 = v60[0];
if ( v58[0] < v35 )
v62[0] = v62[0] - fabsf(v58[0] - v60[0]);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v64, (GJGroundLayer *)((char *)*(this + 2726) + 8 * v28 + 264));
if ( v28 <= 0 )
v37 = 3;
else
v37 = v28 - 1;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, (GJGroundLayer *)((char *)*(this + 2726) + 8 * v37 + 264));
v38 = v65[0];
if ( v64[0] > v65[0] )
v39 = v65[0];
else
v39 = v64[0];
if ( v59[0] > v39 )
{
if ( v64[0] >= v65[0] )
v38 = v64[0];
if ( v59[0] < v38 )
v63[0] = v63[0] + fabsf(v59[0] - v64[0]);
}
v40 = v46 - v62[0];
v41 = (*(int (__fastcall **)(_DWORD))(*(_DWORD *)*(this + 615) + 96))(*(this + 615));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v66, v40, *(float *)(v41 + 4));
v42 = *((float *)this + 82);
v43 = v63[0];
if ( (float)(v63[0] - v62[0]) < (float)(v42 * 180.0) )
{
v44 = (float)((float)(v42 * 180.0) - (float)(v63[0] - v62[0])) * 0.5;
v62[0] = v62[0] - v44;
v63[0] = v63[0] + v44;
}
v45 = v66[0] - v43;
if ( v42 != 1.0 )
{
v62[0] = v62[0] * (float)(1.0 / v42);
v45 = v45 * (float)(1.0 / v42);
v63[0] = v63[0] * (float)(1.0 / v42);
}
GJGroundLayer::updateShadowXPos(*(this + 614), v62[0], v63[0]);
return GJGroundLayer::updateShadowXPos(*(this + 615), v45 + v62[0], v45 + v63[0]);
}
if ( v23 )
{
v29 = 0;
goto LABEL_68;
}
v29 = 0;
}
else if ( v19 )
{
v29 = 1;
if ( v23 )
goto LABEL_68;
}
else if ( v23 )
{
v29 = 2;
}
else
{
v29 = -1;
}
if ( v27 )
v28 = 3;
else
v28 = -1;
goto LABEL_68;
}
return result;
}