//
// GameManager::init from 0x14017b4f0 to 0x14017b720 (560 bytes)
//
// 2 xrefs:
// > ??> @ 0x14055cad0
// > ??> @ 0x1406cb340
//
// 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
//
bool GameManager::init(GameManager *a1)
{
__int64 v2; // rcx
cocos2d::CCArray *v3; // rax
int v4; // r8d
int v5; // edx
__int64 v6; // r9
int v7; // ebx
int v8; // ebx
float v9; // xmm6_4
int v10; // ebx
float v11; // xmm0_4
int v13; // [rsp+40h] [rbp+8h] BYREF
sub_14003CCE0((void **)&a1->m_fileName, "CCGameManager.dat", 0x11u);
*(_WORD *)&a1->m_unkBool2 = 0;
a1->m_adTimer = 0.0;
a1->m_unkDouble2 = 0.0;
a1->m_googlePlaySignedIn = 0;
v3 = (cocos2d::CCArray *)cocos2d::CCArray::create(v2);
a1->m_gjLog = v3;
cocos2d::CCObject::retain(v3);
a1->setup(a1);
sub_14018AD60(&a1->m_keyStartForIcon, 9);
v4 = 0;
v5 = 0;
v6 = 0;
while ( 2 )
{
a1->m_keyStartForIcon._Mypair._Myval2._Myfirst[v6] = v4;
switch ( v5 )
{
case 0:
v4 += 485;
++v5;
++v6;
continue;
case 1:
v4 += 169;
++v5;
++v6;
continue;
case 2:
v4 += 118;
++v5;
++v6;
continue;
case 3:
v4 += 149;
++v5;
++v6;
continue;
case 4:
v4 += 96;
++v5;
++v6;
continue;
case 5:
v4 += 68;
++v5;
++v6;
continue;
case 6:
v4 += 69;
++v5;
++v6;
continue;
case 7:
v4 += 43;
++v5;
++v6;
continue;
case 8:
v4 += 8;
v7 = v4;
break;
default:
++v5;
++v6;
v7 = v4;
if ( v5 <= 8 )
continue;
break;
}
break;
}
v13 = 0;
if ( v4 > 0 )
{
do
{
*(_DWORD *)sub_14012CE70((__int64 *)&a1->m_iconLoadCounts, &v13) = 0;
++v13;
}
while ( v13 < v7 );
}
GameManager::setupGameAnimations(a1);
v8 = a1->m_playerUserID.random - a1->m_playerUserID.seed;
v9 = (float)((float)rand() / 32767.0) * 1000000.0;
v10 = (int)(float)(v9 + floorf((float)v8 / 10000.0));
v11 = (float)((float)rand() / 32767.0) * 1000.0;
a1->m_chk.seed = (int)v11;
a1->m_chk.random = v10 + (int)v11;
return 1;
}