//
// GJBaseGameLayer::getPortalTarget from 0x1000fd4b0 to 0x1000fd5b6 (262 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::teleportPlayer @ 0x1000fce69
//
// 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 12:21:19 +0000
//
__int64 __fastcall GJBaseGameLayer::getPortalTarget(__int64 a1, __int64 a2)
{
__int64 result; // rax
int v3; // eax
__int64 v4; // r14
__int64 v5; // rax
__int64 v6; // rbx
int v7; // eax
__m128 v8; // xmm0
result = *(_QWORD *)(a2 + 1848);
if ( result )
return result;
v3 = *(_DWORD *)(a2 + 1464);
if ( v3 <= 0 )
return 0;
v4 = 9999;
if ( (unsigned int)v3 < 0x270F )
v4 = (unsigned int)v3;
v5 = *(_QWORD *)(a1 + 3616);
v6 = *(_QWORD *)(v5 + 8 * v4);
if ( !v6 )
{
v6 = sub_1007FE900(a1);
cocos2d::CCDictionary::setObject_1(*(_QWORD *)(a1 + 3592), v6, v4);
*(_QWORD *)(*(_QWORD *)(a1 + 3616) + 8 * v4) = v6;
v7 = sub_1007FEF90(v6);
if ( v7 > 0 )
goto LABEL_7;
return 0;
}
v7 = sub_1007FEF90(*(_QWORD *)(v5 + 8 * v4));
if ( v7 <= 0 )
return 0;
LABEL_7:
v8 = 0;
if ( v7 != 1 )
{
qword_100BE12A0 = 214013 * qword_100BE12A0 + 2531011;
v8 = 0;
v8.f32[0] = (float)(WORD1(qword_100BE12A0) & 0x7FFF) / 32767.0;
}
return sub_1007FEFE0(
v6,
(unsigned int)(int)(float)((float)v7 * _mm_andnot_ps(_mm_cmpeq_ss((__m128)0x3F800000u, v8), v8).f32[0]));
}