//
// GJBaseGameLayer::updateGroundShadows from 0x857428 to 0x857d28 (2304 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::preUpdateVisibility @ 0x882d14
// > ??> @ 0x9f660
//
// 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
//
void GJBaseGameLayer::updateGroundShadows(GJBaseGameLayer *a1)
{
cocos2d::CCDirector *v2; // x0
__int64 v3; // x23
const cocos2d::CCPoint *v4; // x0
float v5; // s4
cocos2d::CCPoint *v6; // x0
float x; // s0
float v8; // s4
float v9; // s2
int v10; // w0
int v11; // w5
float v12; // s2
float v13; // s5
float v14; // s3
int v15; // w2
int v16; // w4
float v17; // s3
float v18; // s6
int v19; // w1
int v20; // w3
float v21; // s6
int v22; // w22
int v23; // w6
int v24; // w22
float v25; // s0
float v26; // s2
float y; // s2
float v28; // s0
int v29; // w27
const cocos2d::CCPoint *v30; // x24
__int64 v31; // x25
const cocos2d::CCPoint *v32; // x20
OBB2D *v33; // x2
OBB2D *v34; // x1
int v35; // w27
float v36; // s1
float v37; // s0
float v38; // s3
int v39; // w22
float v40; // s0
float v41; // s3
const cocos2d::CCPoint *v42; // x0
float v43; // s1
float m_cameraZoom; // s3
float v45; // s0
float v46; // s8
float v47; // s2
int v48; // w0
int v49; // w0
float v50; // s0
float v51; // s1
const cocos2d::CCPoint *v52; // [xsp+70h] [xbp+70h]
OBB2D *m_cameraObb2; // [xsp+70h] [xbp+70h]
float v54; // [xsp+70h] [xbp+70h]
cocos2d::CCPoint v56; // [xsp+90h] [xbp+90h] BYREF
cocos2d::CCPoint v57; // [xsp+98h] [xbp+98h] BYREF
cocos2d::CCPoint v58; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::CCPoint v59; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::CCPoint v60; // [xsp+B0h] [xbp+B0h] BYREF
cocos2d::CCPoint v61; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v62; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v63; // [xsp+C8h] [xbp+C8h] BYREF
cocos2d::CCPoint v64; // [xsp+D0h] [xbp+D0h] BYREF
cocos2d::CCPoint v65; // [xsp+D8h] [xbp+D8h] BYREF
cocos2d::CCPoint v66; // [xsp+E0h] [xbp+E0h] BYREF
cocos2d::CCPoint v67; // [xsp+E8h] [xbp+E8h] BYREF
cocos2d::CCPoint v68; // [xsp+F0h] [xbp+F0h] BYREF
cocos2d::CCPoint v69; // [xsp+F8h] [xbp+F8h] BYREF
cocos2d::CCPoint v70; // [xsp+100h] [xbp+100h] BYREF
float v71; // [xsp+108h] [xbp+108h] BYREF
float v72; // [xsp+10Ch] [xbp+10Ch]
float v73; // [xsp+110h] [xbp+110h] BYREF
float v74; // [xsp+114h] [xbp+114h]
float v75; // [xsp+118h] [xbp+118h] BYREF
float v76; // [xsp+11Ch] [xbp+11Ch]
float v77; // [xsp+120h] [xbp+120h] BYREF
float v78; // [xsp+124h] [xbp+124h]
cocos2d::CCPoint v79; // 0:^88.8
cocos2d::CCSize WinSize; // 0:kr00_8.8
cocos2d::CCPoint v81; // 0:kr08_8.8
cocos2d::CCPoint v82; // 0:kr10_8.8
cocos2d::CCPoint v83; // 0:kr18_8.8
cocos2d::CCPoint v84; // 0:kr20_8.8
v2 = cocos2d::CCDirector::sharedDirector();
v3 = 0;
WinSize = cocos2d::CCDirector::getWinSize(v2);
v4 = (const cocos2d::CCPoint *)((__int64 (__fastcall *)(GJGroundLayer *, float, float))a1->m_groundLayer->getPosition)(
a1->m_groundLayer,
WinSize.width,
WinSize.height);
cocos2d::CCPoint::CCPoint(&v56, v4);
v52 = a1->m_groundLayer->getPosition(a1->m_groundLayer);
cocos2d::CCPoint::CCPoint(&v70, v79.x, 0.0);
cocos2d::CCPoint::operator+(&v57, v52, &v70);
m_cameraObb2 = a1->m_cameraObb2;
cocos2d::CCPoint::CCPoint(&v70, v79.x * 0.5, v79.y * 0.5);
OBB2D::calculateWithCenter(
m_cameraObb2,
v79,
a1->m_gameState.m_cameraAngle * 0.017453,
a1->m_gameState.m_cameraAngle,
v5);
cocos2d::CCPoint::CCPoint(&v58, a1->m_cameraObb2->m_corners.__elems_);
cocos2d::CCPoint::CCPoint(&v59, &a1->m_cameraObb2->m_corners.__elems_[1]);
cocos2d::CCPoint::CCPoint(&v60, &a1->m_cameraObb2->m_corners.__elems_[2]);
cocos2d::CCPoint::CCPoint(&v61, &a1->m_cameraObb2->m_corners.__elems_[3]);
do
{
v6 = (cocos2d::CCPoint *)((char *)&v71 + v3);
v3 += 8;
cocos2d::CCPoint::CCPoint(v6);
}
while ( v3 != 32 );
v81 = cocos2d::ccpIntersectPoint(&v58, &v59, &v56, &v57);
cocos2d::CCPoint::operator=(&v71, v81.x, v81.y);
v82 = cocos2d::ccpIntersectPoint(&v59, &v60, &v56, &v57);
cocos2d::CCPoint::operator=(&v73, v82.x, v82.y);
v83 = cocos2d::ccpIntersectPoint(&v60, &v61, &v56, &v57);
cocos2d::CCPoint::operator=(&v75, v83.x, v83.y);
v84 = cocos2d::ccpIntersectPoint(&v61, &v58, &v56, &v57);
cocos2d::CCPoint::operator=(&v77, v84.x, v84.y);
x = v59.x;
v8 = v71;
v9 = v59.x;
if ( v58.x <= v59.x )
v9 = v58.x;
if ( v9 > v71 )
goto LABEL_8;
if ( v58.x >= v59.x )
{
if ( v58.x < v71 )
goto LABEL_8;
}
else if ( v59.x < v71 )
{
LABEL_8:
v10 = 0;
v11 = 0;
goto LABEL_9;
}
y = v59.y;
if ( v58.y <= v59.y )
{
if ( v58.y > v72 )
goto LABEL_8;
}
else if ( v59.y > v72 )
{
goto LABEL_8;
}
if ( v58.y >= v59.y )
y = v58.y;
if ( y < v72 )
goto LABEL_8;
v10 = 1;
v11 = 1;
LABEL_9:
v12 = v60.x;
v13 = v73;
v14 = v60.x;
if ( v59.x <= v60.x )
v14 = v59.x;
if ( v14 > v73 )
goto LABEL_15;
if ( v59.x < v60.x )
x = v60.x;
if ( x < v73 )
goto LABEL_15;
v28 = v60.y;
if ( v59.y > v60.y )
{
if ( v60.y <= v74 )
goto LABEL_55;
LABEL_15:
v15 = 0;
v16 = 0;
goto LABEL_16;
}
if ( v59.y > v74 )
goto LABEL_15;
LABEL_55:
if ( v59.y >= v60.y )
v28 = v59.y;
if ( v28 < v74 )
goto LABEL_15;
v15 = 1;
v16 = 1;
LABEL_16:
v17 = v75;
v18 = v61.x;
if ( v60.x <= v61.x )
v18 = v60.x;
if ( v18 > v75 )
goto LABEL_22;
if ( v60.x < v61.x )
v12 = v61.x;
if ( v12 < v75 )
goto LABEL_22;
v26 = v61.y;
if ( v60.y > v61.y )
{
if ( v61.y <= v76 )
goto LABEL_41;
LABEL_22:
v19 = 0;
v20 = 0;
goto LABEL_23;
}
if ( v60.y > v76 )
goto LABEL_22;
LABEL_41:
if ( v60.y >= v61.y )
v26 = v60.y;
if ( v26 < v76 )
goto LABEL_22;
v19 = 1;
v20 = 1;
LABEL_23:
v21 = v58.x;
if ( v58.x >= v61.x )
v21 = v61.x;
if ( v21 > v77 )
goto LABEL_28;
if ( v58.x <= v61.x )
{
if ( v61.x < v77 )
goto LABEL_28;
}
else if ( v58.x < v77 )
{
LABEL_28:
v22 = 0;
v23 = 0;
goto LABEL_29;
}
v25 = v58.y;
if ( v61.y <= v58.y )
{
if ( v61.y > v78 )
goto LABEL_28;
}
else if ( v58.y > v78 )
{
goto LABEL_28;
}
if ( v61.y >= v58.y )
v25 = v61.y;
if ( v25 < v78 )
goto LABEL_28;
v22 = 1;
v23 = 1;
LABEL_29:
v24 = v19 + v15 + v10 + v22;
if ( v24 != 2 )
return;
if ( !v11 )
{
if ( v16 )
{
if ( v20 )
{
v8 = v73;
v29 = 1;
goto LABEL_114;
}
v17 = v73;
v24 = 1;
}
else if ( !v20 )
{
v17 = v70.x;
v24 = -1;
}
LABEL_76:
if ( v23 )
{
if ( v77 < v17 )
{
v31 = v24;
v30 = (const cocos2d::CCPoint *)&v77;
v29 = 3;
v32 = (const cocos2d::CCPoint *)(&v71 + 2 * v24);
cocos2d::CCPoint::CCPoint(&v70, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v62, &v77, &v70);
cocos2d::CCPoint::CCPoint(&v70, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v63, v32, &v70);
cocos2d::CCPoint::CCPoint(&v64, a1->m_cameraObb2->m_corners.__elems_);
v34 = a1->m_cameraObb2;
goto LABEL_107;
}
v29 = v24;
v24 = 3;
goto LABEL_79;
}
v29 = v24;
v24 = -1;
v13 = v70.x;
v8 = v17;
goto LABEL_110;
}
if ( !v16 )
{
if ( v20 )
{
v29 = 0;
goto LABEL_114;
}
v17 = v71;
v24 = 0;
goto LABEL_76;
}
if ( !v20 )
{
v29 = 0;
v24 = 1;
LABEL_110:
if ( v13 < v8 )
{
v30 = (const cocos2d::CCPoint *)(&v71 + 2 * v24);
v32 = (const cocos2d::CCPoint *)(&v71 + 2 * v29);
cocos2d::CCPoint::CCPoint(&v70, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v62, v30, &v70);
cocos2d::CCPoint::CCPoint(&v70, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v63, v32, &v70);
cocos2d::CCPoint::CCPoint(&v64, (const cocos2d::CCPoint *)(&a1->m_cameraObb2->m_uID + 2 * v24 + 79));
v48 = v29;
v34 = a1->m_cameraObb2;
v29 = v24;
v31 = v48;
v24 = v48;
goto LABEL_81;
}
goto LABEL_79;
}
v17 = v73;
v24 = 1;
v29 = 0;
LABEL_114:
if ( v17 >= v8 )
{
LABEL_79:
v30 = (const cocos2d::CCPoint *)(&v71 + 2 * v29);
v31 = v24;
v32 = (const cocos2d::CCPoint *)(&v71 + 2 * v24);
cocos2d::CCPoint::CCPoint(&v70, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v62, v30, &v70);
cocos2d::CCPoint::CCPoint(&v70, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v63, v32, &v70);
v33 = a1->m_cameraObb2;
goto LABEL_80;
}
v30 = (const cocos2d::CCPoint *)(&v71 + 2 * v24);
v32 = (const cocos2d::CCPoint *)(&v71 + 2 * v29);
cocos2d::CCPoint::CCPoint(&v70, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v62, v30, &v70);
cocos2d::CCPoint::CCPoint(&v70, 0.0, -128.0);
cocos2d::CCPoint::operator+(&v63, v32, &v70);
v49 = v29;
v33 = a1->m_cameraObb2;
v29 = v24;
v31 = v49;
v24 = v49;
LABEL_80:
cocos2d::CCPoint::CCPoint(&v64, (const cocos2d::CCPoint *)(&v33->m_uID + 2 * v29 + 79));
v34 = a1->m_cameraObb2;
if ( v29 <= 1 )
{
LABEL_81:
v35 = v29 + 2;
goto LABEL_82;
}
LABEL_107:
v35 = v29 - 2;
LABEL_82:
cocos2d::CCPoint::CCPoint(&v65, &v34->m_corners.__elems_[v35]);
cocos2d::CCPoint::CCPoint(&v66, v30);
cocos2d::CCPoint::CCPoint(&v67, v32);
if ( v66.x == 0.0 && v67.x == 0.0 )
{
cocos2d::CCPoint::operator=(&v66, v67.x, v36);
cocos2d::CCPoint::operator=(&v67, v50, v51);
}
v37 = v65.x;
v38 = v65.x;
if ( v64.x <= v65.x )
v38 = v64.x;
if ( v38 < *(float *)&v62 )
{
if ( v64.x >= v65.x )
v37 = v64.x;
if ( v37 > *(float *)&v62 )
v66.x = v66.x - vabds_f32(*(float *)&v62, v64.x);
}
cocos2d::CCPoint::CCPoint(&v68, &a1->m_cameraObb2->m_corners.__elems_[v31]);
if ( v24 <= 0 )
v39 = 3;
else
v39 = v24 - 1;
cocos2d::CCPoint::CCPoint(&v69, &a1->m_cameraObb2->m_corners.__elems_[v39]);
v40 = v69.x;
v41 = v69.x;
if ( v68.x <= v69.x )
v41 = v68.x;
if ( v41 < *(float *)&v63 )
{
if ( v68.x >= v69.x )
v40 = v68.x;
if ( v40 > *(float *)&v63 )
v67.x = v67.x + vabds_f32(*(float *)&v63, v68.x);
}
v54 = v79.x - v66.x;
v42 = a1->m_groundLayer2->getPosition(a1->m_groundLayer2);
cocos2d::CCPoint::CCPoint(&v70, v54, v42->y);
v43 = v67.x;
m_cameraZoom = a1->m_gameState.m_cameraZoom;
v45 = v66.x;
v46 = v70.x - v67.x;
if ( (float)(m_cameraZoom * 180.0) > (float)(v67.x - v66.x) )
{
v47 = (float)(m_cameraZoom * 180.0) - (float)(v67.x - v66.x);
v45 = v66.x - (float)(v47 * 0.5);
v43 = v67.x + (float)(v47 * 0.5);
v66.x = v45;
v67.x = v43;
}
if ( m_cameraZoom != 1.0 )
{
v45 = v45 * (float)(1.0 / m_cameraZoom);
v43 = v43 * (float)(1.0 / m_cameraZoom);
v46 = v46 * (float)(1.0 / m_cameraZoom);
v66.x = v45;
v67.x = v43;
}
GJGroundLayer::updateShadowXPos(a1->m_groundLayer, v45, v43);
GJGroundLayer::updateShadowXPos(a1->m_groundLayer2, v46 + v66.x, v46 + v67.x);
}