//
// GJBaseGameLayer::getFollowSpeedVal from 0x14022e950 to 0x14022eab2 (354 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::modifyGroupPhysics @ 0x14022f060
// > GJBaseGameLayer::processAdvancedFollowAction @ 0x14022f87f
// > ??> @ 0x1406cdd88
//
// 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
//
// local variable allocation has failed, the output may be wrong!
cocos2d::CCPoint GJBaseGameLayer::getFollowSpeedVal(
GJBaseGameLayer *a1,
GameObject *a2,
int a3,
int a4,
float a5,
float a6)
{
__int64 v9; // r14
float v10; // xmm6_4
GameObject *Object; // rax
GameObject *v12; // rbx
__int64 v13; // r8
__int64 p_m_lastPosition; // rcx
GameObject *v15; // rax
__int64 v16; // rbx
struct cocos2d::CCPoint v17; // rax
_BYTE v19[8]; // [rsp+20h] [rbp-38h] BYREF
_BYTE v20[8]; // [rsp+28h] [rbp-30h] BYREF
_BYTE v21[16]; // [rsp+30h] [rbp-28h] BYREF
cocos2d::CCPoint X; // [rsp+68h] [rbp+10h] BYREF
v9 = *(_QWORD *)&a3;
v10 = (float)(90.0 - a6) * 0.017453292;
cocos2d::CCPoint::CCPoint(&X);
if ( a4 > 0 )
{
Object = GJBaseGameLayer::tryGetObject(a1, a4);
v12 = Object;
if ( Object )
{
v13 = ((__int64 (__fastcall *)(GameObject *, _BYTE *))Object->getRealPosition)(Object, v20);
p_m_lastPosition = (__int64)&v12->m_lastPosition;
LABEL_7:
cocos2d::CCPoint::operator-(p_m_lastPosition, v19, v13);
cocos2d::CCPoint::operator=(&X, v19);
goto LABEL_8;
}
}
if ( SLODWORD(a5) > 0 )
{
v15 = GJBaseGameLayer::tryGetObject(a1, SLODWORD(a5));
if ( v15 )
{
v16 = ((__int64 (__fastcall *)(GameObject *, _BYTE *))v15->getRealPosition)(v15, v20);
p_m_lastPosition = (*(__int64 (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v9 + 1192LL))(v9, v21);
v13 = v16;
goto LABEL_7;
}
}
LABEL_8:
if ( X.x != 0.0 || X.y != 0.0 )
v10 = v10 + (float)(atan2f(X.y, X.x) + 1.570796326794897);
v17 = cocos2d::ccpForAngle((cocos2d *)v21, v10);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator*)(v17, a2);
return (cocos2d::CCPoint)a2;
}