//
// cocos2d::ccVertexLineToPolygon from 0xb209ec to 0xb20e08 (1052 bytes)
//
// 4 xrefs:
// > cocos2d::CCMotionStreak::update @ 0xaf7700
// > cocos2d::CCMotionStreak::update @ 0xaf7728
// > cocos2d::CCMotionStreak::update @ 0xaf7924
// > ??> @ 0x9f7c8
//
// 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 v6; // w2
float v8; // s8
const cocos2d::CCPoint *v9; // x24
unsigned int v10; // w21
unsigned int v11; // w27
unsigned int v12; // w23
float v13; // s0
float v14; // s1
cocos2d::ccVertex2F *v15; // x3
GLfloat v16; // s0
cocos2d::ccVertex2F *v17; // x2
GLfloat v18; // s3
bool v19; // cc
GLfloat v20; // s1
float v21; // s0
cocos2d::CCPoint *v22; // x1
cocos2d::CCPoint *v23; // x0
float v24; // s0
float v25; // s1
unsigned int v26; // w0
unsigned int i; // w24
unsigned int v28; // w23
__int64 v29; // x20
__int64 v30; // x21
float x; // s9
float y; // s8
float v33; // s12
float v34; // s10
unsigned int v35; // [xsp+A4h] [xbp+A4h]
unsigned int v36; // [xsp+A8h] [xbp+A8h]
unsigned int v39; // [xsp+C0h] [xbp+C0h]
unsigned int v40; // [xsp+C4h] [xbp+C4h]
cocos2d::CCPoint v41; // [xsp+E0h] [xbp+E0h] BYREF
cocos2d::CCPoint v42; // [xsp+E8h] [xbp+E8h] BYREF
cocos2d::CCPoint v43; // [xsp+F0h] [xbp+F0h] BYREF
cocos2d::CCPoint v44; // [xsp+F8h] [xbp+F8h] BYREF
float v45[2]; // [xsp+100h] [xbp+100h] BYREF
float v46[2]; // [xsp+108h] [xbp+108h] BYREF
cocos2d::CCPoint v47; // [xsp+110h] [xbp+110h] BYREF
cocos2d::CCPoint v48; // [xsp+118h] [xbp+118h] BYREF
cocos2d::CCPoint v49; // [xsp+120h] [xbp+120h] BYREF
cocos2d::CCPoint v50; // 0:kr00_8.8
v6 = a5 + a4;
v39 = v6;
if ( v6 <= 1 )
return;
v40 = v6 - 1;
v8 = a2 * 0.5;
if ( a4 >= v6 )
goto LABEL_16;
v35 = 2 * a4;
v9 = &a1[a4];
v10 = a4 + 1;
v36 = a4 + 1;
v11 = 2 * a4;
v12 = a4;
do
{
cocos2d::CCPoint::CCPoint(&v41, v9);
cocos2d::CCPoint::CCPoint(&v42);
if ( v12 )
{
if ( v12 == v40 )
{
v22 = &v41;
v23 = &a1[v39 - 2];
}
else
{
cocos2d::CCPoint::CCPoint(&v43, &v9[a4 + 1 - (unsigned __int64)a4]);
cocos2d::CCPoint::CCPoint(&v44, &a1[v10 - 2]);
cocos2d::CCPoint::operator-((float *)&v43, (float *)&v41, &v49);
cocos2d::ccpNormalize(&v49);
cocos2d::CCPoint::operator-((float *)&v44, (float *)&v41, &v49);
cocos2d::ccpNormalize(&v49);
v21 = acosf((float)(v45[1] * v46[1]) + (float)(v46[0] * v45[0]));
if ( v21 < 1.2217 )
{
cocos2d::CCPoint::operator+(v45, v46, &v49);
cocos2d::CCPoint::operator/((float *)&v49, &v47, 2.0);
goto LABEL_13;
}
if ( v21 < 2.9671 )
{
cocos2d::CCPoint::operator+(v45, v46, &v49);
cocos2d::CCPoint::operator/((float *)&v49, &v48, 2.0);
v50 = cocos2d::ccpNormalize(&v48);
cocos2d::CCPoint::operator=(&v42, v50.x, v50.y, (float *)&v49);
goto LABEL_5;
}
v22 = &v44;
v23 = &v43;
}
}
else
{
v22 = a1 + 1;
v23 = &v41;
}
cocos2d::CCPoint::operator-((float *)v23, (float *)v22, &v47);
LABEL_13:
cocos2d::ccpNormalize(&v47);
cocos2d::CCPoint::CCPoint(&v49, -v48.y, v48.x);
cocos2d::CCPoint::operator=(&v42, v24, v25, (float *)&v49);
LABEL_5:
++v9;
++v12;
cocos2d::CCPoint::operator*((float *)&v42, &v49, v8);
cocos2d::CCPoint::operator=(&v42, v13, v14, (float *)&v49);
v15 = &a3[v11];
v16 = v41.y + v42.y;
v17 = &a3[v11 + 1];
v18 = v41.x - v42.x;
v19 = v39 > v10;
v20 = v41.y - v42.y;
++v10;
v15->x = v41.x + v42.x;
v11 += 2;
v15->y = v16;
v17->x = v18;
v17->y = v20;
}
while ( v19 );
if ( a4 )
{
LABEL_16:
if ( v40 > a4 - 1 )
{
v36 = a4;
v35 = 2 * (a4 - 1);
goto LABEL_18;
}
}
else
{
LABEL_18:
v26 = v35;
for ( i = v36; ; ++i )
{
v28 = v26 + 2;
v29 = v26 + 3;
v30 = v26 + 2;
x = a3[v30].x;
y = a3[v30].y;
v33 = a3[v29].x;
v34 = a3[v29].y;
if ( !cocos2d::ccVertexLineIntersect(
a3[v26].x,
a3[v26].y,
v33,
v34,
a3[v26 + 1].x,
a3[v26 + 1].y,
x,
y,
(float *)&v49)
|| v49.x < 0.0
|| v49.x > 1.0 )
{
a3[v30].x = v33;
a3[v30].y = v34;
a3[v29].x = x;
a3[v29].y = y;
}
v26 = v28;
if ( v40 == i )
break;
}
}
}