//
// GJBaseGameLayer::teleportPlayer from 0x5b82dc to 0x5b86ec (1040 bytes)
//
// 3 xrefs:
// > PlayerObject::ringJump @ 0x449990
// > EffectGameObject::triggerObject @ 0x4f4e1c
// > GJBaseGameLayer::collisionCheckObjects @ 0x5ba6fe
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:53:40 +0000
//
_DWORD *__fastcall GJBaseGameLayer::teleportPlayer(GJBaseGameLayer *this, TeleportPortalObject *a2, PlayerObject *a3)
{
PlayerObject *v5; // r4
int v6; // r1
_BOOL4 v7; // r10
float v8; // s16
const cocos2d::CCPoint *v9; // r0
PlayerObject *PortalTarget; // r6
const cocos2d::CCPoint *v11; // r0
int v12; // r0
int v13; // r2
unsigned __int8 *v14; // r0
int v15; // r1
int v16; // r3
int v17; // r2
float v18; // s16
float v19; // s16
float v20; // s15
float v21; // s16
const cocos2d::CCPoint *v22; // r0
float v23; // r0
int v24; // r1
int v25; // r2
const cocos2d::CCPoint *v26; // r1
const cocos2d::CCPoint *v27; // r0
float v28; // s16
float v29; // r8
const cocos2d::CCPoint *v30; // r0
int v32; // [sp+20h] [bp-3Ch]
int v33; // [sp+24h] [bp-38h]
int v34; // [sp+28h] [bp-34h]
_BYTE v35[8]; // [sp+2Ch] [bp-30h] BYREF
_BYTE v36[8]; // [sp+34h] [bp-28h] BYREF
_DWORD v37[2]; // [sp+3Ch] [bp-20h] BYREF
_BYTE v38[4]; // [sp+44h] [bp-18h] BYREF
float v39; // [sp+48h] [bp-14h]
_BYTE v40[4]; // [sp+4Ch] [bp-10h] BYREF
float v41; // [sp+50h] [bp-Ch]
v5 = a3;
if ( !a3 )
v5 = *((PlayerObject **)this + 519);
*((_BYTE *)v5 + 1176) = 1;
v6 = *((_DWORD *)a2 + 413);
v7 = *((_DWORD *)a2 + 223) == 3022;
if ( v6 )
{
(*(void (__fastcall **)(_BYTE *))(*(_DWORD *)v6 + 908))(v38);
v8 = v39;
(*(void (__fastcall **)(_BYTE *, TeleportPortalObject *))(*(_DWORD *)a2 + 908))(v40, a2);
*((float *)a2 + 415) = v8 - v41;
}
v9 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(PlayerObject *))(*(_DWORD *)v5 + 96))(v5);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v35, v9);
PortalTarget = (PlayerObject *)GJBaseGameLayer::getPortalTarget(this, a2);
if ( PortalTarget )
{
v11 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(TeleportPortalObject *))(*(_DWORD *)a2 + 96))(a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v40, v11);
cocos2d::CCPoint::operator=((char *)v5 + 2024, v40);
*((_DWORD *)v5 + 525) = a2;
*((_DWORD *)v5 + 614) = 0;
GJBaseGameLayer::getPortalTargetPos((GJBaseGameLayer *)v37, this, a2, PortalTarget, (int)v5);
if ( *((_BYTE *)a2 + 1688) )
{
(*(void (__fastcall **)(_BYTE *, TeleportPortalObject *))(*(_DWORD *)a2 + 680))(v40, a2);
v12 = (*(int (__fastcall **)(PlayerObject *))(*(_DWORD *)v5 + 96))(v5);
cocos2d::CCPoint::operator-(v38, v40, v12);
cocos2d::CCPoint::operator-(v40, v37, v38);
cocos2d::CCPoint::operator=(v37, v40);
}
if ( *((_BYTE *)a2 + 1689) )
v37[0] = *(_DWORD *)(*(int (__fastcall **)(PlayerObject *))(*(_DWORD *)v5 + 96))(v5);
if ( *((_BYTE *)a2 + 1690) )
v37[1] = *(_DWORD *)((*(int (__fastcall **)(PlayerObject *))(*(_DWORD *)v5 + 96))(v5) + 4);
(*(void (__fastcall **)(PlayerObject *, _DWORD *))(*(_DWORD *)v5 + 92))(v5, v37);
}
v13 = *((_DWORD *)a2 + 423);
if ( v13 > 0 )
{
switch ( v13 )
{
case 1:
v14 = (unsigned __int8 *)v5;
v15 = 0;
break;
case 2:
v15 = 1;
v14 = (unsigned __int8 *)v5;
break;
case 3:
v14 = (unsigned __int8 *)v5;
v15 = *((unsigned __int8 *)v5 + 1959) ^ 1;
break;
default:
goto LABEL_21;
}
PlayerObject::flipGravity(v14, v15, 1);
}
LABEL_21:
if ( !v7 )
{
GameObject::playShineEffect(a2);
(*(void (__fastcall **)(TeleportPortalObject *, PlayerObject *))(*(_DWORD *)a2 + 768))(a2, v5);
}
if ( PortalTarget )
{
if ( !*((_BYTE *)a2 + 908) )
{
LOBYTE(v32) = 0;
*(_WORD *)((char *)&v32 + 1) = -1;
PlayerObject::spawnPortalCircle((int)v5, v32, (CCCircleWave *)0x42480000);
}
v16 = *((_DWORD *)PortalTarget + 223);
if ( v16 == 749 )
goto LABEL_33;
if ( v16 > 749 )
{
if ( v16 == 2064 )
goto LABEL_33;
v17 = 2902;
}
else
{
if ( v16 == 38 )
goto LABEL_33;
v17 = 747;
}
if ( v16 != v17 )
{
v18 = 90.0;
goto LABEL_35;
}
LABEL_33:
v18 = 180.0;
LABEL_35:
v19 = v18 - COERCE_FLOAT((*(int (__fastcall **)(PlayerObject *))(*(_DWORD *)PortalTarget + 192))(PortalTarget));
v20 = 180.0;
if ( !(*(int (__fastcall **)(PlayerObject *))(*(_DWORD *)PortalTarget + 712))(PortalTarget) )
v20 = 0.0;
v21 = v19 + v20;
v22 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(PlayerObject *))(*(_DWORD *)PortalTarget + 96))(PortalTarget);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v40, v22);
cocos2d::CCPoint::operator=((char *)v5 + 2024, v40);
*((_DWORD *)v5 + 525) = PortalTarget;
GameObject::playShineEffect(PortalTarget);
if ( !*((_BYTE *)a2 + 908) )
{
BYTE2(v33) = *((_BYTE *)a2 + 908);
LOWORD(v33) = -14081;
PlayerObject::spawnPortalCircle((int)v5, v33, (CCCircleWave *)0x42480000);
}
v23 = COERCE_FLOAT(PlayerObject::resetStreak((cocos2d::CCMotionStreak **)v5));
if ( *((_BYTE *)v5 + 1956) )
v23 = COERCE_FLOAT(PlayerObject::placeStreakPoint(v5, v24, v25, *((unsigned __int8 *)v5 + 1956)));
if ( !*((_BYTE *)a2 + 908) )
{
if ( v7 )
v26 = (const cocos2d::CCPoint *)v35;
else
v26 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(TeleportPortalObject *))(*(_DWORD *)a2 + 96))(a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v36, v26);
if ( v7 )
v27 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(PlayerObject *))(*(_DWORD *)v5 + 96))(v5);
else
v27 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(PlayerObject *))(*(_DWORD *)PortalTarget + 96))(PortalTarget);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v37, v27);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v38, (const cocos2d::CCPoint *)v36);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v40, (const cocos2d::CCPoint *)v37);
BYTE2(v34) = *((_BYTE *)v5 + 2108);
LOWORD(v34) = *((_WORD *)v5 + 1053);
v23 = COERCE_FLOAT(
GJBaseGameLayer::lightningFlash(
(int)this,
(int)v38,
(int)v40,
v34,
1082130432,
1045220557,
100,
1,
1065353216));
}
goto LABEL_52;
}
v28 = 0.0;
if ( (*(int (__fastcall **)(TeleportPortalObject *))(*(_DWORD *)a2 + 712))(a2) )
v28 = 180.0;
v23 = (*(float (__fastcall **)(TeleportPortalObject *))(*(_DWORD *)a2 + 192))(a2);
v21 = v28 - v23;
LABEL_52:
if ( *((_BYTE *)a2 + 1664) )
*((_DWORD *)this + 246) = 1056964608;
cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v23));
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v38);
if ( *((_BYTE *)a2 + 1664) )
v29 = 180.0;
else
v29 = 60.0;
if ( PortalTarget )
PlayerObject::playerTeleported(v5);
if ( *((_BYTE *)a2 + 1672) )
{
PlayerObject::redirectPlayerForce(v5, v21, *((float *)a2 + 419), *((float *)a2 + 420), *((float *)a2 + 421));
}
else if ( *((_BYTE *)a2 + 1665) )
{
PlayerObject::updateStaticForce(v5, v21, *((float *)a2 + 417), *((unsigned __int8 *)a2 + 1696));
}
if ( *((_BYTE *)a2 + 1697) )
{
*((_BYTE *)this + 1280) = 1;
*((_BYTE *)this + 1281) = 1;
}
if ( *((_BYTE *)a2 + 1698) )
{
v30 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(PlayerObject *))(*(_DWORD *)v5 + 96))(v5);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v40, v30);
cocos2d::CCPoint::operator=((char *)v5 + 2068, v40);
}
if ( *((_BYTE *)v5 + 1996) && *((_BYTE *)a2 + 1699) )
PlayerObject::redirectDash((int)v5, v21);
if ( PortalTarget )
GJBaseGameLayer::checkCameraLimitAfterTeleport((float *)this, v5, v29);
return GJBaseGameLayer::gameEventTriggered((int **)this, 25, 0, 0);
}