//
// GJBaseGameLayer::processFollowActions from 0x140230580 to 0x140230a19 (1177 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::processMoveActionsStep @ 0x14022b741
// > ??> @ 0x140680dfc
// > ??> @ 0x140680e0c
// > ??> @ 0x1406cde54
//
// 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; // rax
_QWORD *Myfirst; // r12
__int64 v4; // rsi
int v5; // eax
__int64 v6; // rcx
__int64 v7; // rbx
std::_Simple_types::value_type v8; // r13
int v9; // ebx
struct cocos2d::CCObject *v10; // rax
struct cocos2d::CCObject *v11; // rcx
struct cocos2d::CCObject *v12; // rdx
cocos2d::CCArray *Group; // rax
cocos2d::CCArray *v14; // rbx
double *v15; // rdx
float v16; // xmm1_4
double v17; // xmm1_8
double v18; // xmm2_8
bool v19; // r14
int v20; // ebx
int v21; // eax
GJEffectManager *v22; // rdx
int v23; // r8d
std::_Vector_val>, std::_Iterator_base0>>>::pointer v24; // rcx
unsigned __int64 v25; // r9
std::_List_unchecked_const_iterator>, std::_Iterator_base0>::_Nodeptr Ptr; // rax
std::_List_unchecked_const_iterator>, std::_Iterator_base0>::_Nodeptr v27; // rcx
__int64 v28; // rax
bool v29; // r15
int v30; // ebx
std::unordered_set *p_m_unkMap4c8; // rcx
cocos2d::ccArray *data; // rbx
__int64 num; // rax
cocos2d::CCObject **arr; // rbx
cocos2d::CCObject **i; // r15
cocos2d::CCObject *v36; // rdx
float v37; // xmm1_4
char v38[16]; // [rsp+20h] [rbp-58h] BYREF
int v39; // [rsp+80h] [rbp+8h] BYREF
std::_Vector_val>::pointer Mylast; // [rsp+88h] [rbp+10h]
m_effectManager = a1->m_effectManager;
Myfirst = m_effectManager->m_unkVector6d8._Mypair._Myval2._Myfirst;
Mylast = m_effectManager->m_unkVector6d8._Mypair._Myval2._Mylast;
if ( Myfirst != Mylast )
{
while ( 1 )
{
v4 = *Myfirst;
v5 = (*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*Myfirst + 56LL))(*Myfirst);
if ( v5 > 9999 )
v5 = 9999;
if ( v5 < 0 )
v5 = 0;
v7 = (unsigned int)v5;
v8 = a1->m_groups._Mypair._Myval2._Myfirst[v5];
if ( !v8 )
{
v8 = (std::_Simple_types::value_type)cocos2d::CCArray::create(v6);
cocos2d::CCDictionary::setObject(a1->m_groupDict, v8, (unsigned int)v7);
a1->m_groups._Mypair._Myval2._Myfirst[v7] = v8;
}
v9 = *(_DWORD *)(v4 + 116);
if ( v9 <= 0 )
goto LABEL_53;
v10 = cocos2d::CCDictionary::objectForKey(a1->m_parentGroupsDict, *(int *)(v4 + 116));
v11 = v10;
if ( v10 )
{
v12 = v10;
}
else
{
Group = GJBaseGameLayer::getGroup(a1, v9);
v14 = Group;
if ( Group && cocos2d::CCArray::count(Group) == 1 )
v11 = cocos2d::CCArray::objectAtIndex(v14, 0);
else
v11 = nullptr;
v12 = v11;
if ( !v11 )
goto LABEL_53;
}
if ( v11[22].m_nLuaID == a1->m_gameState.m_commandIndex )
{
v15 = (double *)&v12[17];
}
else
{
v15 = (double *)&v11[17];
v16 = *(double *)&v11[17].m_uID;
*(float *)&v11[22].__vftable = *(double *)&v11[17].__vftable;
*((float *)&v11[22].__vftable + 1) = v16;
v11[22].m_nLuaID = a1->m_gameState.m_commandIndex;
LOWORD(v11[15].m_uIndexInArray) = 257;
}
v17 = (*v15 - *(float *)&v11[22].__vftable) * *(double *)(v4 + 128);
*(double *)(v4 + 56) = v17;
v18 = (*(double *)&v11[17].m_uID - *((float *)&v11[22].__vftable + 1)) * *(double *)(v4 + 136);
*(double *)(v4 + 64) = v18;
v19 = v17 != 0.0;
if ( v17 != 0.0 || v18 != 0.0 || *(_BYTE *)(v4 + 120) )
{
LABEL_30:
v28 = *(_QWORD *)(v4 + 200);
if ( v28 )
{
*(double *)(v28 + 48) = *(double *)(v4 + 56) + *(double *)(v28 + 48);
*(double *)(v28 + 56) = *(double *)(v4 + 64) + *(double *)(v28 + 56);
}
v29 = v17 != 0.0 || v18 != 0.0;
v30 = *(_DWORD *)(v4 + 116);
v39 = v30 + 2000 * (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 56LL))(v4);
p_m_unkMap4c8 = &a1->m_effectManager->m_unkMap4c8;
if ( v29 )
sub_140060D70((__int64)p_m_unkMap4c8, (__int64)v38, (unsigned __int8 *)&v39);
else
sub_14005D780(p_m_unkMap4c8, (unsigned __int8 *)&v39);
a1->m_followedCount += cocos2d::CCArray::count(v8);
if ( v8 )
{
data = v8->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
for ( i = &arr[num - 1]; arr <= i; ++arr )
{
v36 = *arr;
if ( !*arr )
break;
if ( !BYTE2(v36[23].m_uID) && v36[22].m_nLuaID != a1->m_gameState.m_commandIndex )
{
v37 = *(double *)&v36[17].m_uID;
*(float *)&v36[22].__vftable = *(double *)&v36[17].__vftable;
*((float *)&v36[22].__vftable + 1) = v37;
v36[22].m_nLuaID = a1->m_gameState.m_commandIndex;
LOWORD(v36[15].m_uIndexInArray) = 257;
}
if ( v18 != 0.0 )
*(double *)&v36[17].m_uID = *(double *)&v36[17].m_uID + *(double *)(v4 + 64);
*(_WORD *)((char *)&v36[15].m_uID + 1) = 257;
if ( v19 && !LOBYTE(v36[12].m_unknown2) )
*(double *)&v36[17].__vftable = *(double *)&v36[17].__vftable + *(double *)(v4 + 56);
((void (__fastcall *)(GJBaseGameLayer *))a1->updateObjectSection)(a1);
}
}
}
a1->updateDisabledObjectsLastPos(a1, v8);
goto LABEL_53;
}
if ( HIBYTE(v11[23].m_uID) )
break;
LABEL_53:
if ( ++Myfirst == Mylast )
return;
}
v20 = *(_DWORD *)(v4 + 116);
v21 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 56LL))(v4);
v22 = a1->m_effectManager;
v23 = v20 + 2000 * v21;
v39 = v23;
v24 = v22->m_unkMap4c8._Vec._Mypair._Myval2._Myfirst;
v25 = 2
* ((0x100000001B3LL
* (HIBYTE(v23)
^ (0x100000001B3LL
* (BYTE2(v23)
^ (0x100000001B3LL
* ((unsigned __int8)((unsigned __int16)(v20 + 2000 * v21) >> 8)
^ (0x100000001B3LL * ((unsigned __int8)(v20 - 48 * v21) ^ 0xCBF29CE484222325uLL))))))))
& v22->m_unkMap4c8._Mask);
Ptr = v24[2
* ((0x100000001B3LL
* (HIBYTE(v23)
^ (0x100000001B3LL
* (BYTE2(v23)
^ (0x100000001B3LL
* ((unsigned __int8)((unsigned __int16)(v20 + 2000 * v21) >> 8)
^ (0x100000001B3LL * ((unsigned __int8)(v20 - 48 * v21) ^ 0xCBF29CE484222325uLL))))))))
& v22->m_unkMap4c8._Mask)
+ 1]._Ptr;
if ( Ptr != v22->m_unkMap4c8._List._Mypair._Myval2._Myhead )
{
v27 = v24[v25]._Ptr;
if ( v23 == *((_DWORD *)Ptr + 4) )
goto LABEL_29;
while ( Ptr != v27 )
{
Ptr = *((std::_List_unchecked_const_iterator>, std::_Iterator_base0>::_Nodeptr *)Ptr
+ 1);
if ( v23 == *((_DWORD *)Ptr + 4) )
goto LABEL_29;
}
}
Ptr = nullptr;
LABEL_29:
if ( Ptr )
goto LABEL_30;
goto LABEL_53;
}
}