//
// GJBaseGameLayer::updateGroundShadows from 0x14020bd60 to 0x14020c482 (1826 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::preUpdateVisibility @ 0x140236634
// > ??> @ 0x14067eb60
// > ??> @ 0x14067ebac
// > ??> @ 0x1406ccd2c
//
// 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; // rax
double v3; // xmm0_8
const cocos2d::CCPoint *v4; // rax
double v5; // xmm0_8
float v6; // xmm6_4
cocos2d::CCPoint v7; // rax
struct cocos2d::CCPoint v8; // rax
struct cocos2d::CCPoint v9; // rax
struct cocos2d::CCPoint v10; // rax
struct cocos2d::CCPoint v11; // rax
bool v12; // r10
bool v13; // r9
bool v14; // r8
float v15; // xmm0_4
bool v16; // dl
int v17; // esi
int v18; // ecx
int v19; // r15d
double v20; // xmm0_8
float x; // xmm2_4
float v22; // xmm0_4
float v23; // xmm2_4
float m_cameraZoom; // xmm4_4
float v25; // xmm1_4
float v26; // xmm6_4
float v27; // xmm0_4
cocos2d::CCPoint v28; // [rsp+38h] [rbp-D0h] BYREF
cocos2d::CCPoint v29; // [rsp+40h] [rbp-C8h] BYREF
int v30; // [rsp+48h] [rbp-C0h] BYREF
float v31; // [rsp+50h] [rbp-B8h]
float v32; // [rsp+54h] [rbp-B4h]
struct cocos2d::CCPoint v33; // [rsp+58h] [rbp-B0h] BYREF
cocos2d::CCPoint v34; // [rsp+60h] [rbp-A8h] BYREF
cocos2d::CCPoint v35; // [rsp+68h] [rbp-A0h] BYREF
cocos2d::CCPoint v36; // [rsp+70h] [rbp-98h] BYREF
cocos2d::CCPoint v37; // [rsp+78h] [rbp-90h] BYREF
cocos2d::CCPoint v38; // [rsp+80h] [rbp-88h] BYREF
float v39; // [rsp+88h] [rbp-80h] BYREF
float v40; // [rsp+90h] [rbp-78h] BYREF
cocos2d::CCPoint v41; // [rsp+98h] [rbp-70h] BYREF
cocos2d::CCPoint v42; // [rsp+A0h] [rbp-68h] BYREF
cocos2d::CCPoint v43; // [rsp+A8h] [rbp-60h] BYREF
cocos2d::CCPoint v44; // [rsp+B0h] [rbp-58h] BYREF
float v45; // [rsp+B8h] [rbp-50h]
cocos2d::CCPoint v46; // [rsp+C0h] [rbp-48h] BYREF
cocos2d::CCPoint v47; // [rsp+C8h] [rbp-40h] BYREF
cocos2d::CCPoint v48; // [rsp+D0h] [rbp-38h] BYREF
cocos2d::CCPoint v49; // [rsp+D8h] [rbp-30h] BYREF
v2 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v2);
a1->m_groundLayer->getPosition_0(a1->m_groundLayer);
v3 = cocos2d::CCPoint::CCPoint(&v34);
cocos2d::CCPoint::CCPoint(*(float *)&v3, v31);
v4 = a1->m_groundLayer->getPosition_0(a1->m_groundLayer);
v5 = cocos2d::CCPoint::operator+(v4, &v33);
v6 = a1->m_gameState.m_cameraAngle * 0.017453292;
cocos2d::CCPoint::CCPoint(*(float *)&v5, v31 * 0.5);
OBB2D::calculateWithCenter(a1->m_cameraObb2, v7, v31, v32, v6);
cocos2d::CCPoint::CCPoint(&v35);
cocos2d::CCPoint::CCPoint(&v36);
cocos2d::CCPoint::CCPoint(&v37);
cocos2d::CCPoint::CCPoint(&v38);
cocos2d::CCPoint::CCPoint(&v46);
cocos2d::CCPoint::CCPoint(&v47);
cocos2d::CCPoint::CCPoint(&v48);
cocos2d::CCPoint::CCPoint(&v49);
v8 = cocos2d::ccpIntersectPoint((cocos2d *)&v30, &v35, &v36, &v34, &v33);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(&v46, v8);
v9 = cocos2d::ccpIntersectPoint((cocos2d *)&v30, &v36, &v37, &v34, &v33);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(&v47, v9);
v10 = cocos2d::ccpIntersectPoint((cocos2d *)&v30, &v37, &v38, &v34, &v33);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(&v48, v10);
v11 = cocos2d::ccpIntersectPoint((cocos2d *)&v30, &v38, &v35, &v34, &v33);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(&v49, v11);
v12 = fminf(v35.x, v36.x) <= v46.x
&& v46.x <= fmaxf(v35.x, v36.x)
&& fminf(v35.y, v36.y) <= v46.y
&& v46.y <= fmaxf(v35.y, v36.y);
v13 = fminf(v36.x, v37.x) <= v47.x
&& v47.x <= fmaxf(v36.x, v37.x)
&& fminf(v36.y, v37.y) <= v47.y
&& v47.y <= fmaxf(v36.y, v37.y);
v14 = fminf(v37.x, v38.x) <= v48.x
&& v48.x <= fmaxf(v37.x, v38.x)
&& fminf(v37.y, v38.y) <= v48.y
&& v48.y <= fmaxf(v37.y, v38.y);
v15 = fminf(v38.x, v35.x);
v16 = false;
if ( v15 <= v49.x && v49.x <= fmaxf(v38.x, v35.x) )
{
v15 = fminf(v38.y, v35.y);
if ( v15 <= v49.y && v49.y <= fmaxf(v38.y, v35.y) )
v16 = true;
}
if ( v12 + v13 + v14 + v16 == 2 )
{
v17 = -1;
v18 = v12 - 1;
if ( v13 )
{
if ( v18 >= 0 )
v17 = 1;
else
v18 = 1;
}
if ( v14 )
{
if ( v18 < 0 )
{
v18 = 2;
}
else if ( v17 < 0 )
{
v17 = 2;
}
}
if ( v16 && v17 < 0 )
v17 = 3;
v19 = v18;
if ( *(&v46.x + 2 * v18) <= *(&v46.x + 2 * v17) )
{
v19 = v17;
v17 = v18;
}
cocos2d::CCPoint::CCPoint(v15, 0.0);
v20 = cocos2d::CCPoint::operator+(&v46 + v17, &v39);
cocos2d::CCPoint::CCPoint(*(float *)&v20, 0.0);
cocos2d::CCPoint::operator+(&v46 + v19, &v40);
cocos2d::CCPoint::CCPoint(&v41);
cocos2d::CCPoint::CCPoint(&v42);
cocos2d::CCPoint::CCPoint(&v28);
cocos2d::CCPoint::CCPoint(&v29);
x = v28.x;
if ( v28.x == 0.0 && v29.x == 0.0 )
{
cocos2d::CCPoint::operator=(&v28, &v39);
cocos2d::CCPoint::operator=(&v29, &v40);
x = v28.x;
}
if ( v39 > fminf(v41.x, v42.x) && fmaxf(v41.x, v42.x) > v39 )
v28.x = x - fabs(v39 - v41.x);
cocos2d::CCPoint::CCPoint(&v43);
cocos2d::CCPoint::CCPoint(&v44);
v22 = fminf(v43.x, v44.x);
if ( v40 > v22 )
{
v22 = fmaxf(v43.x, v44.x);
if ( v22 > v40 )
{
v22 = v29.x + fabs(v40 - v43.x);
v29.x = v22;
}
}
a1->m_groundLayer2->getPosition_0(a1->m_groundLayer2);
cocos2d::CCPoint::CCPoint(v22, v31 - v28.x);
v23 = v29.x;
m_cameraZoom = a1->m_gameState.m_cameraZoom;
v25 = v28.x;
v26 = v45 - v29.x;
if ( (float)(m_cameraZoom * 180.0) > (float)(v29.x - v28.x) )
{
v27 = (float)((float)(m_cameraZoom * 180.0) - (float)(v29.x - v28.x)) * 0.5;
v25 = v28.x - v27;
v23 = v29.x + v27;
v28.x = v28.x - v27;
v29.x = v29.x + v27;
}
if ( m_cameraZoom != 1.0 )
{
v25 = v25 * (float)(1.0 / m_cameraZoom);
v23 = v23 * (float)(1.0 / m_cameraZoom);
v28.x = v25;
v26 = v26 * (float)(1.0 / m_cameraZoom);
v29.x = v23;
}
GJGroundLayer::updateShadowXPos(a1->m_groundLayer, v25, v23);
GJGroundLayer::updateShadowXPos(a1->m_groundLayer2, v26 + v28.x, v26 + v29.x);
}
}