//
// GJBaseGameLayer::playExitDualEffect from 0x1001e9e70 to 0x1001ea2e0 (1136 bytes)
//
// 2 xrefs:
// > PlayLayer::destroyPlayer @ 0x10011eb70
// > GJBaseGameLayer::toggleDualMode @ 0x1001e63c8
//
// 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::playExitDualEffect(GJBaseGameLayer *a1, PlayerObject *a2)
{
GameManager *v4; // x0
SimplePlayer *v5; // x20
GameManager *v6; // x0
int v7; // w1
SimplePlayer *v8; // x0
IconType v9; // w2
GameManager *v10; // x0
GameManager *v11; // x0
GameManager *v12; // x0
GameManager *v13; // x0
GameManager *v14; // x0
float v15; // s0
float v16; // s0
__int64 *v17; // x0
float v18; // s0
__n128 v19; // q0
float v20; // s8
float v21; // s0
__n128 v22; // q0
__n128 v23; // q1
unsigned __int32 v24; // s9
__int64 v25; // x0
double v26; // d0
cocos2d::CCFadeOut *v27; // x22
float32x2_t *v28; // x23
__n128 v29; // q1
__n128 v30; // q0
cocos2d::CCMoveTo *v31; // x23
float v32; // s9
float v33; // s2
cocos2d::CCScaleTo *v34; // x24
cocos2d::CCRotateBy *v35; // x25
char v36; // w0
__int64 v37; // x1
__int64 v38; // x2
__int64 v39; // x3
__int64 v40; // x4
__int64 v41; // x5
__int64 v42; // x6
__int64 v43; // x7
cocos2d::CCSequence *v44; // x24
__int16 v45; // w22
GLubyte b; // w23
CCCircleWave *v47; // x21
float32x2_t v48; // [xsp+10h] [xbp-80h] BYREF
float32x2_t v49; // [xsp+18h] [xbp-78h] BYREF
float32x2_t v50; // [xsp+20h] [xbp-70h] BYREF
float32x2_t v51; // [xsp+28h] [xbp-68h] BYREF
cocos2d::SEL_CallFunc v52; // 0:x1.16
v4 = GameManager::sharedState();
v5 = SimplePlayer::create(v4->m_playerFrame.random - v4->m_playerFrame.seed);
if ( a2->m_isBall )
{
v6 = GameManager::sharedState();
v7 = v6->m_playerBall.random - v6->m_playerBall.seed;
v8 = v5;
v9 = Ball;
}
else if ( a2->m_isShip )
{
v10 = GameManager::sharedState();
v7 = v10->m_playerShip.random - v10->m_playerShip.seed;
v8 = v5;
v9 = Ship;
}
else if ( a2->m_isBird )
{
v11 = GameManager::sharedState();
v7 = v11->m_playerBird.random - v11->m_playerBird.seed;
v8 = v5;
v9 = Ufo;
}
else if ( a2->m_isDart )
{
v12 = GameManager::sharedState();
v7 = v12->m_playerDart.random - v12->m_playerDart.seed;
v8 = v5;
v9 = Wave;
}
else if ( a2->m_isRobot )
{
v13 = GameManager::sharedState();
v7 = v13->m_playerRobot.random - v13->m_playerRobot.seed;
v8 = v5;
v9 = Robot;
}
else
{
if ( !a2->m_isSpider )
goto LABEL_14;
v14 = GameManager::sharedState();
v7 = v14->m_playerSpider.random - v14->m_playerSpider.seed;
v8 = v5;
v9 = Spider;
}
SimplePlayer::updatePlayerFrame(v8, v7, v9);
LABEL_14:
v15 = ((float (__fastcall *)(PlayerObject *))a2->getScaleX)(a2);
((void (__fastcall *)(SimplePlayer *, float))v5->setScaleX)(v5, v15 * a1->m_gameState.m_cameraZoom);
v16 = ((float (__fastcall *)(PlayerObject *))a2->getScaleY)(a2);
((void (__fastcall *)(SimplePlayer *, float))v5->setScaleY)(v5, v16 * a1->m_gameState.m_cameraZoom);
v17 = (__int64 *)((__int64 (__fastcall *)(PlayerObject *))a2->getPosition)(a2);
v18 = sub_1000229B8((__int64 *)&v51, v17);
v19.n128_f32[0] = ((float (__fastcall *)(PlayerObject *, float))a2->getRotation)(a2, v18);
v20 = v19.n128_f32[0];
if ( a1->m_gameState.m_unkBool10 )
{
v20 = -v19.n128_f32[0];
v21 = ((float (__fastcall *)(SimplePlayer *))v5->getScaleX)(v5);
v22 = ((__n128 (__fastcall *)(SimplePlayer *, float))v5->setScaleX)(v5, -v21);
v22.n128_u32[0] = 1125515264;
v23.n128_u32[0] = 0;
sub_100022980(v22, v23, &v49);
sub_1000229DC(&v51, &v49, &v50);
v19.n128_f64[0] = sub_1000229D0(&v51, (double *)&v50);
v24 = 1123632026;
}
else
{
v24 = -1023851622;
}
((void (__fastcall *)(GJBaseGameLayer *, SimplePlayer *, __int64, __n128))a1->addChild_0)(a1, v5, 100, v19);
v25 = ((__int64 (__fastcall *)(PlayerObject *))a2->getColor)(a2);
((void (__fastcall *)(SimplePlayer *, __int64))v5->setColor)(v5, v25);
*(cocos2d::ccColor3B *)v50.f32 = PlayerObject::getSecondColor(a2);
SimplePlayer::setSecondColor(v5, (const cocos2d::ccColor3B *)&v50);
SimplePlayer::updateColors(v5);
sub_1000229F0(&v51, (float32x2_t *)&a1->m_gameState.m_cameraPosition, &v50);
*(float32x2_t *)&v26 = sub_100022A14(&v50, &v49, a1->m_gameState.m_cameraZoom);
((void (__fastcall *)(SimplePlayer *, float32x2_t *, double))v5->setPosition)(v5, &v49, v26);
((void (__fastcall *)(SimplePlayer *, float))v5->setRotation)(v5, v20);
v27 = cocos2d::CCFadeOut::create(0.4);
v28 = (float32x2_t *)((__int64 (__fastcall *)(SimplePlayer *))v5->getPosition)(v5);
v29.n128_u32[0] = 0;
v30.n128_u32[0] = v24;
sub_100022980(v30, v29, &v48);
sub_1000229DC(v28, &v48, &v49);
v31 = cocos2d::CCMoveTo::create(0.4, (const cocos2d::CCPoint *)&v49);
if ( ((float (__fastcall *)(SimplePlayer *))v5->getScaleX)(v5) <= 0.0 )
v32 = -0.1;
else
v32 = 0.1;
if ( ((float (__fastcall *)(SimplePlayer *))v5->getScaleY)(v5) <= 0.0 )
v33 = -0.1;
else
v33 = 0.1;
v34 = cocos2d::CCScaleTo::create(0.4, v32, v33);
v35 = cocos2d::CCRotateBy::create_1(0.4, 180.0);
v52.ptr = (void (*)(void))520;
v52.adj = 1;
v36 = (unsigned __int8)cocos2d::CCCallFunc::create(v5, v52);
v44 = sub_10018A494(v34, v37, v38, v39, v40, v41, v42, v43, v36);
cocos2d::CCNode::runAction(v5, v27);
cocos2d::CCNode::runAction(v5, v31);
cocos2d::CCNode::runAction(v5, v44);
cocos2d::CCNode::runAction(v5, v35);
v45 = *(_WORD *)&a2->m_playerColor1.r;
b = a2->m_playerColor1.b;
v47 = CCCircleWave::create_1(10.0, 30.0, 0.4, 0);
v47->m_color.b = b;
*(_WORD *)&v47->m_color.r = v45;
((void (__fastcall *)(CCCircleWave *, float32x2_t *))v47->setPosition)(v47, &v50);
((void (__fastcall *)(GJBaseGameLayer *, CCCircleWave *, _QWORD))a1->addChild_0)(a1, v47, 0);
v47->m_circleMode = Outline;
CCCircleWave::followObject(v47, v5, 0);
}