//
// PlayLayer::playEndAnimationToPos from 0x1403aba00 to 0x1403abef1 (1265 bytes)
//
// 4 xrefs:
// > PlayLayer::checkForEnd @ 0x1403b4e9b
// > ??> @ 0x14069936c
// > ??> @ 0x14069937c
// > ??> @ 0x1406d6c08
//
// 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 PlayLayer::playEndAnimationToPos(PlayLayer *a1, cocos2d::CCPoint a2)
{
float m_cameraZoom; // xmm3_4
float y; // xmm0_4
cocos2d::CCPoint *p_m_cameraOffset; // rsi
cocos2d::CCDirector *v7; // rax
cocos2d::CCPoint v8; // rax
int v9; // esi
int v10; // r15d
PlayerObject *m_player2; // rbx
__int64 m_spiderSprite; // rcx
EndPortalObject *m_endPortal; // rax
float v14; // xmm6_4
double v15; // xmm0_8
double v16; // xmm0_8
__int64 v17; // rax
double v18; // xmm0_8
__int64 v19; // rax
double v20; // xmm0_8
__int64 v21; // rax
struct cocos2d::CCBezierTo *v22; // rax
struct cocos2d::CCEaseIn *v23; // rax
cocos2d::ccColor3B *v24; // r8
struct cocos2d::CCFiniteTimeAction *v25; // r14
__int64 v26; // rax
struct cocos2d::CCSequence *v27; // rdx
struct cocos2d::CCRotateBy *v28; // rax
struct cocos2d::CCEaseIn *v29; // rax
cocos2d::ccColor3B *v30; // r8
float v31; // [rsp+28h] [rbp-E0h]
float v32; // [rsp+28h] [rbp-E0h]
cocos2d::CCPoint v33; // [rsp+68h] [rbp-A0h] BYREF
cocos2d::CCPoint v34; // [rsp+70h] [rbp-98h] BYREF
__int128 v35; // [rsp+78h] [rbp-90h] BYREF
__int64 v36; // [rsp+88h] [rbp-80h]
__int64 v37; // [rsp+90h] [rbp-78h]
__int64 v38; // [rsp+98h] [rbp-70h]
cocos2d::CCPoint v39; // [rsp+188h] [rbp+80h] BYREF
float v40; // [rsp+198h] [rbp+90h] BYREF
char v41; // [rsp+1A0h] [rbp+98h] BYREF
if ( !a1->m_levelEndAnimationStarted )
{
y = a1->m_gameState.m_unkPoint6.y;
a1->m_levelEndAnimationStarted = 1;
if ( y == 0.0 )
{
p_m_cameraOffset = &a1->m_gameState.m_cameraOffset;
}
else
{
v7 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v7);
m_cameraZoom = a1->m_gameState.m_cameraZoom;
cocos2d::CCPoint::CCPoint(y, (float)(v40 * 0.5) / m_cameraZoom);
cocos2d::CCPoint::operator+(&a1->m_gameState.m_cameraPosition2, &v39);
p_m_cameraOffset = &a1->m_gameState.m_cameraOffset;
cocos2d::CCPoint::operator-(&v39, &v41, &a1->m_gameState.m_cameraOffset);
cocos2d::CCPoint::operator=(&v39, &v41);
*(float *)(*(_QWORD *)&a2 + 4LL) = v39.y;
}
((void (__fastcall *)(PlayLayer *))a1->updateTimeWarp)(a1);
a1->m_gameState.m_unkPoint1.x = p_m_cameraOffset->x;
LODWORD(v39.x) = 15;
sub_14024AC30(&a1->m_gameState.m_tweenActions._Traitsobj._Mypair._Myval2._Myval2, (unsigned __int8 *)&v39);
p_m_cameraOffset->x = a1->m_gameState.m_unkPoint1.x;
a1->m_gameState.m_unkPoint1.y = a1->m_gameState.m_cameraOffset.y;
LODWORD(v39.x) = 16;
sub_14024AC30(&a1->m_gameState.m_tweenActions._Traitsobj._Mypair._Myval2._Myval2, (unsigned __int8 *)&v39);
a1->m_gameState.m_cameraOffset.y = a1->m_gameState.m_unkPoint1.y;
cocos2d::CCPoint::CCPoint(&v39);
GJBaseGameLayer::updateStaticCameraPos(a1, v8, 0, 1, 0, 1.2, 1, 1.8);
v9 = 0;
v10 = a1->m_gameState.m_isDualMode + 1;
do
{
if ( v9 )
m_player2 = a1->m_player2;
else
m_player2 = a1->m_player1;
PlayerObject::lockPlayer(m_player2);
if ( m_player2->m_isSpider )
{
m_spiderSprite = (__int64)m_player2->m_spiderSprite;
v36 = 112;
v37 = 9;
*((_QWORD *)&v35 + 1) = 0x6F6F6C5F6C6C6166LL;
v38 = 15;
CCAnimatedSprite::tweenToAnimation(m_spiderSprite, (void **)&v35 + 1, 0.40000001);
}
PlayerObject::toggleGhostEffect(m_player2, Enabled);
m_endPortal = a1->m_endPortal;
if ( m_endPortal && m_endPortal->m_flippedX )
v14 = -1.0;
else
v14 = 1.0;
m_player2->getPosition_0(m_player2);
v15 = cocos2d::CCPoint::CCPoint(&v39);
cocos2d::CCPoint::CCPoint(*(float *)&v15, v14 * 50.0);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator+)(a2, &v40);
cocos2d::CCPoint::CCPoint(&v33);
cocos2d::CCPoint::CCPoint(&v34);
v16 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v35);
cocos2d::CCPoint::CCPoint(*(float *)&v16, v39.x);
v18 = cocos2d::CCPoint::operator=(&v34, v17);
cocos2d::CCPoint::CCPoint(*(float *)&v18, (float)(v14 * 40.0) + v39.x);
v20 = cocos2d::CCPoint::operator=(&v35, v19);
cocos2d::CCPoint::CCPoint(*(float *)&v20, v40);
cocos2d::CCPoint::operator=(&v33, v21);
v22 = cocos2d::CCBezierTo::create(1.0, (const struct cocos2d::_ccBezierConfig *)&v33);
v23 = cocos2d::CCEaseIn::create(v22, 1.2);
v25 = v23;
if ( v9 )
{
v27 = (struct cocos2d::CCSequence *)v23;
}
else
{
v26 = cocos2d::CCCallFunc::create(a1, PlayLayer::levelComplete);
v27 = cocos2d::CCSequence::create(v25, v26, 0);
}
cocos2d::CCNode::runAction((CCLightFlash *)m_player2, (cocos2d::CCPoint)v27, v24, m_cameraZoom, v31);
v28 = cocos2d::CCRotateBy::create(1.0, 360.0);
v29 = cocos2d::CCEaseIn::create(v28, 1.5);
cocos2d::CCNode::runAction((CCLightFlash *)m_player2, (cocos2d::CCPoint)v29, v30, m_cameraZoom, v32);
++v9;
}
while ( v9 < v10 );
}
}