//
// cocos2d::CCMotionStreak::update from 0x100177020 to 0x1001774f8 (1240 bytes)
//
// 1 xrefs:
// > ??> @ 0x10079ff98
//
// 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 __fastcall cocos2d::CCMotionStreak::update(cocos2d::CCMotionStreak *a1, float a2)
{
float32x2_t v2; // x29
float32x2_t v3; // x30
float32x2_t v4; // d8
float32x2_t v5; // d9
unsigned int m_uNuPoints; // w8
unsigned __int64 v8; // x21
unsigned __int64 v9; // x22
unsigned int v10; // w20
float v11; // s8
int v12; // w23
float *m_pPointState; // x9
float v14; // s0
int v15; // w25
unsigned int v16; // w9
int v17; // w9
int v18; // w8
int v19; // w9
unsigned int v20; // w9
float v21; // s8
float m_fMinSeg; // s9
unsigned int v23; // w8
bool v24; // w8
float v25; // s0
__int64 v26; // x21
unsigned __int64 v27; // x22
__int64 v28; // x9
__int64 v29; // x8
GLubyte *v30; // x9
__int16 v31; // w10
GLubyte *v32; // x9
unsigned int v33; // w2
unsigned int v34; // w3
_BOOL4 m_bRepeatMode; // w10
__int64 v36; // x8
cocos2d::ccTex2F *m_pTexCoords; // x9
__int64 v38; // x10
unsigned int v39; // w11
GLfloat v40; // s0
cocos2d::ccTex2F *v41; // x13
cocos2d::ccTex2F *v42; // x13
__int64 v43; // x10
unsigned int v44; // w11
GLfloat v45; // s1
cocos2d::ccTex2F *v46; // x13
cocos2d::ccTex2F *v47; // x13
float32x2_t v48; // [xsp+8h] [xbp-78h] BYREF
float32x2_t v49; // [xsp+10h] [xbp-70h] BYREF
float32x2_t v50[13]; // [xsp+18h] [xbp-68h] BYREF
if ( !a1->m_bStartingPositionInitialized )
return;
v50[1] = v5;
v50[2] = v4;
v50[11] = v2;
v50[12] = v3;
m_uNuPoints = a1->m_uNuPoints;
if ( m_uNuPoints )
{
v8 = 0;
v9 = 0;
v10 = 0;
v11 = a1->m_fFadeDelta * a2;
v12 = 1;
do
{
m_pPointState = a1->m_pPointState;
v14 = m_pPointState[v9] - v11;
m_pPointState[v9] = v14;
if ( v14 <= 0.0 )
{
++v10;
}
else
{
v15 = v9 - v10;
if ( v10 )
{
m_pPointState[v15] = v14;
sub_1000229D0(&a1->m_pPointVertexes[v15], (double *)&a1->m_pPointVertexes[v8 / 8]);
v16 = v12 - 2 * v10;
a1->m_pVertices[v16 - 1] = a1->m_pVertices[v12 - 1];
a1->m_pVertices[v16] = a1->m_pVertices[v12];
v17 = v8 - 8 * v10;
a1->m_pColorPointer[v17] = a1->m_pColorPointer[(unsigned int)v8];
a1->m_pColorPointer[v17 + 1] = a1->m_pColorPointer[(unsigned int)(v8 + 1)];
a1->m_pColorPointer[v17 + 2] = a1->m_pColorPointer[(unsigned int)(v8 + 2)];
v18 = 8 * (v9 - v10);
a1->m_pColorPointer[v17 + 4] = a1->m_pColorPointer[(unsigned int)(v8 + 4)];
a1->m_pColorPointer[v17 + 5] = a1->m_pColorPointer[(unsigned int)(v8 + 5)];
a1->m_pColorPointer[v17 + 6] = a1->m_pColorPointer[(unsigned int)(v8 + 6)];
}
else
{
v18 = v8;
}
if ( a1->m_bDontOpacityFade )
LOBYTE(v19) = -1;
else
v19 = (int)(float)(a1->m_pPointState[v15] * 255.0);
a1->m_pColorPointer[v18 + 3] = v19;
a1->m_pColorPointer[v18 + 7] = v19;
m_uNuPoints = a1->m_uNuPoints;
}
++v9;
v8 += 8LL;
v12 += 2;
}
while ( v9 < m_uNuPoints );
}
else
{
v10 = 0;
}
v20 = m_uNuPoints - v10;
a1->m_uNuPoints = m_uNuPoints - v10;
if ( m_uNuPoints - v10 < a1->m_uMaxPoints && a1->m_bStroke )
{
if ( m_uNuPoints == v10 )
goto LABEL_25;
sub_1000229B8((__int64 *)&v49, (__int64 *)&a1->m_pPointVertexes[v20 - 1]);
sub_1000229B8((__int64 *)&v48, (__int64 *)&a1->m_tPositionR);
sub_1000229F0(&v49, &v48, v50);
v21 = (float)(v50[0].f32[1] * v50[0].f32[1]) + (float)(v50[0].f32[0] * v50[0].f32[0]);
m_fMinSeg = a1->m_fMinSeg;
v23 = a1->m_uNuPoints;
if ( v23 == 1 )
{
v24 = 0;
}
else
{
sub_1000229B8((__int64 *)&v49, (__int64 *)&a1->m_pPointVertexes[v23 - 2]);
sub_1000229B8((__int64 *)&v48, (__int64 *)&a1->m_tPositionR);
sub_1000229F0(&v49, &v48, v50);
v24 = (float)((float)(v50[0].f32[1] * v50[0].f32[1]) + (float)(v50[0].f32[0] * v50[0].f32[0])) < (float)(a1->m_fMinSeg + a1->m_fMinSeg);
}
if ( v21 >= m_fMinSeg && !v24 )
{
v20 = a1->m_uNuPoints;
LABEL_25:
if ( v20 )
{
if ( a1->m_fMaxSeg != 0.0 )
{
v25 = cocos2d::ccpDistance(&a1->m_pPointVertexes[v20 - 1], &a1->m_tPositionR);
v20 = a1->m_uNuPoints;
if ( v25 > a1->m_fMaxSeg )
{
if ( v20 )
{
v26 = 0;
v27 = 0;
do
{
sub_1000229D0(&a1->m_pPointVertexes[v26], (double *)&a1->m_tPositionR);
a1->m_pPointState[v27++] = 0.0;
++v26;
}
while ( v27 < a1->m_uNuPoints );
}
a1->m_uNuPoints = 1;
sub_1000229D0(a1->m_pPointVertexes, (double *)&a1->m_tPositionR);
*a1->m_pPointState = 1.0;
v20 = a1->m_uNuPoints;
}
}
}
sub_1000229D0(&a1->m_pPointVertexes[v20], (double *)&a1->m_tPositionR);
v28 = a1->m_uNuPoints;
a1->m_pPointState[v28] = 1.0;
v29 = (unsigned int)(8 * v28);
v30 = &a1->m_pColorPointer[v29];
v31 = *(_WORD *)&a1->_displayedColor.r;
v30[2] = a1->_displayedColor.b;
*(_WORD *)v30 = v31;
v32 = &a1->m_pColorPointer[v29];
LOBYTE(v31) = a1->_displayedColor.b;
*((_WORD *)v32 + 2) = *(_WORD *)&a1->_displayedColor.r;
v32[6] = v31;
a1->m_pColorPointer[v29 + 3] = -1;
a1->m_pColorPointer[v29 + 7] = -1;
v33 = a1->m_uNuPoints;
if ( v33 && a1->m_bFastMode )
{
if ( v33 == 1 )
{
v33 = 0;
v34 = 2;
}
else
{
v34 = 1;
}
cocos2d::ccVertexLineToPolygon(a1->m_pPointVertexes, a1->m_fStroke, a1->m_pVertices, v33, v34);
}
++a1->m_uNuPoints;
}
}
if ( !a1->m_bFastMode )
cocos2d::ccVertexLineToPolygon(a1->m_pPointVertexes, a1->m_fStroke, a1->m_pVertices, 0, a1->m_uNuPoints);
m_bRepeatMode = a1->m_bRepeatMode;
if ( v10 && a1->m_bRepeatMode )
a1->m_fRepeatTime = a1->m_fRepeatTime + (float)v10;
a1->m_idk = 0;
v36 = a1->m_uNuPoints;
if ( (_DWORD)v36 && (a1->m_uPreviousNuPoints != (_DWORD)v36 || m_bRepeatMode) )
{
m_pTexCoords = a1->m_pTexCoords;
if ( m_bRepeatMode )
{
v38 = 0;
v39 = 1;
do
{
v40 = a1->m_fRepeatSpeed * (float)(a1->m_fRepeatTime + (float)(unsigned int)v38);
v41 = &m_pTexCoords[v39 - 1];
v41->u = 0.0;
v41->v = v40;
v42 = &m_pTexCoords[v39];
v42->u = 1.0;
v42->v = v40;
++v38;
v39 += 2;
}
while ( v36 != v38 );
}
else
{
v43 = 0;
v44 = 1;
do
{
v45 = (float)(1.0 / (float)(unsigned int)v36) * (float)(unsigned int)v43;
v46 = &m_pTexCoords[v44 - 1];
v46->u = 0.0;
v46->v = v45;
v47 = &m_pTexCoords[v44];
v47->u = 1.0;
v47->v = v45;
++v43;
v44 += 2;
}
while ( v36 != v43 );
}
a1->m_uPreviousNuPoints = v36;
}
}