//
// EndPortalObject::init from 0x3fe5a0 to 0x3fe80c (620 bytes)
//
// 1 xrefs:
// > EndPortalObject::create @ 0x3fec4a
//
// 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)
{
_BOOL4 v2; // r9
cocos2d::CCDirector *v3; // r0
cocos2d::CCParticleSystemQuad *v4; // r0
cocos2d::CCParticleSystemQuad *v5; // r7
int v6; // r2
bool v7; // r3
void (__fastcall *setStartColor)(cocos2d::CCParticleSystem *__hidden, const cocos2d::ccColor4F *); // r8
PlayerObject *m_player1; // r2
int g; // r10
int r; // s17
int b; // s19
void (__fastcall *setEndColor)(cocos2d::CCParticleSystem *__hidden, const cocos2d::ccColor4F *); // r8
PlayerObject *v14; // r2
int v15; // r10
int v16; // s17
int v17; // s19
int v18; // r7
GameManager *v19; // r0
int v20; // r10
cocos2d::CCSprite *v21; // r6
int v22; // s15
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [sp+Ch] [bp-30h]
cocos2d::CCSize v25; // [sp+14h] [bp-28h] BYREF
_DWORD v26[2]; // [sp+1Ch] [bp-20h] BYREF
cocos2d::CCPoint v27; // [sp+24h] [bp-18h] BYREF
float v28; // [sp+2Ch] [bp-10h]
float v29; // [sp+30h] [bp-Ch]
v2 = GameObject::init(a1, "block001_01_001.png");
if ( v2 )
{
a1->setTextureRect(a1, &stru_AC6070);
v3 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v25, v3);
a1->m_unk3F8 = 1;
a1->m_isInvisible = 0;
a1->m_objectType = Decoration;
v4 = GameObject::createAndAddParticle(a1, 7, "endEffectPortal.plist", 4, kCCPositionTypeGrouped);
v5 = v4;
if ( v4 )
{
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *, _DWORD))v4->setStartRadius)(v4, v25.height * 0.5);
cocos2d::CCPoint::CCPoint(&v27, -15.0, 0.0);
cocos2d::CCPoint::operator=((PlayerObject *)&a1->m_particleOffset, COERCE_FLOAT(&v27), v6, v7);
setStartColor = v5->setStartColor;
m_player1 = GameManager::sharedState()->m_playLayer->m_player1;
g = m_player1->m_playerColor1.g;
r = m_player1->m_playerColor1.r;
b = m_player1->m_playerColor1.b;
v29 = 1.0;
v27.y = (float)g / 255.0;
v27.x = (float)r / 255.0;
v28 = (float)b / 255.0;
setStartColor(v5, (const cocos2d::ccColor4F *)&v27);
setEndColor = v5->setEndColor;
v14 = GameManager::sharedState()->m_playLayer->m_player1;
v15 = v14->m_playerColor1.g;
v16 = v14->m_playerColor1.r;
v17 = v14->m_playerColor1.b;
v29 = 1.0;
v27.y = (float)v15 / 255.0;
v27.x = (float)v16 / 255.0;
v28 = (float)v17 / 255.0;
setEndColor(v5, (const cocos2d::ccColor4F *)&v27);
}
v18 = 0;
a1->m_gradientBar = cocos2d::CCSprite::createWithSpriteFrameName("gradientBar.png");
v19 = GameManager::sharedState();
v19->m_playLayer->m_gameBlendingLayerT1->addChild(v19->m_playLayer->m_gameBlendingLayerT1, a1->m_gradientBar);
v26[0] = 770;
v26[1] = 1;
((void (__fastcall *)(cocos2d::CCSprite *, int, int, _DWORD *))a1->m_gradientBar->setBlendFunc)(
a1->m_gradientBar,
770,
1,
v26);
((void (__fastcall *)(cocos2d::CCSprite *, _DWORD))a1->m_gradientBar->setScaleY)(
a1->m_gradientBar,
(float)(v25.height * 1.5) / a1->m_gradientBar->m_obRect.size.height);
v20 = lroundf();
while ( v18 < v20 )
{
v21 = cocos2d::CCSprite::createWithSpriteFrameName("square_02_001.png");
a1->addChild(a1, v21);
((void (__fastcall *)(cocos2d::CCSprite *, int))v21->setRotation)(v21, -1028390912);
v22 = v18++;
setPosition = v21->setPosition;
cocos2d::CCPoint::CCPoint(&v27, 0.0, (float)((float)(v20 / 2) * 30.0) - (float)((float)v22 * 30.0));
setPosition(v21, &v27);
}
a1->m_unk370 = 1;
}
return v2;
}