//
// GJBaseGameLayer::updateGroundShadows from 0x46d308 to 0x46d96e (1638 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::preUpdateVisibility @ 0x489118
//
// 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; // r0
const cocos2d::CCPoint *v3; // r0
const cocos2d::CCPoint *v4; // r8
OBB2D *m_cameraObb2; // r9
cocos2d::CCPoint v6; // r1
OBB2D *v7; // r0
int v8; // r9
cocos2d::CCPoint *v9; // r0
int v10; // r2
bool v11; // r3
int v12; // r2
bool v13; // r3
int v14; // r2
bool v15; // r3
int v16; // r2
bool v17; // r3
float x; // s15
float v19; // s13
float v20; // s12
float v21; // s12
float y; // s14
float v23; // s10
_BOOL4 v24; // r0
float v25; // s14
float v26; // s11
float v27; // s13
float v28; // s10
_BOOL4 v29; // r3
float v30; // s11
float v31; // s14
float v32; // s10
_BOOL4 v33; // r1
float v34; // s12
float v35; // s15
float v36; // s12
_BOOL4 v37; // r2
int v38; // r4
int v39; // r6
int v40; // r2
const cocos2d::CCPoint *v41; // r11
const cocos2d::CCPoint *v42; // r8
int v43; // r2
int v44; // r3
int v45; // r2
bool v46; // r3
int v47; // r2
bool v48; // r3
float v49; // s14
float v50; // s12
int v51; // r4
float v52; // s16
float v53; // s13
float v54; // s16
const cocos2d::CCPoint *v55; // r0
float m_cameraZoom; // s12
float v57; // s14
float v58; // s15
float v59; // s16
float v60; // [sp+4h] [bp-18h]
cocos2d::CCSize v61; // [sp+14h] [bp-8h] BYREF
cocos2d::CCPoint v62; // [sp+1Ch] [bp+0h] BYREF
cocos2d::CCPoint v63; // [sp+24h] [bp+8h] BYREF
cocos2d::CCPoint v64; // [sp+2Ch] [bp+10h] BYREF
cocos2d::CCPoint v65; // [sp+34h] [bp+18h] BYREF
cocos2d::CCPoint v66; // [sp+3Ch] [bp+20h] BYREF
cocos2d::CCPoint v67; // [sp+44h] [bp+28h] BYREF
float v68[2]; // [sp+4Ch] [bp+30h] BYREF
float v69[2]; // [sp+54h] [bp+38h] BYREF
cocos2d::CCPoint v70; // [sp+5Ch] [bp+40h] BYREF
cocos2d::CCPoint v71; // [sp+64h] [bp+48h] BYREF
cocos2d::CCPoint v72; // [sp+6Ch] [bp+50h] BYREF
cocos2d::CCPoint v73; // [sp+74h] [bp+58h] BYREF
cocos2d::CCPoint v74; // [sp+7Ch] [bp+60h] BYREF
cocos2d::CCPoint v75; // [sp+84h] [bp+68h] BYREF
cocos2d::CCPoint v76; // [sp+8Ch] [bp+70h] BYREF
float v77; // [sp+94h] [bp+78h] BYREF
float v78; // [sp+98h] [bp+7Ch]
float v79; // [sp+9Ch] [bp+80h] BYREF
float v80; // [sp+A0h] [bp+84h]
float v81; // [sp+A4h] [bp+88h] BYREF
float v82; // [sp+A8h] [bp+8Ch]
float v83; // [sp+ACh] [bp+90h] BYREF
float v84; // [sp+B0h] [bp+94h]
v2 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v61, v2);
v3 = a1->m_groundLayer->getPosition(a1->m_groundLayer);
cocos2d::CCPoint::CCPoint(&v62, v3);
v4 = a1->m_groundLayer->getPosition(a1->m_groundLayer);
cocos2d::CCPoint::CCPoint(&v76, v61.width, 0.0);
cocos2d::CCPoint::operator+(&v63, v4, &v76);
m_cameraObb2 = a1->m_cameraObb2;
cocos2d::CCPoint::CCPoint(&v76, v61.width * 0.5, v61.height * 0.5);
v6.y = v61.width;
v7 = m_cameraObb2;
LODWORD(v6.x) = &v76;
v8 = 0;
OBB2D::calculateWithCenter(v7, v6, v61.height, a1->m_gameState.m_cameraAngle * 0.017453, v60);
cocos2d::CCPoint::CCPoint(&v64, a1->m_cameraObb2->m_corners.__elems_);
cocos2d::CCPoint::CCPoint(&v65, &a1->m_cameraObb2->m_corners.__elems_[1]);
cocos2d::CCPoint::CCPoint(&v66, &a1->m_cameraObb2->m_corners.__elems_[2]);
cocos2d::CCPoint::CCPoint(&v67, &a1->m_cameraObb2->m_corners.__elems_[3]);
do
{
v9 = (cocos2d::CCPoint *)((char *)&v77 + v8);
v8 += 8;
cocos2d::CCPoint::CCPoint(v9);
}
while ( v8 != 32 );
cocos2d::ccpIntersectPoint(&v76, &v64, &v65, &v62, &v63);
cocos2d::CCPoint::operator=((PlayerObject *)&v77, COERCE_FLOAT(&v76), v10, v11);
cocos2d::ccpIntersectPoint(&v76, &v65, &v66, &v62, &v63);
cocos2d::CCPoint::operator=((PlayerObject *)&v79, COERCE_FLOAT(&v76), v12, v13);
cocos2d::ccpIntersectPoint(&v76, &v66, &v67, &v62, &v63);
cocos2d::CCPoint::operator=((PlayerObject *)&v81, COERCE_FLOAT(&v76), v14, v15);
cocos2d::ccpIntersectPoint(&v76, &v67, &v64, &v62, &v63);
cocos2d::CCPoint::operator=((PlayerObject *)&v83, COERCE_FLOAT(&v76), v16, v17);
x = v64.x;
v19 = v65.x;
if ( v64.x > v65.x )
v20 = v65.x;
else
v20 = v64.x;
if ( v77 < v20
|| (v64.x < v65.x ? (v21 = v65.x) : (v21 = v64.x),
v77 > v21 || ((y = v65.y, v64.y > v65.y) ? (v23 = v65.y) : (v23 = v64.y), v78 < v23)) )
{
v24 = 0;
}
else
{
if ( v64.y >= v65.y )
y = v64.y;
v24 = v78 <= y;
}
v25 = v66.x;
if ( v65.x > v66.x )
v26 = v66.x;
else
v26 = v65.x;
if ( v79 < v26 )
goto LABEL_33;
if ( v65.x < v66.x )
v19 = v66.x;
if ( v79 > v19 || ((v27 = v66.y, v65.y > v66.y) ? (v28 = v66.y) : (v28 = v65.y), v80 < v28) )
{
LABEL_33:
v29 = 0;
}
else
{
if ( v65.y >= v66.y )
v27 = v65.y;
v29 = v80 <= v27;
}
if ( v66.x > v67.x )
v30 = v67.x;
else
v30 = v66.x;
if ( v81 < v30 )
goto LABEL_48;
if ( v66.x < v67.x )
v25 = v67.x;
if ( v81 > v25 || ((v31 = v67.y, v66.y > v67.y) ? (v32 = v67.y) : (v32 = v66.y), v82 < v32) )
{
LABEL_48:
v33 = 0;
}
else
{
if ( v66.y >= v67.y )
v31 = v66.y;
v33 = v82 <= v31;
}
if ( v67.x > v64.x )
v34 = v64.x;
else
v34 = v67.x;
if ( v83 < v34 )
goto LABEL_63;
if ( v67.x >= v64.x )
x = v67.x;
if ( v83 > x || ((v35 = v64.y, v67.y > v64.y) ? (v36 = v64.y) : (v36 = v67.y), v84 < v36) )
{
LABEL_63:
v37 = 0;
}
else
{
if ( v67.y >= v64.y )
v35 = v67.y;
v37 = v84 <= v35;
}
v38 = v24 + v29 + v33 + v37;
if ( v38 == 2 )
{
if ( v24 )
{
if ( v29 )
{
v39 = 0;
v38 = 1;
LABEL_68:
if ( *(&v77 + 2 * v39) > *(&v77 + 2 * v38) )
{
v40 = v39;
v39 = v38;
v38 = v40;
}
v41 = (const cocos2d::CCPoint *)(&v77 + 2 * v39);
cocos2d::CCPoint::CCPoint(&v76, 0.0, -128.0);
v42 = (const cocos2d::CCPoint *)(&v77 + 2 * v38);
cocos2d::CCPoint::operator+(v68, v41, &v76);
cocos2d::CCPoint::CCPoint(&v76, 0.0, -128.0);
cocos2d::CCPoint::operator+(v69, v42, &v76);
if ( v39 <= 2 )
v43 = v39 + 1;
else
v43 = v39 - 3;
cocos2d::CCPoint::CCPoint(&v70, &a1->m_cameraObb2->m_corners.__elems_[v43]);
if ( v39 <= 1 )
v44 = v39 + 2;
else
v44 = v39 - 2;
cocos2d::CCPoint::CCPoint(&v71, &a1->m_cameraObb2->m_corners.__elems_[v44]);
cocos2d::CCPoint::CCPoint(&v72, v41);
cocos2d::CCPoint::CCPoint(&v73, v42);
if ( v72.x == 0.0 && v73.x == 0.0 )
{
cocos2d::CCPoint::operator=((PlayerObject *)&v72, COERCE_FLOAT(v68), v45, v46);
cocos2d::CCPoint::operator=((PlayerObject *)&v73, COERCE_FLOAT(v69), v47, v48);
}
v49 = v71.x;
if ( v70.x > v71.x )
v50 = v71.x;
else
v50 = v70.x;
if ( v68[0] > v50 )
{
if ( v70.x >= v71.x )
v49 = v70.x;
if ( v68[0] < v49 )
v72.x = v72.x - fabsf(v68[0] - v70.x);
}
cocos2d::CCPoint::CCPoint(&v74, &a1->m_cameraObb2->m_corners.__elems_[v38]);
if ( v38 <= 0 )
v51 = 3;
else
v51 = v38 - 1;
cocos2d::CCPoint::CCPoint(&v75, &a1->m_cameraObb2->m_corners.__elems_[v51]);
v52 = v75.x;
if ( v74.x > v75.x )
v53 = v75.x;
else
v53 = v74.x;
if ( v69[0] > v53 )
{
if ( v74.x >= v75.x )
v52 = v74.x;
if ( v69[0] < v52 )
v73.x = v73.x + fabsf(v69[0] - v74.x);
}
v54 = v61.width - v72.x;
v55 = a1->m_groundLayer2->getPosition(a1->m_groundLayer2);
cocos2d::CCPoint::CCPoint(&v76, v54, v55->y);
m_cameraZoom = a1->m_gameState.m_cameraZoom;
v57 = v73.x;
if ( (float)(v73.x - v72.x) < (float)(m_cameraZoom * 180.0) )
{
v58 = (float)((float)(m_cameraZoom * 180.0) - (float)(v73.x - v72.x)) * 0.5;
v72.x = v72.x - v58;
v73.x = v73.x + v58;
}
v59 = v76.x - v57;
if ( m_cameraZoom != 1.0 )
{
v72.x = v72.x * (float)(1.0 / m_cameraZoom);
v59 = v59 * (float)(1.0 / m_cameraZoom);
v73.x = v73.x * (float)(1.0 / m_cameraZoom);
}
GJGroundLayer::updateShadowXPos(a1->m_groundLayer, v72.x, v73.x);
GJGroundLayer::updateShadowXPos(a1->m_groundLayer2, v59 + v72.x, v59 + v73.x);
return;
}
if ( v33 )
{
v39 = 0;
goto LABEL_68;
}
v39 = 0;
}
else if ( v29 )
{
v39 = 1;
if ( v33 )
goto LABEL_68;
}
else if ( v33 )
{
v39 = 2;
}
else
{
v39 = -1;
}
if ( v37 )
v38 = 3;
else
v38 = -1;
goto LABEL_68;
}
}