//
// GJBaseGameLayer::processFollowActions from 0x47544c to 0x475670 (548 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::processMoveActionsStep @ 0x496d06
//
// 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 GJBaseGameLayer::processFollowActions(GJBaseGameLayer *a1)
{
GJEffectManager *m_effectManager; // r3
int **m_start; // r9
int *p_m_followedCount; // r8
int *v5; // r11
int *v6; // t1
int v7; // r0
cocos2d::CCArray *Group; // r7
GameObject *MainObject; // r0
GameObject *v10; // r5
unsigned int m_commandIndex; // r3
float *p_x; // r10
float *p_y; // r6
float m_positionX; // s14
float m_positionY; // s14
double v16; // d6
double v17; // d7
double v18; // d5
double v19; // d7
_BOOL4 v20; // r10
GJEffectManager *v21; // r5
int v22; // r0
int v23; // r3
double v24; // d6
GJEffectManager *v25; // r5
int v26; // r0
char v27; // r3
cocos2d::ccArray *data; // r3
cocos2d::CCObject **arr; // r6
GameObject *v30; // r5
GameObject *v31; // t1
unsigned int v32; // r3
float v33; // s14
float v34; // s14
_BOOL4 v35; // [sp+4h] [bp-10h]
int **m_finish; // [sp+8h] [bp-Ch]
cocos2d::CCObject **v37; // [sp+Ch] [bp-8h]
m_effectManager = a1->m_effectManager;
m_start = (int **)m_effectManager->m_unkVector6d8.m_start;
p_m_followedCount = &a1->m_followedCount;
m_finish = (int **)m_effectManager->m_unkVector6d8.m_finish;
while ( m_start != m_finish )
{
v6 = *m_start++;
v5 = v6;
v7 = (*(int (__fastcall **)(int *))(*v6 + 32))(v6);
Group = GJBaseGameLayer::getGroup(a1, v7);
MainObject = GJBaseGameLayer::tryGetMainObject(a1, v6[29]);
v10 = MainObject;
if ( MainObject )
{
m_commandIndex = a1->m_gameState.m_commandIndex;
p_x = &MainObject->m_lastPosition.x;
p_y = &MainObject->m_lastPosition.y;
if ( MainObject->m_unk4C4 != m_commandIndex )
{
m_positionX = MainObject->m_positionX;
*p_x = m_positionX;
m_positionY = MainObject->m_positionY;
*p_y = m_positionY;
MainObject->m_unk4C4 = m_commandIndex;
GameObject::dirtifyObjectRect(MainObject);
}
v16 = (v10->m_positionX - *p_x) * *((double *)v5 + 16);
v17 = v10->m_positionY - *p_y;
v18 = *((double *)v5 + 17);
*((double *)v5 + 7) = v16;
v19 = v17 * v18;
*((double *)v5 + 8) = v19;
v20 = v16 != 0.0;
v35 = v19 != 0.0;
if ( v16 != 0.0
|| v19 != 0.0
|| *((_BYTE *)v5 + 120)
|| v10->m_unk4fb
&& (v21 = a1->m_effectManager,
v22 = (*(int (__fastcall **)(int *))(*v5 + 32))(v5),
GJEffectManager::wasFollowing(v21, v22, v5[29])) )
{
v23 = v5[50];
if ( v23 )
{
v24 = *((double *)v5 + 8);
*(double *)(v23 + 48) = *(double *)(v23 + 48) + *((double *)v5 + 7);
*(double *)(v23 + 56) = *(double *)(v23 + 56) + v24;
}
v25 = a1->m_effectManager;
v26 = (*(int (__fastcall **)(int *))(*v5 + 32))(v5);
v27 = v19 != 0.0;
if ( v20 )
v27 = 1;
GJEffectManager::setFollowing(v25, v26, v5[29], v27);
*p_m_followedCount += cocos2d::CCArray::count(Group);
if ( Group )
{
data = Group->data;
if ( data->num )
{
arr = data->arr;
v37 = &arr[data->num] + 0x3FFFFFFF;
while ( arr <= v37 )
{
v31 = (GameObject *)*arr++;
v30 = v31;
if ( !v31 )
break;
if ( !v30->m_isDecoration2 )
{
v32 = a1->m_gameState.m_commandIndex;
if ( v30->m_unk4C4 != v32 )
{
v33 = v30->m_positionX;
v30->m_lastPosition.x = v33;
v34 = v30->m_positionY;
v30->m_lastPosition.y = v34;
v30->m_unk4C4 = v32;
GameObject::dirtifyObjectRect(v30);
}
}
if ( v35 )
v30->m_positionY = v30->m_positionY + *((double *)v5 + 8);
GameObject::dirtifyObjectPos(v30);
if ( v20 && !v30->m_tempOffsetXRelated )
v30->m_positionX = v30->m_positionX + *((double *)v5 + 7);
a1->updateObjectSection(a1, v30);
}
}
}
a1->updateDisabledObjectsLastPos(a1, Group);
}
}
}
}