//
// GJBaseGameLayer::createBackground from 0x1000f0630 to 0x1000f07e6 (438 bytes)
//
// 6 xrefs:
// > PlayLayer::setupHasCompleted @ 0x10007b4cd
// > LevelEditorLayer::init @ 0x1000aad41
// > GJBaseGameLayer::swapBackground @ 0x1000f0852
// > GJBaseGameLayer::asyncBGLoaded @ 0x1000f0889
// > GJBaseGameLayer::syncBGTextures @ 0x100138407
// > LevelSettingsLayer::selectArtClosed @ 0x100259455
//
// This function is hookable on this platform (idp: pc, 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:21:11 +0000
//
void __fastcall GJBaseGameLayer::createBackground(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v4; // rdi
unsigned int v5; // r14d
int v6; // r15d
double v7; // xmm0_8
__int64 v8; // rax
__int64 BGTexture; // rax
__int64 v10; // rax
__int64 v11; // rax
__int64 v12; // r14
__int64 v13; // rdi
__int64 v14; // r14
__int64 v15; // rax
__int64 v16; // rdi
__int64 v17; // [rsp+4h] [rbp-3Ch] BYREF
int v18; // [rsp+Ch] [rbp-34h]
int v19; // [rsp+10h] [rbp-30h]
__int16 v20; // [rsp+14h] [rbp-2Ch] BYREF
char v21; // [rsp+16h] [rbp-2Ah]
float v22; // [rsp+1Ch] [rbp-24h]
float v23; // [rsp+24h] [rbp-1Ch]
v4 = *(_QWORD *)(a1 + 3944);
if ( v4 )
{
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v4 + 64LL))(v4) == (_DWORD)a2 )
return;
v4 = *(_QWORD *)(a1 + 3944);
if ( v4 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v4 + 520LL))(v4);
*(_QWORD *)(a1 + 3944) = 0;
}
}
v5 = 59;
if ( (int)a2 < 59 )
v5 = a2;
v6 = 33648;
if ( v5 - 16 <= 0x2B )
v6 = dword_100A04EDC[v5 - 16];
*(_QWORD *)&v7 = GameManager::sharedState(v4, a2, a3).u64[0];
BGTexture = GameManager::getBGTexture(v8, v5, v7);
v10 = cocos2d::CCSprite::create_1(BGTexture);
*(_QWORD *)(a1 + 3944) = v10;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v10 + 72LL))(v10, v5);
v17 = 0x260100002601LL;
v18 = 10497;
v19 = v6;
v11 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3944) + 1072LL))(*(_QWORD *)(a1 + 3944));
cocos2d::CCTexture2D::setTexParameters(v11, &v17);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 3896) + 464LL))(
*(_QWORD *)(a1 + 3896),
*(_QWORD *)(a1 + 3944),
4294967236LL);
v12 = *(_QWORD *)(a1 + 3944);
sub_100278250(&v20, 0.0, 0.0);
v13 = v12;
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v12 + 296LL))(v12, &v20);
v14 = *(_QWORD *)(a1 + 3944);
v15 = AppDelegate::get(v13, &v20);
AppDelegate::bgScale(v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v14 + 160LL))(v14);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 3944) + 1080LL))(*(_QWORD *)(a1 + 3944), 1);
v16 = *(_QWORD *)(a1 + 3944);
v21 = -1;
v20 = 32040;
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v16 + 960LL))(v16, &v20);
sub_1002787F0(&v20, *(_QWORD *)(a1 + 3944) + 424LL);
v23 = v22;
*(float *)&v7 = (*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3944) + 168LL))(*(_QWORD *)(a1 + 3944));
*(float *)(a1 + 1156) = *(float *)&v7 * v23;
}