//
// FMODLevelVisualizer::init from 0x1002e0f30 to 0x1002e130c (988 bytes)
//
// 2 xrefs:
// > FMODLevelVisualizer::create @ 0x1002e0ee4
// > ??> @ 0x1007e2278
//
// 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 __fastcall FMODLevelVisualizer::init(FMODLevelVisualizer *a1)
{
_BOOL4 v2; // w0
cocos2d::CCTextureCache *v3; // x0
cocos2d::CCTexture2D *v4; // x21
cocos2d::CCSpriteBatchNode *v5; // x21
cocos2d::CCSprite *v6; // x23
float width; // s0
__n128 v8; // q0
__n128 v9; // q1
int v10; // w26
float v11; // s8
__int64 v12; // x23
float v13; // s0
float v14; // s1
__int64 v15; // x25
float v16; // s12
char v17; // w28
char v18; // w27
cocos2d::CCSprite *v19; // x24
__n128 v20; // q0
__n128 v21; // q1
cocos2d::CCSprite *v22; // x22
__n128 v23; // q0
__n128 v24; // q1
bool v26; // [xsp+0h] [xbp-A0h]
int v27; // [xsp+4h] [xbp-9Ch] BYREF
__int64 v28; // [xsp+Ch] [xbp-94h] BYREF
__int16 v29; // [xsp+14h] [xbp-8Ch] BYREF
char v30; // [xsp+16h] [xbp-8Ah]
__int64 v31; // [xsp+18h] [xbp-88h] BYREF
v2 = cocos2d::CCNode::init(a1);
if ( v2 )
{
v26 = v2;
((void (__fastcall *)(FMODLevelVisualizer *, void *))a1->setContentSize)(a1, &unk_10086DA28);
v3 = cocos2d::CCTextureCache::sharedTextureCache();
v4 = cocos2d::CCTextureCache::addImage(v3, "PixelSheet_01.png", 0);
cocos2d::CCTexture2D::setAliasTexParameters(v4);
v5 = cocos2d::CCSpriteBatchNode::createWithTexture(v4, 0x1Du);
((void (__fastcall *)(FMODLevelVisualizer *, cocos2d::CCSpriteBatchNode *))a1->addChild)(a1, v5);
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *, __int64))v5->setTag)(v5, 50);
v6 = cocos2d::CCSprite::createWithSpriteFrameName("pixelart_base_001.png");
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *, cocos2d::CCSprite *, __int64))v5->addChild_0)(
v5,
v6,
0xFFFFFFFFLL);
((void (__fastcall *)(cocos2d::CCSprite *, void *))v6->setColor)(v6, &unk_100644748);
width = v6->m_obRect.size.width;
a1->m_width = width;
((void (__fastcall *)(cocos2d::CCSprite *, float))v6->setScaleX)(v6, 10.0 / width);
v8 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, float))v6->setScaleY)(v6, 100.0 / a1->m_width);
v9.n128_u32[0] = -1035993088;
v8.n128_u32[0] = -3.0;
sub_100022980(v8, v9, &v31);
v10 = 0;
v11 = 6.0 / a1->m_width;
do
{
sub_1000229B8(&v28, &v31);
if ( v10 == 2 )
{
v30 = 0;
v29 = 255;
v12 = 300;
v14 = 1.0;
v13 = 0.85;
}
else
{
v30 = 0;
if ( v10 == 1 )
{
v29 = -1;
v12 = 200;
v13 = 0.6;
v14 = 0.85;
}
else
{
v29 = -256;
v12 = 100;
v13 = 0.0;
v14 = 0.6;
}
}
v15 = 0;
*((float *)&v28 + 1) = *((float *)&v28 + 1) + (float)(v13 * 96.0);
v16 = (float)(v14 - v13) * 96.0;
v17 = 1;
do
{
v18 = v15;
v19 = cocos2d::CCSprite::createWithSpriteFrameName("pixelart_base_001.png");
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *, cocos2d::CCSprite *, __int64))v5->addChild_0)(v5, v19, v15);
((void (__fastcall *)(cocos2d::CCSprite *, __int16 *))v19->setColor)(v19, &v29);
if ( (v17 & 1) != 0 )
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v19->setOpacity)(v19, 100);
v20 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, __int64 *))v19->setPosition)(v19, &v28);
v20.n128_u32[0] = 0;
v21.n128_u32[0] = 0;
sub_100022980(v20, v21, &v27);
((void (__fastcall *)(cocos2d::CCSprite *, int *))v19->setAnchorPoint)(v19, &v27);
((void (__fastcall *)(cocos2d::CCSprite *, float))v19->setScaleX)(v19, v11);
((void (__fastcall *)(cocos2d::CCSprite *, float))v19->setScaleY)(v19, v16 / a1->m_width);
v17 = 0;
v15 = 1;
}
while ( (v18 & 1) == 0 );
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v19->setTag)(v19, v12);
++v10;
}
while ( v10 != 3 );
v22 = cocos2d::CCSprite::createWithSpriteFrameName("pixelart_base_001.png");
((void (__fastcall *)(cocos2d::CCSpriteBatchNode *, cocos2d::CCSprite *, __int64))v5->addChild_0)(v5, v22, 2);
((void (__fastcall *)(cocos2d::CCSprite *, void *))v22->setColor)(v22, &unk_100644748);
v23 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, __int64 *))v22->setPosition)(v22, &v31);
v23.n128_u32[0] = 0;
v24.n128_u32[0] = 0;
sub_100022980(v23, v24, &v28);
((void (__fastcall *)(cocos2d::CCSprite *, __int64 *))v22->setAnchorPoint)(v22, &v28);
((void (__fastcall *)(cocos2d::CCSprite *, float))v22->setScaleX)(v22, v11);
((void (__fastcall *)(cocos2d::CCSprite *, float))v22->setScaleY)(v22, 1.0 / a1->m_width);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v22->setTag)(v22, 400);
FMODLevelVisualizer::updateVisualizer(a1, 0.0, 0.0, 0.0);
LOBYTE(v2) = v26;
}
return v2;
}