//
// GJBaseGameLayer::processFollowActions from 0x1001f895c to 0x1001f8bbc (608 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::processMoveActionsStep @ 0x1001f711c
//
// 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
//
void __fastcall GJBaseGameLayer::processFollowActions(GJBaseGameLayer *a1)
{
GJEffectManager *m_effectManager; // x8
_QWORD *begin; // x24
std::__vector_base::pointer i; // x25
__int64 v5; // x20
int v6; // w0
cocos2d::CCArray *Group; // x21
GameObject *MainObject; // x0
GameObject *v9; // x23
unsigned int m_commandIndex; // w8
float64x2_t v11; // q0
double v12; // d8
bool v13; // w22
float64x2_t *v14; // x8
GJEffectManager *v15; // x23
int v16; // w0
cocos2d::ccArray *data; // x9
__int64 num; // x8
cocos2d::CCObject **arr; // x23
unsigned __int64 v20; // x26
cocos2d::CCObject *v21; // x22
unsigned int v22; // w8
__n128 v23; // q0
GJEffectManager *v24; // x23
int v25; // w0
float64x2_t v26; // [xsp+0h] [xbp-60h]
m_effectManager = a1->m_effectManager;
begin = m_effectManager->m_unkVector6d8.__begin_;
for ( i = m_effectManager->m_unkVector6d8.__end_; begin != i; ++begin )
{
v5 = *begin;
v6 = (*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*begin + 64LL))(*begin);
Group = GJBaseGameLayer::getGroup(a1, v6);
MainObject = GJBaseGameLayer::tryGetMainObject(a1, *(_DWORD *)(v5 + 116));
if ( MainObject )
{
v9 = MainObject;
m_commandIndex = a1->m_gameState.m_commandIndex;
if ( MainObject->m_unk4C4 != m_commandIndex )
{
MainObject->m_lastPosition = (cocos2d::CCPoint)vcvt_f32_f64(*(float64x2_t *)&MainObject->m_positionX);
MainObject->m_unk4C4 = m_commandIndex;
GameObject::dirtifyObjectRect(MainObject);
}
v11 = vmulq_f64(
*(float64x2_t *)(v5 + 128),
vsubq_f64(*(float64x2_t *)&v9->m_positionX, vcvtq_f64_f32((float32x2_t)v9->m_lastPosition)));
*(float64x2_t *)(v5 + 56) = v11;
v26 = v11;
v12 = v11.f64[1];
v13 = v11.f64[1] != 0.0 || v11.f64[0] != 0.0;
if ( v13
|| (*(_BYTE *)(v5 + 120) & 1) != 0
|| v9->m_unk4fb
&& (v24 = a1->m_effectManager,
v25 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 64LL))(v5),
GJEffectManager::wasFollowing(v24, v25, *(_DWORD *)(v5 + 116))) )
{
v14 = *(float64x2_t **)(v5 + 200);
if ( v14 )
v14[3] = vaddq_f64(*(float64x2_t *)(v5 + 56), v14[3]);
v15 = a1->m_effectManager;
v16 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 64LL))(v5);
GJEffectManager::setFollowing(v15, v16, *(_DWORD *)(v5 + 116), v13);
a1->m_followedCount += sub_10024A36C(Group);
if ( Group )
{
data = Group->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
v20 = (unsigned __int64)&arr[num - 1];
do
{
v21 = *arr;
if ( !*arr )
break;
if ( (BYTE2(v21[23].__vftable) & 1) == 0 )
{
v22 = a1->m_gameState.m_commandIndex;
if ( HIDWORD(v21[22].__vftable) != v22 )
{
*(float32x2_t *)&v21[21].m_uOrderOfArrival = vcvt_f32_f64(*(float64x2_t *)&v21[16].m_uOrderOfArrival);
HIDWORD(v21[22].__vftable) = v22;
GameObject::dirtifyObjectRect((GameObject *)v21);
}
}
if ( v12 != 0.0 )
*(double *)&v21[17].__vftable = *(double *)(v5 + 64) + *(double *)&v21[17].__vftable;
GameObject::dirtifyObjectPos((GameObject *)v21);
v23 = (__n128)v26;
if ( v26.f64[0] != 0.0 && (v21[12].m_uUnknown & 1) == 0 )
{
v23.n128_f64[0] = *(double *)(v5 + 56) + *(double *)&v21[16].m_uOrderOfArrival;
*(_QWORD *)&v21[16].m_uOrderOfArrival = v23.n128_u64[0];
}
((void (__fastcall *)(GJBaseGameLayer *, cocos2d::CCObject *, __n128))a1->updateObjectSection)(
a1,
v21,
v23);
++arr;
}
while ( (unsigned __int64)arr <= v20 );
}
}
((void (__fastcall *)(GJBaseGameLayer *, cocos2d::CCArray *))a1->updateDisabledObjectsLastPos)(a1, Group);
}
}
}
}