//
// GJBaseGameLayer::getPortalTarget from 0x590818 to 0x5908ba (162 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::teleportPlayer @ 0x5b8362
//
// 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:05 +0000
//
int __fastcall GJBaseGameLayer::getPortalTarget(GJBaseGameLayer *this, TeleportPortalObject *a2)
{
int v2; // r1
cocos2d::CCObject *Group; // r6
int v5; // r0
unsigned int v6; // r2
float v7; // s15
if ( *((_DWORD *)a2 + 413) )
return *((_DWORD *)a2 + 413);
v2 = *((_DWORD *)a2 + 321);
if ( v2 <= 0 )
return 0;
Group = GJBaseGameLayer::getGroup(this, v2);
v5 = cocos2d::CCArray::count(Group);
if ( v5 <= 0 )
return 0;
if ( v5 == 1 )
{
v7 = 0.0;
}
else
{
v6 = (unsigned int)(214013 * qword_D2C3F8 + 2531011) >> 16;
qword_D2C3F8 = 214013 * qword_D2C3F8 + 2531011;
v7 = (float)(v6 & 0x7FFF) / 32767.0;
if ( v7 == 1.0 )
v7 = 0.0;
}
return cocos2d::CCArray::objectAtIndex(Group, (int)(float)((float)v5 * v7));
}