//
// GJBaseGameLayer::createBackground from 0x100114390 to 0x100114546 (438 bytes)
//
// 6 xrefs:
// > PlayLayer::setupHasCompleted @ 0x1000adf1c
// > LevelEditorLayer::init @ 0x1000dbf30
// > GJBaseGameLayer::swapBackground @ 0x1001145b2
// > GJBaseGameLayer::asyncBGLoaded @ 0x1001145e9
// > GJBaseGameLayer::syncBGTextures @ 0x100158f77
// > LevelSettingsLayer::selectArtClosed @ 0x10026f455
//
// 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 GJBaseGameLayer::createBackground(GJBaseGameLayer *a1, int a2)
{
cocos2d::CCSprite *m_background; // rdi
cocos2d::CCSprite *v4; // rdi
unsigned int v5; // r14d
GLuint v6; // r15d
GameManager *v7; // rax
const char *BGTexture; // rax
cocos2d::CCSprite *v9; // rax
cocos2d::CCTexture2D *v10; // rax
cocos2d::CCSprite *v11; // r14
cocos2d::CCSprite *v12; // r14
AppDelegate *v13; // rax
float v14; // xmm0_4
cocos2d::CCSprite *v15; // rdi
cocos2d::CCRect *p_m_obRect; // rsi
float v17; // xmm0_4
cocos2d::ccTexParams v18; // [rsp+4h] [rbp-3Ch] BYREF
__int16 v19; // [rsp+14h] [rbp-2Ch] BYREF
char v20; // [rsp+16h] [rbp-2Ah]
float v21; // [rsp+1Ch] [rbp-24h]
float v22; // [rsp+24h] [rbp-1Ch]
m_background = a1->m_background;
if ( m_background )
{
if ( ((unsigned int (__fastcall *)(cocos2d::CCSprite *))m_background->getTag)(m_background) == a2 )
return;
v4 = a1->m_background;
if ( v4 )
{
((void (__fastcall *)(cocos2d::CCSprite *))v4->removeFromParent)(v4);
a1->m_background = nullptr;
}
}
v5 = 59;
if ( a2 < 59 )
v5 = a2;
v6 = 33648;
if ( v5 - 16 <= 0x2B )
v6 = dword_100816AE4[v5 - 16];
v7 = GameManager::sharedState();
BGTexture = GameManager::getBGTexture(v7, v5);
v9 = cocos2d::CCSprite::create_1(BGTexture);
a1->m_background = v9;
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))v9->setTag)(v9, v5);
*(_QWORD *)&v18.minFilter = 0x260100002601LL;
v18.wrapS = 10497;
v18.wrapT = v6;
v10 = (cocos2d::CCTexture2D *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_background->getTexture)(a1->m_background);
cocos2d::CCTexture2D::setTexParameters(v10, &v18);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSprite *, __int64))a1->m_objectParent->addChild_0)(
a1->m_objectParent,
a1->m_background,
4294967236LL);
v11 = a1->m_background;
sub_10028CBE0(&v19, 0.0, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, __int16 *))v11->setAnchorPoint)(v11, &v19);
v12 = a1->m_background;
v13 = AppDelegate::get();
v14 = AppDelegate::bgScale(v13);
((void (__fastcall *)(cocos2d::CCSprite *, float))v12->setScale)(v12, v14);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))a1->m_background->setBlendFunc)(a1->m_background, 1);
v15 = a1->m_background;
v20 = -1;
v19 = 32040;
((void (__fastcall *)(cocos2d::CCSprite *, __int16 *))v15->setColor)(v15, &v19);
p_m_obRect = &a1->m_background->m_obRect;
sub_10028D180(&v19);
v22 = v21;
v17 = ((float (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCRect *))a1->m_background->getScale)(
a1->m_background,
p_m_obRect);
a1->m_gameState.m_unkFloat10 = v17 * v22;
}