//
// GJBaseGameLayer::teleportPlayer from 0x140315f20 to 0x1403169bf (2719 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::collisionCheckObjects @ 0x14031c902
// > PlayerObject::ringJump @ 0x1404f71f5
// > EffectGameObject::triggerObject @ 0x140648eba
// > ??> @ 0x14091e998
//
// This function is hookable on this platform (idp: pc, 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 11:30:18 +0000
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall GJBaseGameLayer::teleportPlayer(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v3; // rdi
int v6; // r13d
__int64 v7; // rcx
__int64 v8; // rbx
float *v9; // r12
const struct cocos2d::CCPoint *v10; // rax
cocos2d::CCArray **v11; // r14
__int64 v12; // rdx
cocos2d::CCArray *Group; // rbx
int v14; // eax
float v15; // xmm1_4
const struct cocos2d::CCPoint *v16; // rax
__int64 v17; // rax
float v18; // xmm6_4
float v19; // xmm6_4
float *v20; // rax
__int64 v21; // rbx
__int64 v22; // rax
int v23; // eax
_BYTE *v24; // r12
_BYTE *v25; // r13
const struct cocos2d::CCPoint *v26; // rax
__int64 v27; // rax
__int64 v28; // rcx
const struct cocos2d::CCPoint *v29; // rax
__int64 v30; // rax
cocos2d::CCArray *v31; // rax
cocos2d::CCArray **v32; // rcx
const struct cocos2d::CCPoint *v33; // rax
const struct cocos2d::CCPoint *v34; // rax
__int64 v35; // rax
__int64 v36; // rbx
__int64 v37; // rax
__int64 v38; // r12
__int64 v39; // rdx
__int64 v40; // rcx
const struct cocos2d::CCPoint *v41; // rax
const struct cocos2d::CCPoint *v42; // rbx
const struct cocos2d::CCPoint *v43; // rax
cocos2d::CCObject *v44; // rbx
__int64 v45; // rbx
struct cocos2d::CCFiniteTimeAction *v46; // rax
struct cocos2d::CCAction *v47; // rax
__int64 v48; // rax
int v49; // edx
int v50; // r8d
int v51; // r9d
const struct cocos2d::CCPoint *v52; // rax
__int64 v53; // rax
char v54; // bl
float v55; // xmm1_4
float v56; // xmm0_4
float v57; // xmm1_4
float *v58; // rax
double v59; // xmm0_8
double v60; // xmm0_8
const struct cocos2d::CCPoint *v61; // rax
__int64 v62; // rax
float v63; // xmm7_4
float v64; // xmm8_4
double v65; // xmm0_8
float v66; // xmm9_4
float v67; // xmm6_4
float v68; // xmm0_4
__int64 v69; // rax
int v70; // eax
unsigned __int8 v71; // r8
int v72; // ecx
__int64 v73; // rdx
int v74; // ecx
int v75; // eax
float v76; // xmm0_4
_BYTE v78[8]; // [rsp+38h] [rbp-79h] BYREF
_BYTE v79[8]; // [rsp+40h] [rbp-71h] BYREF
_BYTE v80[8]; // [rsp+48h] [rbp-69h] BYREF
_BYTE v81[8]; // [rsp+50h] [rbp-61h] BYREF
void *v82; // [rsp+58h] [rbp-59h] BYREF
_BYTE v83[8]; // [rsp+60h] [rbp-51h] BYREF
_BYTE v84[8]; // [rsp+68h] [rbp-49h] BYREF
float X; // [rsp+120h] [rbp+6Fh] BYREF
float Y; // [rsp+124h] [rbp+73h]
__int16 v87; // [rsp+128h] [rbp+77h] BYREF
char v88; // [rsp+12Ah] [rbp+79h]
int v89; // [rsp+130h] [rbp+7Fh] BYREF
v3 = a3;
if ( !a3 )
v3 = *(_QWORD *)(a1 + 3512);
*(_BYTE *)(v3 + 1376) = 1;
v6 = *(_DWORD *)(a2 + 1036);
v89 = v6;
v7 = *(_QWORD *)(a2 + 1864);
if ( v7 )
{
v8 = (*(__int64 (__fastcall **)(__int64, float *))(*(_QWORD *)v7 + 1664LL))(v7, &X);
v9 = (float *)(a2 + 1876);
*(float *)(a2 + 1876) = *(float *)(v8 + 4)
- *(float *)((*(__int64 (__fastcall **)(__int64, __int16 *))(*(_QWORD *)a2 + 1664LL))(
a2,
&v87)
+ 4);
}
else
{
v9 = (float *)(a2 + 1876);
}
v10 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 200LL))(v3);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v79, v10);
v11 = *(cocos2d::CCArray ***)(a2 + 1864);
if ( v11 )
goto LABEL_13;
v12 = *(unsigned int *)(a2 + 1480);
if ( (int)v12 <= 0
|| (Group = (cocos2d::CCArray *)GJBaseGameLayer::getGroup(a1, v12), v14 = cocos2d::CCArray::count(Group), v14 <= 0) )
{
v11 = nullptr;
goto LABEL_24;
}
if ( v14 == 1
|| (qword_14090BFF0 = 214013 * qword_14090BFF0 + 2531011,
v15 = (float)(((unsigned __int64)qword_14090BFF0 >> 16) & 0x7FFF) / 32767.0,
v15 == 1.0) )
{
v15 = 0.0;
}
v11 = (cocos2d::CCArray **)cocos2d::CCArray::objectAtIndex(Group, (int)(float)((float)v14 * v15));
v9 = (float *)(a2 + 1876);
if ( v11 )
{
LABEL_13:
v16 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 200LL))(a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v87, v16);
cocos2d::CCPoint::operator=(v3 + 2568, v17);
*(_QWORD *)(v3 + 2696) = a2;
*(_DWORD *)(v3 + 3140) = 0;
if ( *(_DWORD *)(a2 + 1036) == 747 )
{
v18 = *v9;
v19 = v18 + *(float *)((*(__int64 (__fastcall **)(__int64, __int16 *))(*(_QWORD *)a2 + 1208LL))(a2, &v87) + 4);
v20 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 200LL))(v3);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&X, *v20, v19);
}
else
{
(*((void (__fastcall **)(cocos2d::CCArray **, float *))*v11 + 151))(v11, &X);
}
if ( *(_BYTE *)(a2 + 1904) )
{
v21 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 200LL))(v3);
v22 = (*(__int64 (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)a2 + 1208LL))(a2, v78);
cocos2d::CCPoint::operator-(v22, &v87, v21);
cocos2d::CCPoint::operator-(&X, v78, &v87);
cocos2d::CCPoint::operator=(&X, v78);
}
if ( *(_BYTE *)(a2 + 1905) )
X = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 200LL))(v3);
if ( *(_BYTE *)(a2 + 1906) )
Y = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 200LL))(v3) + 4);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v3 + 184LL))(v3, &X);
}
LABEL_24:
v23 = *(_DWORD *)(a2 + 1908);
if ( v23 <= 0 )
goto LABEL_32;
switch ( v23 )
{
case 1:
v12 = 0;
break;
case 2:
v12 = 1;
break;
case 3:
LOBYTE(v12) = *(_BYTE *)(v3 + 2503) == 0;
break;
default:
goto LABEL_32;
}
PlayerObject::flipGravity(v3, v12);
LABEL_32:
if ( v6 != 3022 )
{
GameObject::playShineEffect((cocos2d::CCArray **)a2);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a2 + 1384LL))(a2, v3);
}
if ( v11 )
{
v24 = (_BYTE *)(a2 + 1052);
if ( !*(_BYTE *)(a2 + 1052) )
{
LOWORD(X) = -256;
v87 = -256;
v88 = -1;
PlayerObject::spawnPortalCircle(v3, &v87);
}
v25 = (_BYTE *)(a2 + 1052);
if ( *((_DWORD *)v11 + 259) == 38
|| *((_DWORD *)v11 + 259) == 747
|| *((_DWORD *)v11 + 259) == 749
|| *((_DWORD *)v11 + 259) == 2064
|| *((_DWORD *)v11 + 259) == 2902 )
{
v25 = (_BYTE *)(a2 + 1052);
}
(*((void (__fastcall **)(cocos2d::CCArray **))*v11 + 159))(v11);
(*((float (__fastcall **)(cocos2d::CCArray **))*v11 + 47))(v11);
v26 = (const struct cocos2d::CCPoint *)(*((__int64 (__fastcall **)(cocos2d::CCArray **))*v11 + 25))(v11);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&X, v26);
cocos2d::CCPoint::operator=(v3 + 2568, v27);
*(_QWORD *)(v3 + 2696) = v11;
GameObject::playShineEffect(v11);
if ( !*v24 )
{
LOWORD(X) = -14081;
v87 = -14081;
v88 = 0;
PlayerObject::spawnPortalCircle(v3, &v87);
v24 = v25;
}
PlayerObject::resetStreak(v3);
if ( *(_BYTE *)(v3 + 2500) )
{
v29 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 200LL))(v3);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&X, v29);
PlayerObject::placeStreakPoint(v3, v30);
}
if ( !*v24 )
{
if ( v89 == 3022 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&X, (const struct cocos2d::CCPoint *)v79);
v31 = *(cocos2d::CCArray **)v3;
v32 = (cocos2d::CCArray **)v3;
}
else
{
v33 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 200LL))(a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&X, v33);
v31 = *v11;
v32 = v11;
}
v34 = (const struct cocos2d::CCPoint *)(*((__int64 (__fastcall **)(cocos2d::CCArray **))v31 + 25))(v32);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v89, v34);
v87 = *(_WORD *)(v3 + 2706);
v88 = *(_BYTE *)(v3 + 2708);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v80, (const struct cocos2d::CCPoint *)&v89);
v36 = v35;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v81, (const struct cocos2d::CCPoint *)&X);
v38 = v37;
cocos2d::CCPoint::operator-(v36, v78, v37);
v40 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v82 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v82);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v40 = qword_14090BFD0;
}
if ( !*(_BYTE *)(v40 + 957) )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v82, (const struct cocos2d::CCPoint *)&dword_14090AA70);
v42 = v41;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v83, (const struct cocos2d::CCPoint *)v78);
v44 = cocos2d::CCLightning::lightningWithStrikePoint(v43, v42);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v44 + 184LL))(v44, v38);
(**((void (__fastcall ***)(__int64, __int16 *))v44 + 40))((__int64)v44 + 320, &v87);
*((_DWORD *)v44 + 92) = 1082130432;
*((_WORD *)v44 + 186) = 257;
*((_DWORD *)v44 + 95) = 1065353216;
*((_DWORD *)v44 + 87) = 100;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *, _QWORD))(**(_QWORD **)(a1 + 4296) + 456LL))(
*(_QWORD *)(a1 + 4296),
v44,
0);
}
LOBYTE(v39) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 13032) + 336LL))(*(_QWORD *)(a1 + 13032), v39);
v45 = cocos2d::CCHide::create();
v46 = cocos2d::CCDelayTime::create(0.079999998);
v47 = cocos2d::CCSequence::create(v46, v45, 0);
cocos2d::CCNode::runAction(*(cocos2d::CCNode **)(a1 + 13032), v47);
}
}
else
{
(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 1272LL))(a2);
(*(float (__fastcall **)(__int64))(*(_QWORD *)a2 + 376LL))(a2);
}
if ( *(_BYTE *)(a2 + 1880) )
*(_DWORD *)(a1 + 1280) = 1056964608;
v48 = cocos2d::CCDirector::sharedDirector(v28);
cocos2d::CCDirector::getWinSize(v48, v84);
if ( v11 )
{
*(_BYTE *)(v3 + 2580) = 0;
cocos2d::CCPoint::operator=(v3 + 2612, &unk_14090B428);
v52 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 200LL))(v3);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&X, v52);
PlayerObject::placeStreakPoint(v3, v53);
}
if ( *(_BYTE *)(a2 + 1888) )
{
PlayerObject::redirectPlayerForce(v3, v49, v50, v51, *(_DWORD *)(a2 + 1900));
}
else if ( *(_BYTE *)(a2 + 1881) )
{
v54 = *(_BYTE *)(a2 + 1912);
if ( *(float *)(a2 + 1884) != 0.0 || v54 )
{
cocos2d::ccpForAngle(&X);
v55 = (float)(Y * Y) + (float)(X * X);
if ( v55 < 0.0 )
v56 = sqrtf(v55);
else
v56 = fsqrt(v55);
if ( v56 > 0.0 )
{
cocos2d::CCPoint::operator*(&X, &v87);
cocos2d::CCPoint::operator=(&X, &v87);
if ( *(_BYTE *)(v3 + 2507) )
{
v57 = X;
X = Y;
Y = v57;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v87, (const struct cocos2d::CCPoint *)&X);
*(_BYTE *)(v3 + 2394) = 1;
v59 = v58[1];
if ( v54 )
v59 = v59 + *(double *)(v3 + 2472);
*(double *)(v3 + 2472) = v59;
if ( *(_BYTE *)(v3 + 2936) )
{
v60 = *v58;
if ( v54 )
v60 = v60 + *(double *)(v3 + 2816);
*(double *)(v3 + 2816) = v60;
*(_BYTE *)(v3 + 2972) = 1;
}
}
}
else
{
*(_BYTE *)(v3 + 2394) = 0;
*(_QWORD *)(v3 + 2472) = 0;
if ( *(_BYTE *)(v3 + 2936) )
{
*(_QWORD *)(v3 + 2816) = 0;
*(_BYTE *)(v3 + 2972) = 0;
}
}
}
if ( *(_BYTE *)(a2 + 1913) )
*(_WORD *)(a1 + 1888) = 257;
if ( *(_BYTE *)(a2 + 1914) )
{
v61 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 200LL))(v3);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&X, v61);
cocos2d::CCPoint::operator=(v3 + 2612, v62);
}
if ( *(_BYTE *)(v3 + 2540) && *(_BYTE *)(a2 + 1915) )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&X, *(double *)(v3 + 1392), *(double *)(v3 + 1400));
v63 = X;
v64 = Y;
atan2f(Y, X);
v65 = GJBaseGameLayer::convertToClosestDirection();
v66 = *(float *)&v65;
if ( *(float *)&v65 != 0.0 )
{
v67 = cosf(*(float *)&v65);
v68 = sinf(v66);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v87,
(float)(v67 * v63) - (float)(v68 * v64),
(float)(v68 * v63) + (float)(v67 * v64));
cocos2d::CCPoint::operator=(&X, v69);
v64 = Y;
v63 = X;
}
v70 = (int)(float)-(float)(atan2f(v64, v63) * 57.29578);
v71 = *(_BYTE *)(v3 + 2507);
v72 = v70 - 90;
if ( !v71 )
v72 = v70;
v73 = (unsigned int)(v72 / 360);
v74 = v72 % 360;
v75 = v74 + 360;
if ( v74 >= 0 )
v75 = v74;
*(double *)(v3 + 1408) = (double)-v75;
if ( v71 )
{
v76 = v63;
v63 = v64;
X = v64;
v64 = v76;
Y = v76;
}
*(double *)(v3 + 1392) = v63;
*(double *)(v3 + 1400) = v64;
if ( v63 >= 0.0 )
{
if ( v63 <= 0.0 )
{
LABEL_99:
PlayerObject::updateDashArt(v3);
goto LABEL_100;
}
v73 = v71;
}
else
{
LOBYTE(v73) = v71 == 0;
}
PlayerObject::doReversePlayer(v3, v73);
goto LABEL_99;
}
LABEL_100:
if ( v11 )
GJBaseGameLayer::checkCameraLimitAfterTeleport(a1, v3);
return GJBaseGameLayer::gameEventTriggered(a1, 25, 0, 0);
}