//
// cocos2d::ccVertexLineToPolygon from 0x5ec264 to 0x5ec4ea (646 bytes)
//
// 2 xrefs:
// > cocos2d::CCMotionStreak::update @ 0x5d6aea
// > cocos2d::CCMotionStreak::update @ 0x5d6c60
//
// 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 cocos2d::ccVertexLineToPolygon(
cocos2d::CCPoint *a1,
float a2,
cocos2d::ccVertex2F *a3,
unsigned int a4,
unsigned int a5)
{
unsigned int v5; // r5
unsigned int v6; // r3
cocos2d::CCPoint *v7; // r9
unsigned int v8; // r8
float v9; // s16
cocos2d::ccVertex2F *v10; // r6
cocos2d::CCPoint *v11; // r1
cocos2d::CCPoint *v12; // r2
float v13; // r0
int v14; // r2
bool v15; // r3
int v16; // r2
bool v17; // r3
float x; // s14
float v19; // s12
float y; // s15
float v21; // s13
cocos2d::ccVertex2F *v22; // r4
float v23; // r10
float v24; // r8
float v25; // r7
float v26; // r6
unsigned int v27; // [sp+1Ch] [bp-78h]
unsigned int v29; // [sp+24h] [bp-70h]
cocos2d::CCPoint *v31; // [sp+2Ch] [bp-68h]
cocos2d::CCPoint v32; // [sp+44h] [bp-50h] BYREF
cocos2d::CCPoint v33; // [sp+4Ch] [bp-48h] BYREF
cocos2d::CCPoint v34; // [sp+54h] [bp-40h] BYREF
cocos2d::CCPoint v35; // [sp+5Ch] [bp-38h] BYREF
cocos2d::CCPoint v36; // [sp+64h] [bp-30h] BYREF
cocos2d::CCPoint v37; // [sp+6Ch] [bp-28h] BYREF
cocos2d::CCPoint v38; // [sp+74h] [bp-20h] BYREF
cocos2d::CCPoint v39; // [sp+7Ch] [bp-18h] BYREF
cocos2d::CCPoint v40; // [sp+84h] [bp-10h] BYREF
v5 = a4;
v6 = a5 + a4;
v27 = v6;
if ( v6 <= 1 )
return;
v29 = v6 - 1;
v7 = &a1[v5];
v8 = v5;
v31 = &a1[v6 - 2];
v9 = a2 * 0.5;
v10 = &a3[2 * v5];
while ( v8 < v27 )
{
cocos2d::CCPoint::CCPoint(&v32, v7);
cocos2d::CCPoint::CCPoint(&v33);
if ( !v8 )
{
v11 = &v32;
v12 = a1 + 1;
LABEL_8:
cocos2d::CCPoint::operator-(&v38, &v11->x, &v12->x);
cocos2d::ccpNormalize(&v39, &v38);
goto LABEL_15;
}
if ( v8 == v29 )
{
v11 = v31;
v12 = &v32;
goto LABEL_8;
}
cocos2d::CCPoint::CCPoint(&v34, v7 + 1);
cocos2d::CCPoint::CCPoint(&v35, v7 - 1);
cocos2d::CCPoint::operator-(&v40, &v34.x, &v32.x);
cocos2d::ccpNormalize(&v36, &v40);
cocos2d::CCPoint::operator-(&v40, &v35.x, &v32.x);
cocos2d::ccpNormalize(&v37, &v40);
v13 = acosf((float)(v36.y * v37.y) + (float)(v36.x * v37.x));
if ( v13 >= 1.2217 )
{
if ( v13 < 2.9671 )
{
cocos2d::CCPoint::operator+(&v40, &v36.x, &v37.x);
cocos2d::CCPoint::operator/(&v39, &v40.x, 2.0);
cocos2d::ccpNormalize(&v40, &v39);
goto LABEL_16;
}
cocos2d::CCPoint::operator-(&v38, &v34.x, &v35.x);
}
else
{
cocos2d::CCPoint::operator+(&v40, &v36.x, &v37.x);
cocos2d::CCPoint::operator/(&v38, &v40.x, 2.0);
}
cocos2d::ccpNormalize(&v39, &v38);
LABEL_15:
cocos2d::CCPoint::CCPoint(&v40, COERCE_FLOAT(LODWORD(v39.y) ^ 0x80000000), v39.x);
LABEL_16:
cocos2d::CCPoint::operator=(&v33, &v40.x, v14, v15);
cocos2d::CCPoint::operator*(&v40, &v33.x, v9);
++v8;
cocos2d::CCPoint::operator=(&v33, &v40.x, v16, v17);
x = v32.x;
v10 += 2;
++v7;
v19 = v33.x;
y = v32.y;
v21 = v33.y;
v10[-2].x = v32.x + v33.x;
v10[-1].x = x - v19;
v10[-2].y = y + v21;
v10[-1].y = y - v21;
}
if ( v5 )
--v5;
v22 = &a3[2 * v5];
while ( v5 < v29 )
{
v23 = v22[3].x;
v24 = v22[3].y;
v25 = v22[2].x;
v26 = v22[2].y;
if ( !cocos2d::ccVertexLineIntersect(v22->x, v22->y, v23, v24, v22[1].x, v22[1].y, v25, v26, &v40.x)
|| v40.x < 0.0
|| v40.x > 1.0 )
{
v22[2].x = v23;
v22[2].y = v24;
v22[3].x = v25;
v22[3].y = v26;
}
++v5;
v22 += 2;
}
}