//
// GJBaseGameLayer::playExitDualEffect from 0x140216e80 to 0x1402174df (1631 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::toggleDualMode @ 0x140216bac
// > PlayLayer::destroyPlayer @ 0x1403b3cda
// > ??> @ 0x1406cd194
//
// 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
//
// Hidden C++ exception states: #wind=7
void GJBaseGameLayer::playExitDualEffect(GJBaseGameLayer *a1, PlayerObject *a2)
{
float v2; // xmm3_4
__int64 v5; // rax
SimplePlayer *v6; // rsi
__int64 v7; // rax
int v8; // edx
IconType v9; // r8d
__int64 v10; // rax
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rax
__int64 v14; // rax
SimplePlayer_vtbl *v15; // rbx
SimplePlayer_vtbl *v16; // rbx
int v17; // r12d
SimplePlayer_vtbl *v18; // rbx
float v19; // xmm0_4
cocos2d::CCRGBAProtocol_vtbl *v20; // rdi
const cocos2d::ccColor3B *v21; // rax
const cocos2d::ccColor3B *v22; // rax
struct cocos2d::CCFadeOut *v23; // r13
__int64 v24; // rax
struct cocos2d::CCMoveTo *v25; // r12
float v26; // xmm7_4
float v27; // xmm8_4
struct cocos2d::CCScaleTo *v28; // rbx
struct cocos2d::CCRotateBy *v29; // rdi
__int64 v30; // rax
struct cocos2d::CCSequence *v31; // rbx
cocos2d::ccColor3B *v32; // r8
cocos2d::ccColor3B *v33; // r8
cocos2d::ccColor3B *v34; // r8
cocos2d::ccColor3B *v35; // r8
cocos2d::CCNode *v36; // r14
cocos2d::CCObject *v37; // rcx
cocos2d::CCNode_vtbl *v38; // rbx
__int64 v39; // rax
float v40; // [rsp+20h] [rbp-58h]
float v41; // [rsp+20h] [rbp-58h]
float v42; // [rsp+20h] [rbp-58h]
float v43; // [rsp+20h] [rbp-58h]
struct cocos2d::CCPoint v44; // [rsp+C0h] [rbp+48h] BYREF
cocos2d::CCPoint v45; // [rsp+C8h] [rbp+50h] BYREF
char v46; // [rsp+D0h] [rbp+58h] BYREF
v5 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = qword_1406C2ED8;
}
v6 = SimplePlayer::create(*(_DWORD *)(v5 + 708) - *(_DWORD *)(v5 + 712));
if ( a2->m_isBall )
{
v7 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v7 = qword_1406C2ED8;
}
v8 = *(_DWORD *)(v7 + 732) - *(_DWORD *)(v7 + 736);
v9 = Ball;
}
else if ( a2->m_isShip )
{
v10 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v10 = qword_1406C2ED8;
}
v8 = *(_DWORD *)(v10 + 720) - *(_DWORD *)(v10 + 724);
v9 = Ship;
}
else if ( a2->m_isBird )
{
v11 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v11 = qword_1406C2ED8;
}
v8 = *(_DWORD *)(v11 + 744) - *(_DWORD *)(v11 + 748);
v9 = Ufo;
}
else if ( a2->m_isDart )
{
v12 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v12 = qword_1406C2ED8;
}
v8 = *(_DWORD *)(v12 + 756) - *(_DWORD *)(v12 + 760);
v9 = Wave;
}
else if ( a2->m_isRobot )
{
v13 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v13 = qword_1406C2ED8;
}
v8 = *(_DWORD *)(v13 + 768) - *(_DWORD *)(v13 + 772);
v9 = Robot;
}
else
{
if ( !a2->m_isSpider )
goto LABEL_28;
v14 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v14 = qword_1406C2ED8;
}
v8 = *(_DWORD *)(v14 + 780) - *(_DWORD *)(v14 + 784);
v9 = Spider;
}
SimplePlayer::updatePlayerFrame(v6, v8, v9);
LABEL_28:
v15 = v6->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a2->getScaleX(a2);
((void (__fastcall *)(SimplePlayer *))v15->setScaleX)(v6);
v16 = v6->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a2->getScaleY(a2);
((void (__fastcall *)(SimplePlayer *))v16->setScaleY)(v6);
a2->getPosition_0(a2);
cocos2d::CCPoint::CCPoint(&v45);
a2->getRotation(a2);
v17 = 1;
if ( a1->m_gameState.m_unkBool10 )
{
v17 = -1;
v18 = v6->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v6->getScaleX(v6);
v19 = ((float (__fastcall *)(SimplePlayer *))v18->setScaleX)(v6);
cocos2d::CCPoint::CCPoint(v19, 150.0);
cocos2d::CCPoint::operator+(&v45, &v44);
cocos2d::CCPoint::operator=(&v45, &v44);
}
a1->addChild_0(a1, v6, 100);
v20 = v6->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCRGBAProtocol::__vftable;
v21 = a2->getColor(&a2->cocos2d::CCRGBAProtocol);
v20->setColor(&v6->cocos2d::CCRGBAProtocol, v21);
v22 = a2->m_iconSpriteSecondary->getColor(&a2->m_iconSpriteSecondary->cocos2d::CCRGBAProtocol);
LOWORD(v44.x) = *(_WORD *)&v22->r;
BYTE2(v44.x) = v22->b;
v6->m_secondLayer->setColor(&v6->m_secondLayer->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v44);
SimplePlayer::updateColors(v6);
SimplePlayer::updateColors(v6);
cocos2d::CCPoint::operator-(&v45, &v46, &a1->m_gameState.m_cameraPosition);
cocos2d::CCPoint::operator*(&v46, &v44);
v6->setPosition_0(v6, &v44);
((void (__fastcall *)(SimplePlayer *))v6->setRotation)(v6);
v23 = cocos2d::CCFadeOut::create(0.40000001);
cocos2d::CCPoint::CCPoint(0.40000001, (float)v17 * -124.63203);
v24 = (__int64)v6->getPosition_0(v6);
cocos2d::CCPoint::operator+(v24, &v44);
v25 = cocos2d::CCMoveTo::create(0.40000001, &v44);
v26 = 0.1;
if ( v6->getScaleY(v6) <= 0.0 )
v27 = -0.1;
else
v27 = 0.1;
if ( v6->getScaleX(v6) <= 0.0 )
v26 = -0.1;
v28 = cocos2d::CCScaleTo::create(0.40000001, v26, v27);
v29 = cocos2d::CCRotateBy::create(0.40000001, 180.0);
v30 = cocos2d::CCCallFunc::create(v6, sub_14003BE70);
v31 = cocos2d::CCSequence::create(v28, v30, 0);
cocos2d::CCNode::runAction((CCLightFlash *)v6, (cocos2d::CCPoint)v23, v32, v2, v40);
cocos2d::CCNode::runAction((CCLightFlash *)v6, (cocos2d::CCPoint)v25, v33, v2, v41);
cocos2d::CCNode::runAction((CCLightFlash *)v6, (cocos2d::CCPoint)v31, v34, v2, v42);
cocos2d::CCNode::runAction((CCLightFlash *)v6, (cocos2d::CCPoint)v29, v35, v2, v43);
LOWORD(v31) = *(_WORD *)&a2->m_playerColor1.r;
LOBYTE(v29) = a2->m_playerColor1.b;
v36 = CCCircleWave::create(10.0, 30.0, 0.40000001, 0, 1);
LOWORD(v36[1].m_uReference) = (_WORD)v31;
BYTE2(v36[1].m_uReference) = (_BYTE)v29;
v36->setPosition_0(v36, (const cocos2d::CCPoint *)&v46);
a1->addChild_0(a1, v36, 0);
v36[1].m_uIndexInArray = 1;
v37 = (cocos2d::CCObject *)v36[1].__vftable;
if ( v37 )
cocos2d::CCObject::release(v37);
v36[1].__vftable = (cocos2d::CCNode_vtbl *)v6;
cocos2d::CCObject::retain(v6);
cocos2d::CCNode::unschedule(v36, CCCircleWave::updatePosition);
cocos2d::CCNode::schedule(v36, CCCircleWave::updatePosition);
v38 = v36->__vftable;
v39 = (*((__int64 (__fastcall **)(cocos2d::CCNode_vtbl *))v36[1].copyWithZone + 25))(v36[1].__vftable);
v38->setPosition_0(v36, (const cocos2d::CCPoint *)v39);
}