//
// GJBaseGameLayer::getPortalTarget from 0x1001211a0 to 0x1001212a6 (262 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::teleportPlayer @ 0x100120b59
//
// 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
//
TeleportPortalObject *__fastcall GJBaseGameLayer::getPortalTarget(GJBaseGameLayer *a1, TeleportPortalObject *a2)
{
TeleportPortalObject *result; // rax
int m_targetGroupID; // eax
intptr_t v4; // r14
std::__vector_base::pointer begin; // rax
cocos2d::CCArray *v6; // rbx
int v7; // eax
__m128 v8; // xmm0
result = a2->m_orangePortal;
if ( result )
return result;
m_targetGroupID = a2->m_targetGroupID;
if ( m_targetGroupID <= 0 )
return nullptr;
v4 = 9999;
if ( (unsigned int)m_targetGroupID < 0x270F )
v4 = (unsigned int)m_targetGroupID;
begin = a1->m_groups.__begin_;
v6 = begin[v4];
if ( !v6 )
{
v6 = (cocos2d::CCArray *)sub_10071F9E0(a1, a2);
cocos2d::CCDictionary::setObject(a1->m_groupDict, v6, v4);
a1->m_groups.__begin_[v4] = v6;
v7 = sub_100720070(v6);
if ( v7 > 0 )
goto LABEL_7;
return nullptr;
}
v7 = sub_100720070(begin[v4]);
if ( v7 <= 0 )
return nullptr;
LABEL_7:
v8 = 0;
if ( v7 != 1 )
{
qword_10099F028 = 214013 * qword_10099F028 + 2531011;
v8 = 0;
v8.f32[0] = (float)(WORD1(qword_10099F028) & 0x7FFF) / 32767.0;
}
return (TeleportPortalObject *)sub_1007200C0(
v6,
(unsigned int)(int)(float)((float)v7
* _mm_andnot_ps(_mm_cmpeq_ss((__m128)0x3F800000u, v8), v8).f32[0]));
}