//
// PlayerObject::setupStreak from 0x766c2c to 0x766fd4 (936 bytes)
//
// 2 xrefs:
// > PlayerObject::init @ 0x767d74
// > ??> @ 0x9f880
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:53:07 +0000
//
__int64 __fastcall PlayerObject::setupStreak(PlayerObject *this)
{
__int64 v2; // x0
unsigned __int64 v3; // x0
__int64 v4; // x0
__int64 v5; // x0
GameManager *v6; // x0
unsigned __int64 v7; // x0
__int64 v8; // x0
const char *v9; // x1
cocos2d::CCString *v10; // x0
__int64 CString; // x1
int v12; // w0
long double v13; // q0
cocos2d::CCMotionStreak *v14; // x0
cocos2d::CCMotionStreak *v15; // x1
GameManager *v16; // x0
__int64 v17; // x0
int v18; // w0
__int64 v19; // x1
HardStreak *v20; // x0
__int64 v21; // x0
GameManager *v22; // x0
__int64 v23; // x0
float v25; // s10
float v26; // s9
cocos2d::CCTextureCache *v27; // x0
cocos2d::CCTextureCache *v28; // x24
const char *v29; // x1
__int64 v30; // x0
__int64 v31; // x0
char v32; // w1
__int64 v33; // x0
float v34; // [xsp+64h] [xbp+64h] BYREF
__int64 v35; // [xsp+68h] [xbp+68h] BYREF
__int64 v36[2]; // [xsp+70h] [xbp+70h] BYREF
void *v37; // [xsp+80h] [xbp+80h]
v2 = GameManager::sharedState(_stack_chk_guard);
v3 = (unsigned int)(*(_DWORD *)(v2 + 848) - *(_DWORD *)(v2 + 852));
if ( (int)v3 <= 7
&& (v4 = GameManager::sharedState((GameManager *)v3),
v3 = (unsigned int)(*(_DWORD *)(v4 + 848) - *(_DWORD *)(v4 + 852)),
(int)v3 <= 0) )
{
v7 = 1;
}
else
{
v5 = GameManager::sharedState((GameManager *)v3);
v6 = (GameManager *)(unsigned int)(*(_DWORD *)(v5 + 848) - *(_DWORD *)(v5 + 852));
if ( (int)v6 <= 7 )
{
v33 = GameManager::sharedState(v6);
v7 = (unsigned int)(*(_DWORD *)(v33 + 848) - *(_DWORD *)(v33 + 852));
}
else
{
v7 = (unsigned __int64)&byte_7;
}
}
*((_DWORD *)this + 566) = v7;
v8 = GameManager::sharedState((GameManager *)v7);
v9 = (const char *)*((unsigned int *)this + 566);
*((_BYTE *)this + 1786) = *(_BYTE *)(v8 + 912);
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"streak_%02d_001.png", v9);
CString = cocos2d::CCString::getCString(v10);
v12 = *((_DWORD *)this + 566) - 2;
*((float *)this + 567) = 10.0;
LODWORD(v13) = 1050253722;
switch ( v12 )
{
case 0:
case 5:
LODWORD(v13) = 1050253722;
*((_BYTE *)this + 2272) = 1;
*((float *)this + 567) = 14.0;
break;
case 1:
LODWORD(v13) = 1050253722;
*((float *)this + 567) = 8.5;
break;
case 2:
LODWORD(v13) = 1053609165;
break;
case 3:
LODWORD(v13) = 1058642330;
*((_BYTE *)this + 2273) = 1;
*((float *)this + 567) = 5.0;
break;
case 4:
LODWORD(v13) = 1.0;
*((_BYTE *)this + 2273) = 1;
*((float *)this + 567) = 3.0;
break;
default:
break;
}
v14 = (cocos2d::CCMotionStreak *)cocos2d::CCMotionStreak::create(&qword_113CF98, CString, v13, 5.0);
*((_QWORD *)this + 238) = v14;
v15 = v14;
if ( *((_DWORD *)this + 566) == 6 )
{
cocos2d::CCMotionStreak::enableRepeatMode(v14, 0.1);
v15 = *((cocos2d::CCMotionStreak **)this + 238);
}
*((_DWORD *)v15 + 116) = 1112014848;
v16 = (GameManager *)(*(__int64 (__fastcall **)(_QWORD, _QWORD, __int64))(**((_QWORD **)this + 378) + 464LL))(
*((_QWORD *)this + 378),
*((_QWORD *)this + 238),
4294967294LL);
v17 = GameManager::sharedState(v16);
v18 = *(_DWORD *)(v17 + 860) - *(_DWORD *)(v17 + 864);
*((_DWORD *)this + 569) = v18;
if ( v18 <= 6 )
{
if ( v18 > 1 )
{
v34 = 0.0;
LODWORD(v35) = 0;
getSettingsForStreak(v18, &v34, (float *)&v35, 1.6, 1.0);
v25 = v34;
v26 = *(float *)&v35;
v28 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache(v27);
getFrameForStreak(*((_DWORD *)this + 569), v36, 0.0);
v29 = (char *)v36 + 1;
if ( (v36[0] & 1) != 0 )
v29 = (const char *)v37;
v30 = cocos2d::CCTextureCache::addImage(v28, v29, 0);
v31 = cocos2d::CCMotionStreak::create(&qword_113CF98, v30, v25, 1.0, v26);
v32 = v36[0];
*((_QWORD *)this + 239) = v31;
if ( (v32 & 1) != 0 )
{
operator delete(v37);
v31 = *((_QWORD *)this + 239);
}
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 378) + 464LL))(
*((_QWORD *)this + 378),
v31,
4294967293LL);
*(_DWORD *)(*((_QWORD *)this + 239) + 464LL) = 1112014848;
*(_BYTE *)(*((_QWORD *)this + 239) + 468LL) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 239) + 1024LL))(
*((_QWORD *)this + 239),
0x100000302LL);
}
}
else
{
*((_DWORD *)this + 569) = 1;
}
v19 = *((_QWORD *)this + 238);
v35 = 0x100000302LL;
v20 = (HardStreak *)(*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)v19 + 1024LL))(v19, 0x100000302LL);
v21 = HardStreak::create(v20);
*((_QWORD *)this + 240) = v21;
v22 = (GameManager *)(*(__int64 (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 378) + 464LL))(
*((_QWORD *)this + 378),
v21,
4294967293LL);
v23 = GameManager::sharedState(v22);
if ( *(_DWORD *)(v23 + 812) - *(_DWORD *)(v23 + 816) != 15 || *((_BYTE *)this + 2042) )
cocos2d::CCDrawNode::setBlendFunc(*((_QWORD *)this + 240), &v35);
else
*(_BYTE *)(*((_QWORD *)this + 240) + 440LL) = 1;
PlayerObject::deactivateStreak((cocos2d::CCMotionStreak **)this, 1u);
return _stack_chk_guard;
}