//
// GJBaseGameLayer::teleportPlayer from 0x9e597c to 0x9e5f70 (1524 bytes)
//
// 4 xrefs:
// > PlayerObject::ringJump @ 0x76a4d4
// > EffectGameObject::triggerObject @ 0x898624
// > GJBaseGameLayer::collisionCheckObjects @ 0x9e8ca0
// > ??> @ 0x5b2b8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:58:59 +0000
//
__int64 __fastcall GJBaseGameLayer::teleportPlayer(GJBaseGameLayer *this, TeleportPortalObject *a2, PlayerObject *a3)
{
PlayerObject *v4; // x20
__int64 v6; // x0
_BOOL4 v7; // w25
float v8; // s8
const cocos2d::CCPoint *v9; // x0
GameObject *PortalTarget; // x21
const cocos2d::CCPoint *v11; // x0
int v12; // w2
int v13; // w0
float v14; // s8
float v15; // s8
char v16; // w0
float v17; // s1
float v18; // s8
const cocos2d::CCPoint *v19; // x0
const cocos2d::CCPoint *v20; // x0
long double v21; // q0
cocos2d::CCDirector *v22; // x0
cocos2d::CCDirector *v23; // x0
float v24; // s9
__int64 v26; // x0
long double v27; // q0
long double v28; // q0
const cocos2d::CCPoint *v29; // x0
const cocos2d::CCPoint *v30; // x0
float v31; // s8
int v32; // [xsp+78h] [xbp+78h]
int v33; // [xsp+80h] [xbp+80h]
__int64 v34; // [xsp+88h] [xbp+88h]
_BYTE v35[8]; // [xsp+90h] [xbp+90h] BYREF
_BYTE v36[8]; // [xsp+98h] [xbp+98h] BYREF
_DWORD v37[2]; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v38; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v39; // [xsp+B0h] [xbp+B0h] BYREF
v4 = a3;
if ( !a3 )
v4 = *((PlayerObject **)this + 407);
*((_BYTE *)v4 + 1368) = 1;
v6 = *((_QWORD *)a2 + 231);
v7 = *((_DWORD *)a2 + 257) == 3022;
if ( v6 )
{
(*(void (__fastcall **)(__int64 *__return_ptr))(*(_QWORD *)v6 + 1816LL))(&v38);
v8 = *((float *)&v38 + 1);
(*(void (__fastcall **)(__int64 *__return_ptr, TeleportPortalObject *))(*(_QWORD *)a2 + 1816LL))(&v39, a2);
*((float *)a2 + 465) = v8 - *((float *)&v39 + 1);
}
v9 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(PlayerObject *))(*(_QWORD *)v4 + 192LL))(v4);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v35, v9);
PortalTarget = (GameObject *)GJBaseGameLayer::getPortalTarget(this, a2);
if ( PortalTarget )
{
v11 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(TeleportPortalObject *))(*(_QWORD *)a2 + 192LL))(a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v39, v11);
cocos2d::CCPoint::operator=((char *)v4 + 2488, &v39);
*((_QWORD *)v4 + 324) = a2;
*((_DWORD *)v4 + 761) = 0;
GJBaseGameLayer::getPortalTargetPos(a2, PortalTarget, v4, (cocos2d::CCPoint *)v37);
if ( *((_BYTE *)a2 + 1888) )
{
(*(void (__fastcall **)(TeleportPortalObject *))(*(_QWORD *)a2 + 1360LL))(a2);
v26 = (*(__int64 (__fastcall **)(PlayerObject *))(*(_QWORD *)v4 + 192LL))(v4);
cocos2d::CCPoint::operator-(&v38, &v39, v26, v27);
cocos2d::CCPoint::operator-(&v39, v37, &v38, v28);
cocos2d::CCPoint::operator=(v37, &v39);
if ( !*((_BYTE *)a2 + 1889) )
{
LABEL_8:
if ( !*((_BYTE *)a2 + 1890) )
{
LABEL_9:
(*(void (__fastcall **)(PlayerObject *, _DWORD *))(*(_QWORD *)v4 + 184LL))(v4, v37);
goto LABEL_10;
}
LABEL_56:
v37[1] = *(_DWORD *)((*(__int64 (__fastcall **)(PlayerObject *))(*(_QWORD *)v4 + 192LL))(v4) + 4);
goto LABEL_9;
}
}
else if ( !*((_BYTE *)a2 + 1889) )
{
goto LABEL_8;
}
v37[0] = *(_DWORD *)(*(__int64 (__fastcall **)(PlayerObject *))(*(_QWORD *)v4 + 192LL))(v4);
if ( !*((_BYTE *)a2 + 1890) )
goto LABEL_9;
goto LABEL_56;
}
LABEL_10:
v12 = *((_DWORD *)a2 + 473);
if ( v12 <= 0 )
goto LABEL_14;
switch ( v12 )
{
case 1:
PlayerObject::flipGravity((__int64)v4, 0, 1u);
if ( !v7 )
goto LABEL_55;
break;
case 2:
PlayerObject::flipGravity((__int64)v4, 1u, 1u);
if ( !v7 )
goto LABEL_55;
break;
case 3:
PlayerObject::flipGravity((__int64)v4, *((_BYTE *)v4 + 2423) ^ 1, 1u);
if ( !v7 )
{
LABEL_55:
GameObject::playShineEffect(a2);
(*(void (__fastcall **)(TeleportPortalObject *, PlayerObject *))(*(_QWORD *)a2 + 1536LL))(a2, v4);
}
break;
default:
LABEL_14:
if ( v7 )
break;
goto LABEL_55;
}
if ( PortalTarget )
{
if ( !*((_BYTE *)a2 + 1044) )
{
LOWORD(v32) = -256;
BYTE2(v32) = -1;
PlayerObject::spawnPortalCircle((__int64)v4, v32, 50.0);
}
v13 = *((_DWORD *)PortalTarget + 257);
if ( v13 != 749 )
{
if ( v13 <= 749 )
{
if ( v13 != 38 && v13 != 747 )
goto LABEL_22;
}
else if ( v13 != 2064 && v13 != 2902 )
{
LABEL_22:
v14 = 90.0;
LABEL_23:
v15 = v14 - (*(float (__fastcall **)(GameObject *))(*(_QWORD *)PortalTarget + 384LL))(PortalTarget);
v16 = (*(__int64 (__fastcall **)(GameObject *))(*(_QWORD *)PortalTarget + 1424LL))(PortalTarget);
v17 = 0.0;
if ( v16 )
v17 = 180.0;
v18 = v15 + v17;
v19 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(GameObject *))(*(_QWORD *)PortalTarget + 192LL))(PortalTarget);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v39, v19);
cocos2d::CCPoint::operator=((char *)v4 + 2488, &v39);
*((_QWORD *)v4 + 324) = PortalTarget;
GameObject::playShineEffect(PortalTarget);
if ( !*((_BYTE *)a2 + 1044) )
{
LOWORD(v33) = -14081;
BYTE2(v33) = 0;
PlayerObject::spawnPortalCircle((__int64)v4, v33, 50.0);
}
PlayerObject::resetStreak((cocos2d::CCMotionStreak **)v4);
if ( *((_BYTE *)v4 + 2420) )
PlayerObject::placeStreakPoint(v4);
if ( !*((_BYTE *)a2 + 1044) )
{
if ( v7 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v36, (const cocos2d::CCPoint *)v35);
v20 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(PlayerObject *))(*(_QWORD *)v4 + 192LL))(v4);
}
else
{
v30 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(TeleportPortalObject *))(*(_QWORD *)a2 + 192LL))(a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v36, v30);
v20 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(GameObject *))(*(_QWORD *)PortalTarget + 192LL))(PortalTarget);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v37, v20);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v38, (const cocos2d::CCPoint *)v36);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v39, (const cocos2d::CCPoint *)v37);
LOWORD(v34) = *((_WORD *)v4 + 1301);
BYTE2(v34) = *((_BYTE *)v4 + 2604);
LODWORD(v21) = 4.0;
GJBaseGameLayer::lightningFlash((__int64)this, (__int64)&v38, (__int64)&v39, v34, 100, 1u, v21, 0.2, 1.0);
}
goto LABEL_33;
}
}
v14 = 180.0;
goto LABEL_23;
}
v31 = 0.0;
if ( (*(unsigned __int8 (__fastcall **)(TeleportPortalObject *))(*(_QWORD *)a2 + 1424LL))(a2) )
v31 = 180.0;
v18 = v31 - (*(float (__fastcall **)(TeleportPortalObject *))(*(_QWORD *)a2 + 384LL))(a2);
LABEL_33:
v22 = (cocos2d::CCDirector *)*((unsigned __int8 *)a2 + 1864);
if ( *((_BYTE *)a2 + 1864) )
*((float *)this + 298) = 0.5;
v23 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v22);
cocos2d::CCDirector::getWinSize(&v38, v23);
if ( *((_BYTE *)a2 + 1864) )
v24 = 180.0;
else
v24 = 60.0;
if ( PortalTarget )
PlayerObject::playerTeleported(v4);
if ( *((_BYTE *)a2 + 1872) )
{
PlayerObject::redirectPlayerForce(v4, v18, *((float *)a2 + 469), *((float *)a2 + 470), *((float *)a2 + 471));
}
else if ( *((_BYTE *)a2 + 1865) )
{
PlayerObject::updateStaticForce(v4, v18, *((float *)a2 + 467), *((_BYTE *)a2 + 1896));
}
if ( *((_BYTE *)a2 + 1897) )
{
*((_BYTE *)this + 1720) = 1;
*((_BYTE *)this + 1721) = 1;
}
if ( *((_BYTE *)a2 + 1898) )
{
v29 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(PlayerObject *))(*(_QWORD *)v4 + 192LL))(v4);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v39, v29);
cocos2d::CCPoint::operator=((char *)v4 + 2532, &v39);
}
if ( *((_BYTE *)v4 + 2460) && *((_BYTE *)a2 + 1899) )
PlayerObject::redirectDash(v4, v18);
if ( PortalTarget )
GJBaseGameLayer::checkCameraLimitAfterTeleport(this, v4, v24);
GJBaseGameLayer::gameEventTriggered((__int64)this, 0x19u, 0, 0);
return _stack_chk_guard;
}