//
// GJBaseGameLayer::playExitDualEffect from 0x46f650 to 0x46f994 (836 bytes)
//
// 2 xrefs:
// > PlayLayer::destroyPlayer @ 0x313e28
// > GJBaseGameLayer::toggleDualMode @ 0x49184e
//
// 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 GJBaseGameLayer::playExitDualEffect(GJBaseGameLayer *a1, PlayerObject *a2)
{
GameManager *v4; // r0
SimplePlayer *v5; // r4
GameManager *v6; // r0
IconType v7; // r2
int random; // r1
int seed; // r3
SimplePlayer *v10; // r0
int v11; // r1
GameManager *v12; // r0
int v13; // r1
int v14; // r3
GameManager *v15; // r0
int v16; // r1
int v17; // r3
GameManager *v18; // r0
int v19; // r1
int v20; // r3
GameManager *v21; // r0
int v22; // r1
int v23; // r3
GameManager *v24; // r0
int v25; // r1
int v26; // r3
void (__fastcall *setScaleX)(cocos2d::CCSprite *__hidden, float); // r6
float v28; // r0
void (__fastcall *setScaleY)(cocos2d::CCSprite *__hidden, float); // r6
float v30; // r0
const cocos2d::CCPoint *v31; // r0
float v32; // s17
int v33; // s16
void (__fastcall *v34)(cocos2d::CCSprite *__hidden, float); // r6
int v35; // r0
int v36; // r2
bool v37; // r3
void (__fastcall *setColor)(SimplePlayer *__hidden, const cocos2d::ccColor3B *); // r6
const cocos2d::ccColor3B *v39; // r0
int v40; // r0
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
int v42; // r10
cocos2d::CCMoveTo *v43; // r10
int v44; // r1
float v45; // r2
cocos2d::CCAction *v46; // r9
cocos2d::CCFiniteTimeAction *v47; // r0
cocos2d::CCAction *v48; // r6
GLubyte r; // r10
GLubyte b; // r5
CCCircleWave *v51; // r0
CCCircleWave_vtbl *v52; // r3
CCCircleWave *v53; // r6
cocos2d::CCSequence *v54; // [sp+0h] [bp-34h]
cocos2d::CCSequence *v55; // [sp+0h] [bp-34h]
cocos2d::CCFadeOut *v56; // [sp+4h] [bp-30h]
cocos2d::CCPoint v57; // [sp+Ch] [bp-28h] BYREF
cocos2d::CCPoint v58; // [sp+14h] [bp-20h] BYREF
cocos2d::CCPoint v59; // [sp+1Ch] [bp-18h] BYREF
cocos2d::CCPoint v60; // [sp+24h] [bp-10h] BYREF
v4 = GameManager::sharedState();
v5 = SimplePlayer::create(v4->m_playerFrame.random - v4->m_playerFrame.seed);
if ( a2->m_isBall )
{
v6 = GameManager::sharedState();
v7 = Ball;
random = v6->m_playerBall.random;
seed = v6->m_playerBall.seed;
v10 = v5;
v11 = random - seed;
}
else if ( a2->m_isShip )
{
v12 = GameManager::sharedState();
v7 = Ship;
v13 = v12->m_playerShip.random;
v14 = v12->m_playerShip.seed;
v10 = v5;
v11 = v13 - v14;
}
else if ( a2->m_isBird )
{
v15 = GameManager::sharedState();
v7 = Ufo;
v16 = v15->m_playerBird.random;
v17 = v15->m_playerBird.seed;
v10 = v5;
v11 = v16 - v17;
}
else if ( a2->m_isDart )
{
v18 = GameManager::sharedState();
v7 = Wave;
v19 = v18->m_playerDart.random;
v20 = v18->m_playerDart.seed;
v10 = v5;
v11 = v19 - v20;
}
else if ( a2->m_isRobot )
{
v21 = GameManager::sharedState();
v7 = Robot;
v22 = v21->m_playerRobot.random;
v23 = v21->m_playerRobot.seed;
v10 = v5;
v11 = v22 - v23;
}
else
{
if ( !a2->m_isSpider )
goto LABEL_14;
v24 = GameManager::sharedState();
v7 = Spider;
v25 = v24->m_playerSpider.random;
v26 = v24->m_playerSpider.seed;
v10 = v5;
v11 = v25 - v26;
}
SimplePlayer::updatePlayerFrame(v10, v11, v7);
LABEL_14:
setScaleX = v5->setScaleX;
v28 = COERCE_FLOAT(((int (__fastcall *)(PlayerObject *))a2->getScaleX)(a2));
((void (__fastcall *)(SimplePlayer *, _DWORD))setScaleX)(v5, v28 * a1->m_gameState.m_cameraZoom);
setScaleY = v5->setScaleY;
v30 = COERCE_FLOAT(((int (__fastcall *)(PlayerObject *))a2->getScaleY)(a2));
((void (__fastcall *)(SimplePlayer *, _DWORD))setScaleY)(v5, v30 * a1->m_gameState.m_cameraZoom);
v31 = a2->getPosition(a2);
cocos2d::CCPoint::CCPoint(&v57, v31);
v32 = COERCE_FLOAT(((int (__fastcall *)(PlayerObject *))a2->getRotation)(a2));
if ( a1->m_gameState.m_unkBool10 )
{
v32 = -v32;
v33 = -1;
v34 = v5->setScaleX;
v35 = ((int (__fastcall *)(SimplePlayer *))v5->getScaleX)(v5);
((void (__fastcall *)(SimplePlayer *, unsigned int))v34)(v5, v35 ^ 0x80000000);
cocos2d::CCPoint::CCPoint(&v59, 150.0, 0.0);
cocos2d::CCPoint::operator+(&v60, &v57, &v59);
cocos2d::CCPoint::operator=((PlayerObject *)&v57, COERCE_FLOAT(&v60), v36, v37);
}
else
{
v33 = 1;
}
a1->addChild_0(a1, v5, 100);
setColor = v5->setColor;
v39 = a2->getColor(a2);
setColor(v5, v39);
*(cocos2d::ccColor3B *)&v40 = PlayerObject::getSecondColor(a2);
LOWORD(v60.x) = v40;
BYTE2(v60.x) = BYTE2(v40);
SimplePlayer::setSecondColor(v5, (const cocos2d::ccColor3B *)&v60);
SimplePlayer::updateColors(v5);
cocos2d::CCPoint::operator-(&v58, &v57, &a1->m_gameState.m_cameraPosition);
setPosition = v5->setPosition;
cocos2d::CCPoint::operator*(&v60, &v58, LODWORD(a1->m_gameState.m_cameraZoom));
setPosition(v5, &v60);
v5->setRotation(v5, COERCE_FLOAT(LODWORD(v32)));
v56 = cocos2d::CCFadeOut::create(0.4);
v42 = (int)v5->getPosition(v5);
cocos2d::CCPoint::CCPoint(&v59, (float)v33 * -124.63, 0.0);
cocos2d::CCPoint::operator+(&v60, v42, &v59);
v43 = cocos2d::CCMoveTo::create(0.4, &v60);
if ( COERCE_FLOAT(((int (__fastcall *)(SimplePlayer *))v5->getScaleX)(v5)) > 0.0 )
v44 = 1036831949;
else
v44 = -1110651699;
v54 = (cocos2d::CCSequence *)v44;
v5->getScaleY(v5);
v55 = (cocos2d::CCSequence *)cocos2d::CCScaleTo::create(0.4, *(float *)&v54);
v46 = (cocos2d::CCAction *)cocos2d::CCRotateBy::create((cocos2d::CCRotateBy *)0x3ECCCCCD, 180.0, v45);
LODWORD(v60.x) = 260;
LODWORD(v60.y) = 1;
v47 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(v5, 260, 1);
v48 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v55, v47, 0);
cocos2d::CCNode::runAction(v5, v56);
cocos2d::CCNode::runAction(v5, v43);
cocos2d::CCNode::runAction(v5, v48);
cocos2d::CCNode::runAction(v5, v46);
r = a2->m_playerColor1.r;
LOBYTE(v46) = a2->m_playerColor1.g;
b = a2->m_playerColor1.b;
v51 = CCCircleWave::create(10.0, 30.0, 0.4, 0);
v52 = v51->__vftable;
v53 = v51;
v51->m_color.r = r;
v51->m_color.g = (unsigned __int8)v46;
v51->m_color.b = b;
v52->setPosition(v51, &v58);
a1->addChild_0(a1, v53, 0);
v53->m_circleMode = Outline;
CCCircleWave::followObject(v53, v5, 0);
}