//
// GJBaseGameLayer::getPortalTarget from 0x85d340 to 0x85d3f0 (176 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::teleportPlayer @ 0x889c24
// > ??> @ 0x62da8
//
// 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 *GJBaseGameLayer::getPortalTarget(GJBaseGameLayer *a1, TeleportPortalObject *a2)
{
TeleportPortalObject *m_orangePortal; // x2
int m_targetGroupID; // w1
cocos2d::CCArray *Group; // x19
int v6; // w0
float v7; // s0
m_orangePortal = a2->m_orangePortal;
if ( m_orangePortal )
return m_orangePortal;
m_targetGroupID = a2->m_targetGroupID;
if ( m_targetGroupID <= 0 )
return nullptr;
Group = GJBaseGameLayer::getGroup(a1, m_targetGroupID);
v6 = cocos2d::CCArray::count(Group);
if ( v6 <= 0 )
return nullptr;
if ( v6 == 1
|| (qword_1242DA0 = 214013 * qword_1242DA0 + 2531011,
v7 = (float)(((unsigned __int64)qword_1242DA0 >> 16) & 0x7FFF) / 32767.0,
v7 == 1.0) )
{
v7 = 0.0;
}
return (TeleportPortalObject *)cocos2d::CCArray::objectAtIndex(Group, (int)(float)((float)v6 * v7));
}