//
// GJBaseGameLayer::updateGroundShadows from 0x99995c to 0x99a25c (2304 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::preUpdateVisibility @ 0x9db778
// > ??> @ 0xd1c08
//
// 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:04 +0000
//
__int64 __fastcall GJBaseGameLayer::updateGroundShadows(GJBaseGameLayer *this)
{
cocos2d::CCDirector *v2; // x0
__int64 v3; // x23
const cocos2d::CCPoint *v4; // x0
cocos2d::CCPoint *v5; // x0
const cocos2d::CCPoint *v6; // x4
const cocos2d::CCPoint *v7; // x4
const cocos2d::CCPoint *v8; // x4
const cocos2d::CCPoint *v9; // x4
float v10; // s0
float v11; // s4
float v12; // s2
int v13; // w4
int v14; // w6
float v15; // s2
float v16; // s5
float v17; // s3
int v18; // w2
int v19; // w5
float v20; // s3
float v21; // s6
int v22; // w1
int v23; // w3
float v24; // s6
int v25; // w0
int v26; // w7
int v27; // w22
float v29; // s0
float v30; // s2
float v31; // s2
float v32; // s0
int v33; // w27
float *v34; // x24
__int64 v35; // x25
float *v36; // x20
__int64 v37; // x2
__int64 v38; // x1
int v39; // w27
float v40; // s0
float v41; // s3
int v42; // w22
float v43; // s0
float v44; // s3
__int64 v45; // x0
float v46; // s1
float v47; // s3
float v48; // s0
float v49; // s8
float v50; // s2
int v51; // w0
int v52; // w0
__int64 v53; // [xsp+70h] [xbp+70h]
OBB2D *v54; // [xsp+70h] [xbp+70h]
float v55; // [xsp+70h] [xbp+70h]
__int64 v56; // [xsp+88h] [xbp+88h] BYREF
_BYTE v57[8]; // [xsp+90h] [xbp+90h] BYREF
__int64 v58; // [xsp+98h] [xbp+98h] BYREF
float v59; // [xsp+A0h] [xbp+A0h] BYREF
float v60; // [xsp+A4h] [xbp+A4h]
float v61; // [xsp+A8h] [xbp+A8h] BYREF
float v62; // [xsp+ACh] [xbp+ACh]
float v63; // [xsp+B0h] [xbp+B0h] BYREF
float v64; // [xsp+B4h] [xbp+B4h]
float v65; // [xsp+B8h] [xbp+B8h] BYREF
float v66; // [xsp+BCh] [xbp+BCh]
__int64 v67; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v68; // [xsp+C8h] [xbp+C8h] BYREF
float v69; // [xsp+D0h] [xbp+D0h] BYREF
float v70; // [xsp+D8h] [xbp+D8h] BYREF
float v71; // [xsp+E0h] [xbp+E0h] BYREF
float v72; // [xsp+E8h] [xbp+E8h] BYREF
float v73; // [xsp+F0h] [xbp+F0h] BYREF
float v74; // [xsp+F8h] [xbp+F8h] BYREF
__int64 v75; // [xsp+100h] [xbp+100h] BYREF
float v76; // [xsp+108h] [xbp+108h] BYREF
float v77; // [xsp+10Ch] [xbp+10Ch]
float v78; // [xsp+110h] [xbp+110h] BYREF
float v79; // [xsp+114h] [xbp+114h]
float v80; // [xsp+118h] [xbp+118h] BYREF
float v81; // [xsp+11Ch] [xbp+11Ch]
float v82; // [xsp+120h] [xbp+120h] BYREF
float v83; // [xsp+124h] [xbp+124h]
v2 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(_stack_chk_guard);
v3 = 0;
cocos2d::CCDirector::getWinSize(&v56, v2);
v4 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 495) + 192LL))(*((_QWORD *)this + 495));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v57, v4);
v53 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 495) + 192LL))(*((_QWORD *)this + 495));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v75, *(float *)&v56, 0.0);
cocos2d::CCPoint::operator+(&v58, v53);
v54 = *((OBB2D **)this + 1587);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v75, *(float *)&v56 * 0.5, *((float *)&v56 + 1) * 0.5);
OBB2D::calculateWithCenter(
v54,
(__int64)&v75,
*(float *)&v56,
*((float *)&v56 + 1),
*((float *)this + 201) * 0.017453);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, (const cocos2d::CCPoint *)(*((_QWORD *)this + 1587) + 316LL));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v61, (const cocos2d::CCPoint *)(*((_QWORD *)this + 1587) + 324LL));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v63, (const cocos2d::CCPoint *)(*((_QWORD *)this + 1587) + 332LL));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v65, (const cocos2d::CCPoint *)(*((_QWORD *)this + 1587) + 340LL));
do
{
v5 = (cocos2d::CCPoint *)((char *)&v76 + v3);
v3 += 8;
cocos2d::CCPoint::CCPoint(v5);
}
while ( v3 != 32 );
cocos2d::ccpIntersectPoint(
&v75,
(cocos2d *)&v59,
(const cocos2d::CCPoint *)&v61,
(const cocos2d::CCPoint *)v57,
(const cocos2d::CCPoint *)&v58,
v6);
cocos2d::CCPoint::operator=(&v76, &v75);
cocos2d::ccpIntersectPoint(
&v75,
(cocos2d *)&v61,
(const cocos2d::CCPoint *)&v63,
(const cocos2d::CCPoint *)v57,
(const cocos2d::CCPoint *)&v58,
v7);
cocos2d::CCPoint::operator=(&v78, &v75);
cocos2d::ccpIntersectPoint(
&v75,
(cocos2d *)&v63,
(const cocos2d::CCPoint *)&v65,
(const cocos2d::CCPoint *)v57,
(const cocos2d::CCPoint *)&v58,
v8);
cocos2d::CCPoint::operator=(&v80, &v75);
cocos2d::ccpIntersectPoint(
&v75,
(cocos2d *)&v65,
(const cocos2d::CCPoint *)&v59,
(const cocos2d::CCPoint *)v57,
(const cocos2d::CCPoint *)&v58,
v9);
cocos2d::CCPoint::operator=(&v82, &v75);
v10 = v61;
v11 = v76;
v12 = v61;
if ( v59 <= v61 )
v12 = v59;
if ( v12 > v76 )
goto LABEL_8;
if ( v59 >= v61 )
{
if ( v59 < v76 )
goto LABEL_8;
}
else if ( v61 < v76 )
{
LABEL_8:
v13 = 0;
v14 = 0;
goto LABEL_9;
}
v31 = v62;
if ( v60 <= v62 )
{
if ( v60 > v77 )
goto LABEL_8;
}
else if ( v62 > v77 )
{
goto LABEL_8;
}
if ( v60 >= v62 )
v31 = v60;
if ( v31 < v77 )
goto LABEL_8;
v13 = 1;
v14 = 1;
LABEL_9:
v15 = v63;
v16 = v78;
v17 = v63;
if ( v61 <= v63 )
v17 = v61;
if ( v17 > v78 )
goto LABEL_15;
if ( v61 < v63 )
v10 = v63;
if ( v10 < v78 )
goto LABEL_15;
v32 = v64;
if ( v62 > v64 )
{
if ( v64 <= v79 )
goto LABEL_55;
LABEL_15:
v18 = 0;
v19 = 0;
goto LABEL_16;
}
if ( v62 > v79 )
goto LABEL_15;
LABEL_55:
if ( v62 >= v64 )
v32 = v62;
if ( v32 < v79 )
goto LABEL_15;
v18 = 1;
v19 = 1;
LABEL_16:
v20 = v80;
v21 = v65;
if ( v63 <= v65 )
v21 = v63;
if ( v21 > v80 )
goto LABEL_22;
if ( v63 < v65 )
v15 = v65;
if ( v15 < v80 )
goto LABEL_22;
v30 = v66;
if ( v64 > v66 )
{
if ( v66 <= v81 )
goto LABEL_41;
LABEL_22:
v22 = 0;
v23 = 0;
goto LABEL_23;
}
if ( v64 > v81 )
goto LABEL_22;
LABEL_41:
if ( v64 >= v66 )
v30 = v64;
if ( v30 < v81 )
goto LABEL_22;
v22 = 1;
v23 = 1;
LABEL_23:
v24 = v59;
if ( v59 >= v65 )
v24 = v65;
if ( v24 > v82 )
goto LABEL_28;
if ( v59 <= v65 )
{
if ( v65 < v82 )
goto LABEL_28;
}
else if ( v59 < v82 )
{
LABEL_28:
v25 = 0;
v26 = 0;
goto LABEL_29;
}
v29 = v60;
if ( v66 <= v60 )
{
if ( v66 > v83 )
goto LABEL_28;
}
else if ( v60 > v83 )
{
goto LABEL_28;
}
if ( v66 >= v60 )
v29 = v66;
if ( v29 < v83 )
goto LABEL_28;
v25 = 1;
v26 = 1;
LABEL_29:
v27 = v13 + v18 + v22 + v25;
if ( v27 != 2 )
return _stack_chk_guard;
if ( !v14 )
{
if ( v19 )
{
if ( v23 )
{
v11 = v78;
v33 = 1;
goto LABEL_114;
}
v20 = v78;
v27 = 1;
}
else if ( !v23 )
{
v20 = *(float *)&v75;
v27 = -1;
}
LABEL_76:
if ( v26 )
{
if ( v82 < v20 )
{
v35 = v27;
v34 = &v82;
v33 = 3;
v36 = &v76 + 2 * v27;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v75, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v67, &v82);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v75, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v68, v36);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v69,
(const cocos2d::CCPoint *)(*((_QWORD *)this + 1587) + 316LL));
v38 = *((_QWORD *)this + 1587);
goto LABEL_107;
}
v33 = v27;
v27 = 3;
goto LABEL_79;
}
v33 = v27;
v27 = -1;
v16 = *(float *)&v75;
v11 = v20;
goto LABEL_110;
}
if ( !v19 )
{
if ( v23 )
{
v33 = 0;
goto LABEL_114;
}
v20 = v76;
v27 = 0;
goto LABEL_76;
}
if ( !v23 )
{
v33 = 0;
v27 = 1;
LABEL_110:
if ( v11 > v16 )
{
v34 = &v76 + 2 * v27;
v36 = &v76 + 2 * v33;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v75, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v67, v34);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v75, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v68, v36);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v69,
(const cocos2d::CCPoint *)(*((_QWORD *)this + 1587) + 8LL * (v27 + 1) + 316));
v51 = v33;
v38 = *((_QWORD *)this + 1587);
v33 = v27;
v35 = v51;
v27 = v51;
goto LABEL_81;
}
goto LABEL_79;
}
v20 = v78;
v27 = 1;
v33 = 0;
LABEL_114:
if ( v11 <= v20 )
{
LABEL_79:
v34 = &v76 + 2 * v33;
v35 = v27;
v36 = &v76 + 2 * v27;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v75, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v67, v34);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v75, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v68, v36);
v37 = *((_QWORD *)this + 1587);
goto LABEL_80;
}
v34 = &v76 + 2 * v27;
v36 = &v76 + 2 * v33;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v75, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v67, v34);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v75, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v68, v36);
v52 = v33;
v37 = *((_QWORD *)this + 1587);
v33 = v27;
v35 = v52;
v27 = v52;
LABEL_80:
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v69, (const cocos2d::CCPoint *)(v37 + 8LL * (v33 + 1) + 316));
v38 = *((_QWORD *)this + 1587);
if ( v33 <= 1 )
{
LABEL_81:
v39 = v33 + 2;
goto LABEL_82;
}
LABEL_107:
v39 = v33 - 2;
LABEL_82:
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v70, (const cocos2d::CCPoint *)(v38 + 8LL * v39 + 316));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v71, (const cocos2d::CCPoint *)v34);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v72, (const cocos2d::CCPoint *)v36);
if ( v71 == 0.0 && v72 == 0.0 )
{
cocos2d::CCPoint::operator=(&v71, &v67);
cocos2d::CCPoint::operator=(&v72, &v68);
}
v40 = v70;
v41 = v70;
if ( v69 <= v70 )
v41 = v69;
if ( v41 < *(float *)&v67 )
{
if ( v69 >= v70 )
v40 = v69;
if ( v40 > *(float *)&v67 )
v71 = v71 - vabds_f32(*(float *)&v67, v69);
}
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v73,
(const cocos2d::CCPoint *)(*((_QWORD *)this + 1587) + 8 * v35 + 316));
if ( v27 <= 0 )
v42 = 3;
else
v42 = v27 - 1;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v74,
(const cocos2d::CCPoint *)(*((_QWORD *)this + 1587) + 8LL * v42 + 316));
v43 = v74;
v44 = v74;
if ( v73 <= v74 )
v44 = v73;
if ( v44 < *(float *)&v68 )
{
if ( v73 >= v74 )
v43 = v73;
if ( v43 > *(float *)&v68 )
v72 = vabds_f32(*(float *)&v68, v73) + v72;
}
v55 = *(float *)&v56 - v71;
v45 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 496) + 192LL))(*((_QWORD *)this + 496));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v75, v55, *(float *)(v45 + 4));
v46 = v72;
v47 = *((float *)this + 106);
v48 = v71;
v49 = *(float *)&v75 - v72;
if ( (float)(v47 * 180.0) > (float)(v72 - v71) )
{
v50 = (float)(v47 * 180.0) - (float)(v72 - v71);
v48 = v71 - (float)(v50 * 0.5);
v46 = v72 + (float)(v50 * 0.5);
v71 = v48;
v72 = v46;
}
if ( v47 != 1.0 )
{
v48 = v48 * (float)(1.0 / v47);
v46 = v46 * (float)(1.0 / v47);
v49 = v49 * (float)(1.0 / v47);
v71 = v48;
v72 = v46;
}
GJGroundLayer::updateShadowXPos(*((GJGroundLayer **)this + 495), v48, v46);
GJGroundLayer::updateShadowXPos(*((GJGroundLayer **)this + 496), v49 + v71, v49 + v72);
return _stack_chk_guard;
}