//
// PlayerObject::setupStreak from 0x1003fc810 to 0x1003fcb6e (862 bytes)
//
// 1 xrefs:
// > PlayerObject::init @ 0x1003fb84f
//
// 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; // rax
GameManager *v3; // rax
int v4; // ecx
GameManager *v5; // rax
GameManager *v6; // rax
cocos2d::CCString *v7; // rax
const char *CString; // rax
float v9; // xmm0_4
float v10; // xmm2_4
cocos2d::CCMotionStreak *m_regularTrail; // rax
GameManager *v12; // rax
int v13; // ecx
ShipStreak v14; // eax
unsigned int v15; // ecx
float v16; // xmm0_4
float v17; // xmm1_4
cocos2d::CCTextureCache *v18; // r15
const char *v19; // rsi
cocos2d::CCTexture2D *v20; // rax
cocos2d::CCMotionStreak *m_shipStreak; // rax
cocos2d::CCMotionStreak *v22; // rdi
HardStreak *v23; // rax
GameManager *v24; // rax
char v25; // [rsp+0h] [rbp-40h]
cocos2d::ccBlendFunc v26; // [rsp+8h] [rbp-38h] BYREF
void *__p; // [rsp+18h] [rbp-28h]
float v28; // [rsp+20h] [rbp-20h]
float v29; // [rsp+24h] [rbp-1Ch]
v2 = GameManager::sharedState();
if ( v2->m_playerStreak.random - v2->m_playerStreak.seed > 7
|| (v3 = GameManager::sharedState(), v4 = 1, v3->m_playerStreak.random > v3->m_playerStreak.seed) )
{
v5 = GameManager::sharedState();
v4 = 7;
if ( v5->m_playerStreak.random - v5->m_playerStreak.seed <= 7 )
{
v6 = GameManager::sharedState();
v4 = v6->m_playerStreak.random - v6->m_playerStreak.seed;
}
}
a1->m_playerStreak = v4;
a1->m_hasGlow = GameManager::sharedState()->m_playerGlow;
v7 = (cocos2d::CCString *)sub_1007AB580("streak_%02d_001.png", v25);
CString = cocos2d::CCString::getCString(v7);
a1->m_streakStrokeWidth = 10.0;
v9 = 0.30000001;
v10 = 10.0;
switch ( a1->m_playerStreak )
{
case 2:
case 7:
a1->m_streakStrokeWidth = 14.0;
a1->m_disableStreakTint = 1;
v10 = 14.0;
break;
case 3:
a1->m_streakStrokeWidth = 8.5;
v10 = 8.5;
break;
case 4:
v9 = 0.40000001;
break;
case 5:
a1->m_streakStrokeWidth = 5.0;
a1->m_alwaysShowStreak = 1;
v9 = 0.60000002;
v10 = 5.0;
break;
case 6:
a1->m_alwaysShowStreak = 1;
a1->m_streakStrokeWidth = 3.0;
v9 = 1.0;
v10 = 3.0;
break;
default:
break;
}
m_regularTrail = cocos2d::CCMotionStreak::create_1(v9, 5.0, v10, &stru_10081B860, CString);
a1->m_regularTrail = m_regularTrail;
if ( a1->m_playerStreak == 6 )
{
cocos2d::CCMotionStreak::enableRepeatMode(m_regularTrail, 0.1);
m_regularTrail = a1->m_regularTrail;
}
m_regularTrail->m_fMaxSeg = 50.0;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMotionStreak *, __int64))a1->m_parentLayer->addChild_0)(
a1->m_parentLayer,
m_regularTrail,
4294967294LL);
v12 = GameManager::sharedState();
v13 = v12->m_playerShipFire.random - v12->m_playerShipFire.seed;
v14 = ShipFire1;
if ( v13 < 7 )
v14 = v13;
a1->m_shipStreakType = v14;
if ( v14 >= ShipFire2 )
{
v15 = v13 - 2;
v16 = 0.0;
v17 = 0.0;
if ( v15 <= 4 )
{
v16 = flt_10081B8B0[v15];
v17 = flt_10081B8C4[v15];
}
v29 = v17;
v28 = v16;
v18 = cocos2d::CCTextureCache::sharedTextureCache();
sub_1003F9BF0((size_t *)&v26, a1->m_shipStreakType, (__m128)0LL);
if ( (v26.src & 1) != 0 )
v19 = (const char *)__p;
else
v19 = (char *)&v26 + 1;
v20 = cocos2d::CCTextureCache::addImage(v18, v19, 0);
m_shipStreak = cocos2d::CCMotionStreak::create(v28, 1.0, v29, &stru_10081B860, v20);
a1->m_shipStreak = m_shipStreak;
if ( (v26.src & 1) != 0 )
{
operator delete(__p);
m_shipStreak = a1->m_shipStreak;
}
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMotionStreak *, __int64))a1->m_parentLayer->addChild_0)(
a1->m_parentLayer,
m_shipStreak,
4294967293LL);
v22 = a1->m_shipStreak;
v22->m_fMaxSeg = 50.0;
v22->m_bDontOpacityFade = 1;
((void (__fastcall *)(cocos2d::CCMotionStreak *, __int64))v22->setBlendFunc)(v22, 0x100000302LL);
}
v26 = (cocos2d::ccBlendFunc)0x100000302LL;
((void (__fastcall *)(cocos2d::CCMotionStreak *, __int64))a1->m_regularTrail->setBlendFunc)(
a1->m_regularTrail,
0x100000302LL);
v23 = HardStreak::create();
a1->m_waveTrail = v23;
((void (__fastcall *)(cocos2d::CCLayer *, HardStreak *, __int64))a1->m_parentLayer->addChild_0)(
a1->m_parentLayer,
v23,
4294967293LL);
v24 = GameManager::sharedState();
if ( v24->m_playerColor.random - v24->m_playerColor.seed == 15 && !a1->m_switchWaveTrailColor )
a1->m_waveTrail->m_isSolid = 1;
else
cocos2d::CCDrawNode::setBlendFunc(a1->m_waveTrail, &v26);
PlayerObject::deactivateStreak(a1, 1);
}