//
// EndPortalObject::init from 0x789b18 to 0x789e14 (764 bytes)
//
// 3 xrefs:
// > EndPortalObject::create @ 0x78a420
// > ??> @ 0xa2720
// > ??> @ 0x1176ec0
//
// 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 EndPortalObject::init(EndPortalObject *a1)
{
bool v2; // w26
cocos2d::CCDirector *v4; // x0
cocos2d::CCParticleSystemQuad *v5; // x0
cocos2d::CCParticleSystemQuad *v6; // x19
float v7; // s0
float v8; // s1
void (__fastcall *setStartColor)(cocos2d::CCParticleSystem *__hidden, const cocos2d::ccColor4F *); // x20
PlayerObject *m_player1; // x2
int g; // w4
int b; // w3
void (__fastcall *setEndColor)(cocos2d::CCParticleSystem *__hidden, const cocos2d::ccColor4F *); // x20
PlayerObject *v14; // x2
int v15; // w4
int v16; // w3
GameManager *v17; // x0
int v18; // w23
int v19; // w20
cocos2d::CCSprite *v20; // x19
float v21; // s1
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x27
float v23; // [xsp+74h] [xbp+74h]
cocos2d::CCPoint v24; // [xsp+78h] [xbp+78h] BYREF
float v25; // [xsp+80h] [xbp+80h]
float v26; // [xsp+84h] [xbp+84h]
v2 = GameObject::init(a1, "block001_01_001.png");
if ( v2 )
{
a1->setTextureRect(a1, &stru_1242490);
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v4);
a1->m_isInvisible = 0;
a1->m_unk3F8 = 1;
a1->m_objectType = Decoration;
v5 = GameObject::createAndAddParticle(a1, 7, "endEffectPortal.plist", 4, kCCPositionTypeGrouped);
v6 = v5;
if ( v5 )
{
v5->setStartRadius(v5, v23 * 0.5);
cocos2d::CCPoint::CCPoint(&v24, -15.0, 0.0);
cocos2d::CCPoint::operator=(&a1->m_particleOffset, v7, v8);
setStartColor = v6->setStartColor;
m_player1 = GameManager::sharedState()->m_playLayer->m_player1;
g = m_player1->m_playerColor1.g;
b = m_player1->m_playerColor1.b;
LODWORD(m_player1) = m_player1->m_playerColor1.r;
v26 = 1.0;
v24.y = (float)g / 255.0;
v25 = (float)b / 255.0;
v24.x = (float)(int)m_player1 / 255.0;
setStartColor(v6, (const cocos2d::ccColor4F *)&v24);
setEndColor = v6->setEndColor;
v14 = GameManager::sharedState()->m_playLayer->m_player1;
v15 = v14->m_playerColor1.g;
v16 = v14->m_playerColor1.b;
LODWORD(v14) = v14->m_playerColor1.r;
v26 = 1.0;
v24.y = (float)v15 / 255.0;
v25 = (float)v16 / 255.0;
v24.x = (float)(int)v14 / 255.0;
setEndColor(v6, (const cocos2d::ccColor4F *)&v24);
}
a1->m_gradientBar = cocos2d::CCSprite::createWithSpriteFrameName("gradientBar.png");
v17 = GameManager::sharedState();
v17->m_playLayer->m_gameBlendingLayerT1->addChild(v17->m_playLayer->m_gameBlendingLayerT1, a1->m_gradientBar);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))a1->m_gradientBar->setBlendFunc)(
a1->m_gradientBar,
0x100000302LL);
a1->m_gradientBar->setScaleY(a1->m_gradientBar, (float)(v23 * 1.5) / a1->m_gradientBar->m_obRect.size.height);
v18 = llroundf((float)(v23 * 1.5) / 30.0);
if ( v18 > 0 )
{
v19 = 0;
do
{
v20 = cocos2d::CCSprite::createWithSpriteFrameName("square_02_001.png");
a1->addChild(a1, v20);
v20->setRotation(v20, -90.0);
v21 = (float)v19++;
setPosition = v20->setPosition;
cocos2d::CCPoint::CCPoint(&v24, 0.0, -(float)((float)(v21 * 30.0) - (float)((float)(v18 >> 1) * 30.0)));
setPosition(v20, &v24);
}
while ( v19 != v18 );
}
a1->m_unk370 = 1;
}
return v2;
}