//
// cocos2d::CCMotionStreak::update from 0x5d6844 to 0x5d6c7c (1080 bytes)
//
// 0 xrefs:
//
// 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::CCMotionStreak::update(cocos2d::CCMotionStreak *a1, float a2)
{
int v2; // r2
unsigned int v4; // r6
int v5; // r9
unsigned int v6; // r8
float v7; // s16
unsigned int m_uNuPoints; // r1
float *m_pPointState; // r3
float v10; // s15
unsigned int v11; // r10
float *v12; // r3
cocos2d::CCPoint *m_pPointVertexes; // r1
int v14; // r5
cocos2d::ccVertex2F *m_pVertices; // r3
int *v16; // r1
_DWORD *p_x; // r2
int *v18; // r3
int v19; // r0
int v20; // r1
int v21; // r0
int v22; // r1
GLubyte *m_pColorPointer; // r3
GLubyte v24; // r3
unsigned int m_uMaxPoints; // r3
unsigned int v26; // r1
unsigned int v27; // r3
float m_fMinSeg; // s17
float v29; // s16
bool v30; // fnf
unsigned int v31; // r3
unsigned int v32; // r2
GLubyte *v33; // r0
int v34; // r3
GLubyte *v35; // r2
unsigned int v36; // r3
unsigned int m_bRepeatMode; // r3
unsigned int v38; // r0
unsigned int v39; // r2
unsigned int v40; // s15
cocos2d::ccTex2F *v41; // r3
int v42; // r1
cocos2d::ccTex2F *v43; // r5
cocos2d::ccTex2F *v44; // r3
float v45; // s15
float m_fRepeatSpeed; // s14
GLfloat v47; // s15
unsigned int v48; // s15
cocos2d::ccTex2F *m_pTexCoords; // r2
int v50; // r1
cocos2d::ccTex2F *v51; // r5
float *p_u; // r2
GLfloat v53; // s15
unsigned int i; // r8
unsigned int v55; // r3
float *v56; // r3
cocos2d::CCPoint *v57; // r0
_BOOL4 m_bFastMode; // r2
bool v59; // cc
unsigned int v60; // [sp+0h] [bp-30h]
cocos2d::CCPoint v61; // [sp+14h] [bp-1Ch] BYREF
cocos2d::CCPoint v62; // [sp+1Ch] [bp-14h] BYREF
cocos2d::CCPoint v63; // [sp+24h] [bp-Ch] BYREF
if ( !a1->m_bStartingPositionInitialized )
return;
v4 = 0;
v5 = 4;
v6 = 0;
v7 = a2 * a1->m_fFadeDelta;
while ( 1 )
{
m_uNuPoints = a1->m_uNuPoints;
if ( v6 >= m_uNuPoints )
break;
m_pPointState = a1->m_pPointState;
v2 = (int)&m_pPointState[v6];
v10 = *(float *)v2 - v7;
*(float *)v2 = v10;
if ( v10 > 0.0 )
{
v11 = v6 - v4;
if ( v4 )
{
v12 = &m_pPointState[v11];
m_pPointVertexes = a1->m_pPointVertexes;
v14 = 8 * v11;
*v12 = v10;
cocos2d::CCPoint::operator=(&m_pPointVertexes[v11], &m_pPointVertexes[v6].x, v2, (bool)v12);
m_pVertices = a1->m_pVertices;
v16 = (int *)&m_pVertices[2 * v6];
p_x = (_DWORD *)&m_pVertices[2 * v11].x;
v18 = (int *)&m_pVertices[v5 / 4u];
v19 = *v16;
v20 = v16[1];
*p_x = v19;
p_x[1] = v20;
p_x += 2;
v21 = *v18;
v22 = v18[1];
m_pColorPointer = a1->m_pColorPointer;
*p_x = v21;
p_x[1] = v22;
m_pColorPointer[8 * v11] = m_pColorPointer[8 * v6];
a1->m_pColorPointer[v14 + 1] = a1->m_pColorPointer[v5 - 3];
a1->m_pColorPointer[v14 + 2] = a1->m_pColorPointer[v5 - 2];
a1->m_pColorPointer[v14 + 4] = a1->m_pColorPointer[v5];
a1->m_pColorPointer[v14 + 5] = a1->m_pColorPointer[v5 + 1];
a1->m_pColorPointer[v14 + 6] = a1->m_pColorPointer[v5 + 2];
}
else
{
v14 = 8 * v11;
}
if ( a1->m_bDontOpacityFade )
v24 = -1;
else
v24 = (unsigned int)(float)(a1->m_pPointState[v11] * 255.0);
a1->m_pColorPointer[v14 + 3] = v24;
v2 = (int)a1->m_pColorPointer;
*(_BYTE *)(v14 + v2 + 7) = v24;
}
else
{
++v4;
}
++v6;
v5 += 8;
}
m_uMaxPoints = a1->m_uMaxPoints;
v26 = m_uNuPoints - v4;
a1->m_uNuPoints = v26;
if ( v26 < m_uMaxPoints && a1->m_bStroke )
{
if ( !v26 )
goto LABEL_22;
cocos2d::CCPoint::CCPoint(&v61, &a1->m_pPointVertexes[v26 - 1]);
cocos2d::CCPoint::CCPoint(&v62, &a1->m_tPositionR);
cocos2d::CCPoint::operator-(&v63, &v61.x, &v62.x);
v27 = a1->m_uNuPoints;
m_fMinSeg = a1->m_fMinSeg;
v29 = (float)(v63.y * v63.y) + (float)(v63.x * v63.x);
if ( v27 == 1 )
{
v30 = v29 < m_fMinSeg;
}
else
{
cocos2d::CCPoint::CCPoint(&v61, &a1->m_pPointVertexes[v27 - 2]);
cocos2d::CCPoint::CCPoint(&v62, &a1->m_tPositionR);
cocos2d::CCPoint::operator-(&v63, &v61.x, &v62.x);
if ( v29 < m_fMinSeg )
goto LABEL_26;
v30 = (float)((float)(v63.y * v63.y) + (float)(v63.x * v63.x)) < (float)(a1->m_fMinSeg + a1->m_fMinSeg);
}
if ( !v30 )
{
LABEL_22:
v31 = a1->m_uNuPoints;
if ( v31
&& a1->m_fMaxSeg != 0.0
&& cocos2d::ccpDistance(&a1->m_pPointVertexes[v31 - 1], &a1->m_tPositionR) > a1->m_fMaxSeg )
{
for ( i = 0; ; ++i )
{
v55 = a1->m_uNuPoints;
if ( i >= v55 )
break;
cocos2d::CCPoint::operator=(&a1->m_pPointVertexes[i], &a1->m_tPositionR.x, v2, v55);
v56 = &a1->m_pPointState[i];
*v56 = 0.0;
}
v57 = a1->m_pPointVertexes;
a1->m_uNuPoints = 1;
cocos2d::CCPoint::operator=(v57, &a1->m_tPositionR.x, v2, 1);
v2 = 1065353216;
*a1->m_pPointState = 1.0;
}
cocos2d::CCPoint::operator=(
&a1->m_pPointVertexes[a1->m_uNuPoints],
&a1->m_tPositionR.x,
v2,
(bool)a1->m_pPointVertexes);
v32 = a1->m_uNuPoints;
v33 = a1->m_pColorPointer;
a1->m_pPointState[v32] = 1.0;
v34 = 8 * v32;
*(_WORD *)&v33[8 * v32] = *(_WORD *)&a1->_displayedColor.r;
v33[8 * v32 + 2] = a1->_displayedColor.b;
v35 = &a1->m_pColorPointer[8 * v32];
*((_WORD *)v35 + 2) = *(_WORD *)&a1->_displayedColor.r;
v35[6] = a1->_displayedColor.b;
a1->m_pColorPointer[v34 + 3] = -1;
a1->m_pColorPointer[v34 + 7] = -1;
v36 = a1->m_uNuPoints;
if ( v36 )
{
m_bFastMode = a1->m_bFastMode;
if ( a1->m_bFastMode )
{
v59 = v36 > 1;
if ( v36 <= 1 )
v36 = 2;
else
m_bFastMode = 1;
if ( v59 )
{
v60 = m_bFastMode;
}
else
{
v60 = v36;
v36 = 0;
}
cocos2d::ccVertexLineToPolygon(a1->m_pPointVertexes, a1->m_fStroke, a1->m_pVertices, v36, v60);
}
}
++a1->m_uNuPoints;
}
}
LABEL_26:
if ( !a1->m_bFastMode )
cocos2d::ccVertexLineToPolygon(
a1->m_pPointVertexes,
a1->m_fStroke,
a1->m_pVertices,
a1->m_bFastMode,
a1->m_uNuPoints);
m_bRepeatMode = a1->m_bRepeatMode;
if ( a1->m_bRepeatMode && v4 )
a1->m_fRepeatTime = a1->m_fRepeatTime + (float)v4;
v38 = a1->m_uNuPoints;
v39 = 0;
a1->m_idk = 0;
if ( v38 )
{
if ( a1->m_uPreviousNuPoints == v38 )
{
if ( !m_bRepeatMode )
return;
}
else if ( !m_bRepeatMode )
{
do
{
v48 = m_bRepeatMode;
m_pTexCoords = a1->m_pTexCoords;
v50 = 2 * m_bRepeatMode++;
v51 = &m_pTexCoords[v50];
p_u = &m_pTexCoords[v50 + 1].u;
v51->u = 0.0;
v53 = (float)(1.0 / (float)v38) * (float)v48;
v51->v = v53;
*p_u = 1.0;
p_u[1] = v53;
}
while ( m_bRepeatMode != v38 );
goto LABEL_37;
}
do
{
v40 = v39;
v41 = a1->m_pTexCoords;
v42 = 2 * v39;
v43 = &v41[2 * v39++];
v44 = &v41[v42 + 1];
v45 = (float)v40 + a1->m_fRepeatTime;
m_fRepeatSpeed = a1->m_fRepeatSpeed;
v43->u = 0.0;
v47 = v45 * m_fRepeatSpeed;
v43->v = v47;
v44->u = 1.0;
v44->v = v47;
}
while ( v39 != v38 );
LABEL_37:
a1->m_uPreviousNuPoints = v38;
}
}