//
// GJBaseGameLayer::getSavedPosition from 0x5a7410 to 0x5a75f8 (488 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::processAdvancedFollowAction @ 0x5bb9c6
//
// 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:21 +0000
//
GJBaseGameLayer *__fastcall GJBaseGameLayer::getSavedPosition(
GJBaseGameLayer *this,
GJBaseGameLayer *a2,
int a3,
float a4)
{
GJBaseGameLayer *v4; // r6
int v7; // r0
const cocos2d::CCPoint *v8; // r1
int v9; // r0
double v10; // d7
float v11; // s16
int v12; // r7
int v13; // r3
int v14; // r5
int MainObject; // r0
int *v16; // r0
int v17; // r9
float v18; // s16
int v19; // r1
int v20; // r3
int v21; // r1
int v22; // r9
int v24; // [sp+0h] [bp-30h] BYREF
_BYTE v25[8]; // [sp+4h] [bp-2Ch] BYREF
_BYTE v26[8]; // [sp+Ch] [bp-24h] BYREF
_BYTE v27[8]; // [sp+14h] [bp-1Ch] BYREF
_BYTE v28[8]; // [sp+1Ch] [bp-14h] BYREF
_BYTE v29[8]; // [sp+24h] [bp-Ch] BYREF
v4 = this;
if ( a4 > 0.0 )
{
v10 = a4 / 0.00416666667 - (float)((float)(unsigned int)(*((_DWORD *)a2 + 207) - *((_DWORD *)a2 + 206)) / 1000.0);
if ( v10 <= 0.0 )
v11 = 0.0;
else
v11 = v10;
v12 = (int)ceilf(v11);
if ( v12 >= *((_DWORD *)a2 + 236) )
{
this = v4;
LABEL_34:
v8 = (const cocos2d::CCPoint *)&unk_D2C400;
goto LABEL_35;
}
v24 = a3;
if ( *(float *)&a3 == NAN )
{
v13 = *((_DWORD *)a2 + 519);
}
else
{
if ( *(float *)&a3 != NAN )
{
if ( *(float *)&a3 == NAN )
{
v14 = *((_DWORD *)a2 + 237);
}
else
{
MainObject = GJBaseGameLayer::tryGetMainObject((cocos2d::CCDictionary **)a2, a3);
if ( !MainObject )
{
LABEL_33:
this = v4;
goto LABEL_34;
}
v14 = *(_DWORD *)(MainObject + 1160);
v24 = *(_DWORD *)(MainObject + 780);
}
LABEL_25:
if ( v14 >= 0 )
{
if ( std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
(_DWORD *)a2 + 2803,
(unsigned int *)&v24) )
{
v16 = std::unordered_map::operator[]((int)a2 + 11212, (unsigned int *)&v24);
v17 = *v16;
v18 = (float)v12 - v11;
v19 = *((_DWORD *)a2 + 236) % *v16 - v12;
if ( v19 < 0 )
v19 += v17;
v20 = v19 + 1;
v21 = v19 + v14;
if ( v20 >= v17 )
v20 = 0;
v22 = v20 + v14;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v25,
*(float *)(*((_DWORD *)a2 + 232) + 8 * v21),
*(float *)(*((_DWORD *)a2 + 232) + 8 * v21 + 4));
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v26,
*(float *)(*((_DWORD *)a2 + 232) + 8 * v22),
*(float *)(*((_DWORD *)a2 + 232) + 8 * v22 + 4));
cocos2d::CCPoint::operator-(v27, v26, v25);
cocos2d::CCPoint::operator*(v29, v27, LODWORD(v18));
cocos2d::CCPoint::operator+(v28, v25, v29);
this = v4;
v8 = (const cocos2d::CCPoint *)v28;
goto LABEL_35;
}
this = v4;
goto LABEL_34;
}
goto LABEL_33;
}
v13 = *((_DWORD *)a2 + 520);
}
v14 = *(_DWORD *)(v13 + 1160);
goto LABEL_25;
}
if ( *(float *)&a3 == NAN )
{
v7 = *((_DWORD *)a2 + 519);
LABEL_6:
v8 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(int))(*(_DWORD *)v7 + 96))(v7);
this = v4;
LABEL_35:
cocos2d::CCPoint::CCPoint(this, v8);
return v4;
}
if ( *(float *)&a3 == NAN )
{
v7 = *((_DWORD *)a2 + 520);
goto LABEL_6;
}
if ( *(float *)&a3 == NAN )
{
v8 = (GJBaseGameLayer *)((char *)a2 + 848);
goto LABEL_35;
}
v9 = GJBaseGameLayer::tryGetMainObject((cocos2d::CCDictionary **)a2, a3);
if ( !v9 )
goto LABEL_33;
(*(void (__fastcall **)(GJBaseGameLayer *, int))(*(_DWORD *)v9 + 680))(v4, v9);
return v4;
}