//
// PlayerObject::setupStreak from 0x1002190ac to 0x100219408 (860 bytes)
//
// 1 xrefs:
// > PlayerObject::init @ 0x10021844c
//
// 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 PlayerObject::setupStreak(PlayerObject *a1)
{
GameManager *v2; // x0
GameManager *v3; // x0
GameManager *v4; // x0
int v5; // w8
GameManager *v6; // x0
cocos2d::CCString *v7; // x0
const char *CString; // x1
int m_playerStreak; // w8
float v10; // s2
float v11; // s0
cocos2d::CCMotionStreak *v12; // x0
cocos2d::CCMotionStreak *m_regularTrail; // x1
GameManager *v14; // x0
int v15; // w8
ShipStreak v16; // w9
unsigned int v17; // w8
float v18; // s8
float v19; // s9
cocos2d::CCTextureCache *v20; // x20
void **v21; // x1
cocos2d::CCTexture2D *v22; // x0
cocos2d::CCMotionStreak *m_shipStreak; // x0
HardStreak *v24; // x0
GameManager *v25; // x0
void *__p[2]; // [xsp+8h] [xbp-48h] BYREF
char v27; // [xsp+1Fh] [xbp-31h]
v2 = GameManager::sharedState();
if ( v2->m_playerStreak.random - v2->m_playerStreak.seed <= 7
&& (v3 = GameManager::sharedState(), v3->m_playerStreak.random <= v3->m_playerStreak.seed) )
{
v5 = 1;
}
else
{
v4 = GameManager::sharedState();
if ( v4->m_playerStreak.random - v4->m_playerStreak.seed <= 7 )
{
v6 = GameManager::sharedState();
v5 = v6->m_playerStreak.random - v6->m_playerStreak.seed;
}
else
{
v5 = 7;
}
}
a1->m_playerStreak = v5;
a1->m_hasGlow = GameManager::sharedState()->m_playerGlow;
v7 = (cocos2d::CCString *)sub_100268F4C("streak_%02d_001.png", a1->m_playerStreak);
CString = cocos2d::CCString::getCString(v7);
a1->m_streakStrokeWidth = 10.0;
m_playerStreak = a1->m_playerStreak;
v10 = 10.0;
v11 = 0.3;
if ( m_playerStreak > 4 )
{
if ( m_playerStreak == 5 )
{
a1->m_streakStrokeWidth = 5.0;
a1->m_alwaysShowStreak = 1;
v10 = 5.0;
v11 = 0.6;
goto LABEL_19;
}
if ( m_playerStreak == 6 )
{
a1->m_alwaysShowStreak = 1;
a1->m_streakStrokeWidth = 3.0;
v11 = 1.0;
v10 = 3.0;
goto LABEL_19;
}
if ( m_playerStreak != 7 )
goto LABEL_19;
LABEL_15:
a1->m_streakStrokeWidth = 14.0;
a1->m_disableStreakTint = 1;
v10 = 14.0;
goto LABEL_19;
}
switch ( m_playerStreak )
{
case 2:
goto LABEL_15;
case 3:
a1->m_streakStrokeWidth = 8.5;
v10 = 8.5;
break;
case 4:
v11 = 0.4;
break;
}
LABEL_19:
v12 = cocos2d::CCMotionStreak::create_1(v11, 5.0, v10, &stru_10063A900, CString);
m_regularTrail = v12;
a1->m_regularTrail = v12;
if ( a1->m_playerStreak == 6 )
{
cocos2d::CCMotionStreak::enableRepeatMode(v12, 0.1);
m_regularTrail = a1->m_regularTrail;
}
m_regularTrail->m_fMaxSeg = 50.0;
((void (__fastcall *)(cocos2d::CCLayer *))a1->m_parentLayer->addChild_0)(a1->m_parentLayer);
v14 = GameManager::sharedState();
v15 = v14->m_playerShipFire.random - v14->m_playerShipFire.seed;
if ( v15 > 6 )
v16 = ShipFire1;
else
v16 = v14->m_playerShipFire.random - v14->m_playerShipFire.seed;
a1->m_shipStreakType = v16;
if ( v16 >= ShipFire2 )
{
v17 = v15 - 2;
v18 = 0.0;
v19 = 0.0;
if ( v17 <= 4 )
{
v18 = flt_10063A948[v17];
v19 = flt_10063A95C[v17];
}
v20 = cocos2d::CCTextureCache::sharedTextureCache();
sub_10021717C((unsigned int)a1->m_shipStreakType, __p, 0.0);
if ( v27 >= 0 )
v21 = __p;
else
v21 = (void **)__p[0];
v22 = cocos2d::CCTextureCache::addImage(v20, (const char *)v21, 0);
a1->m_shipStreak = cocos2d::CCMotionStreak::create(v18, 1.0, v19, &stru_10063A900, v22);
if ( v27 < 0 )
operator delete(__p[0]);
((void (__fastcall *)(cocos2d::CCLayer *))a1->m_parentLayer->addChild_0)(a1->m_parentLayer);
m_shipStreak = a1->m_shipStreak;
m_shipStreak->m_fMaxSeg = 50.0;
m_shipStreak->m_bDontOpacityFade = 1;
((void (__fastcall *)(cocos2d::CCMotionStreak *, __int64))m_shipStreak->setBlendFunc)(m_shipStreak, 0x100000302LL);
}
__p[0] = &stru_1000002E0 + 34;
((void (__fastcall *)(cocos2d::CCMotionStreak *, __int64))a1->m_regularTrail->setBlendFunc)(
a1->m_regularTrail,
0x100000302LL);
v24 = HardStreak::create();
a1->m_waveTrail = v24;
((void (__fastcall *)(cocos2d::CCLayer *, HardStreak *, __int64))a1->m_parentLayer->addChild_0)(
a1->m_parentLayer,
v24,
4294967293LL);
v25 = GameManager::sharedState();
if ( v25->m_playerColor.random - v25->m_playerColor.seed == 15 && !a1->m_switchWaveTrailColor )
a1->m_waveTrail->m_isSolid = 1;
else
cocos2d::CCDrawNode::setBlendFunc(a1->m_waveTrail, (const cocos2d::ccBlendFunc *)__p);
PlayerObject::deactivateStreak(a1, 1);
}