//
// GJBaseGameLayer::processDynamicObjectActions from 0x8797fc to 0x879ed4 (1752 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::processMoveActionsStep @ 0x89d22c
// > GJBaseGameLayer::processMoveActionsStep @ 0x89d250
// > ??> @ 0x6ce88
//
// 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::processDynamicObjectActions(GJBaseGameLayer *a1, int a2, float a3)
{
std::vector *p_m_dynamicRotateActions; // x24
DynamicObjectAction *m_start; // x1
int v7; // w23
unsigned __int64 v8; // x20
__int64 v9; // x19
__int64 v10; // x26
DynamicObjectAction *v11; // x22
__int64 m_gameObject1; // x27
GroupCommandObject2 *TempGroupCommand; // x19
int m_targetGroupID; // w6
CCMoveCNode *MoveCommandNode; // x28
float v16; // s8
float m_unkFloat1; // s0
float m_unkFloat2; // s15
float v19; // s9
DynamicObjectAction *m_finish; // x0
DynamicObjectAction *v21; // x19
DynamicObjectAction *v22; // x0
DynamicObjectAction *v23; // x27
float EasedValue; // s0
float v25; // s15
float v26; // s2
float v27; // s9
void (*getRealPosition)(void); // x1
float v29; // s15
float v30; // s0
float v31; // s1
double v32; // d0
double v33; // d9
double v34; // d4
double v35; // d3
double v36; // d0
double v37; // d1
GJEffectManager *m_effectManager; // x0
char **p_m_unkMap5c8; // x28
std::_Hashtable>, std::allocator>>, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits>::size_type M_bucket_count; // x8
unsigned __int64 v41; // x1
std::_Hashtable>, std::allocator>>, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits>::__bucket_type v42; // x11
std::__detail::_Hash_node_base *M_nxt; // x5
int v44; // w0
char *v45; // x28
GroupCommandObject2 **v46; // x6
float v47; // s0
int v48; // w3
void *v49; // x0
signed __int64 v50; // x10
unsigned __int64 v51; // x1
unsigned __int64 v52; // x2
unsigned __int64 v53; // x6
char *v54; // x5
char *v55; // x10
__int64 v56; // x0
unsigned __int64 v57; // [xsp+A0h] [xbp+A0h]
unsigned __int64 v58; // [xsp+A0h] [xbp+A0h]
char *v59; // [xsp+A8h] [xbp+A8h]
unsigned __int64 v60; // [xsp+A8h] [xbp+A8h]
unsigned __int64 v61; // [xsp+A8h] [xbp+A8h]
float v62; // [xsp+B0h] [xbp+B0h]
unsigned __int64 v63; // [xsp+B0h] [xbp+B0h]
char *v64; // [xsp+B0h] [xbp+B0h]
int v65; // [xsp+B0h] [xbp+B0h]
signed __int64 v66; // [xsp+B0h] [xbp+B0h]
cocos2d::CCPoint v68; // [xsp+D0h] [xbp+D0h] BYREF
char v69[8]; // [xsp+D8h] [xbp+D8h] BYREF
__int64 v70; // [xsp+E0h] [xbp+E0h] BYREF
if ( a2 )
{
if ( a2 != 1 )
return;
p_m_dynamicRotateActions = &a1->m_gameState.m_dynamicRotateActions;
}
else
{
p_m_dynamicRotateActions = &a1->m_gameState.m_dynamicMoveActions;
}
if ( p_m_dynamicRotateActions )
{
m_start = p_m_dynamicRotateActions->m_start;
v7 = 0;
v8 = 0;
v9 = (char *)p_m_dynamicRotateActions->m_finish - (char *)p_m_dynamicRotateActions->m_start;
while ( 1 )
{
if ( v8 >= 0xAAAAAAAAAAAAAAABLL * (v9 >> 5) )
return;
v10 = v8;
v11 = &m_start[v8];
if ( v11->m_unkBool3 )
{
do
{
if ( v11->m_unkBool4 )
break;
v8 = ++v7;
if ( v7 >= 0xAAAAAAAAAAAAAAABLL * (v9 >> 5) )
return;
v10 = v7;
v11 = &m_start[v10];
}
while ( m_start[v10].m_unkBool3 );
}
m_gameObject1 = (__int64)v11->m_gameObject1;
TempGroupCommand = GJEffectManager::getTempGroupCommand(a1->m_effectManager);
m_targetGroupID = v11->m_targetGroupID;
TempGroupCommand->m_targetGroupID = m_targetGroupID;
TempGroupCommand->m_centerGroupID = v11->m_centerGroupID;
TempGroupCommand->m_triggerUniqueID = *(_DWORD *)(m_gameObject1 + 900);
TempGroupCommand->m_controlID = v11->m_controlID;
if ( a2 )
{
MoveCommandNode = nullptr;
if ( a2 == 1 )
{
m_effectManager = a1->m_effectManager;
p_m_unkMap5c8 = (char **)&m_effectManager->m_unkMap5c8;
M_bucket_count = m_effectManager->m_unkMap5c8._M_h._M_bucket_count;
v41 = m_targetGroupID % M_bucket_count;
v42 = m_effectManager->m_unkMap5c8._M_h._M_buckets[v41];
if ( !v42 )
goto LABEL_85;
M_nxt = v42->_M_nxt;
if ( m_targetGroupID == LODWORD(v42->_M_nxt[1]._M_nxt) )
{
LABEL_59:
if ( !v42->_M_nxt )
goto LABEL_85;
v45 = (char *)&v42->_M_nxt[2];
}
else
{
while ( M_nxt->_M_nxt )
{
v44 = (int)M_nxt->_M_nxt[1]._M_nxt;
v42 = M_nxt;
if ( v41 != v44 % M_bucket_count )
break;
M_nxt = M_nxt->_M_nxt;
if ( m_targetGroupID == v44 )
goto LABEL_59;
}
LABEL_85:
v58 = m_targetGroupID % M_bucket_count;
v60 = m_targetGroupID;
v65 = m_targetGroupID;
v56 = operator new(0x28u);
*(_QWORD *)v56 = 0;
*(_DWORD *)(v56 + 8) = v65;
*(_QWORD *)(v56 + 16) = 0;
*(_QWORD *)(v56 + 24) = 0;
*(_QWORD *)(v56 + 32) = 0;
v45 = std::_Hashtable>,std::allocator>>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_M_insert_unique_node(
p_m_unkMap5c8,
v58,
v60,
(char *)v56)
+ 16;
}
v46 = *((GroupCommandObject2 ***)v45 + 1);
if ( v46 != *((GroupCommandObject2 ***)v45 + 2) )
{
if ( v46 )
{
*v46 = TempGroupCommand;
v46 = *((GroupCommandObject2 ***)v45 + 1);
}
*((_QWORD *)v45 + 1) = v46 + 1;
LABEL_65:
MoveCommandNode = nullptr;
GJEffectManager::registerRotationCommand(
a1->m_effectManager,
TempGroupCommand,
a1->m_effectManager->m_unk798);
goto LABEL_14;
}
v49 = *(void **)v45;
v50 = (signed __int64)v46 - *(_QWORD *)v45;
v51 = v50 >> 3;
if ( v50 >> 3 )
{
v52 = 2 * v51;
v53 = -8;
if ( v51 > 2 * v51 || v52 > 0x1FFFFFFFFFFFFFFFLL || (v53 = 16 * v51, v54 = nullptr, v52) )
{
LABEL_76:
v63 = v53;
v54 = (char *)operator new(v53);
v49 = *(void **)v45;
v53 = v63;
v50 = *((_QWORD *)v45 + 1) - *(_QWORD *)v45;
}
if ( &v54[v50] )
{
*(_QWORD *)&v54[v50] = TempGroupCommand;
v49 = *(void **)v45;
v50 = *((_QWORD *)v45 + 1) - *(_QWORD *)v45;
}
if ( v50 >> 3 )
{
v61 = v53;
v66 = v50;
v54 = (char *)memmove(v54, v49, v50);
v53 = v61;
v49 = *(void **)v45;
v50 = v66;
}
v55 = &v54[v50 + 8];
if ( v49 )
{
v57 = v53;
v59 = v55;
v64 = v54;
operator delete(v49);
v53 = v57;
v55 = v59;
v54 = v64;
}
*(_QWORD *)v45 = v54;
*((_QWORD *)v45 + 1) = v55;
*((_QWORD *)v45 + 2) = &v54[v53];
goto LABEL_65;
}
v53 = 8;
goto LABEL_76;
}
}
else
{
MoveCommandNode = GJEffectManager::getMoveCommandNode(a1->m_effectManager, TempGroupCommand);
}
LABEL_14:
v16 = *(float *)(m_gameObject1 + 1436);
m_unkFloat1 = v11->m_unkFloat1;
m_unkFloat2 = v11->m_unkFloat2;
v19 = v16 - m_unkFloat1;
if ( (float)(v16 - m_unkFloat1) <= 0.0 && v16 != -1.0 && !v11->m_unkBool1 || v11->m_unkBool2 || v11->m_unkBool3 )
{
if ( !a2 )
{
MoveCommandNode->m_unk078 = 1;
goto LABEL_26;
}
if ( a2 == 1 )
{
TempGroupCommand->m_finishRelated = 1;
GroupCommandObject2::stepTransformCommand(TempGroupCommand, 0.0, 0, 1);
if ( !v11->m_unkBool3 )
goto LABEL_30;
LABEL_27:
m_start = p_m_dynamicRotateActions->m_start;
++v7;
m_finish = p_m_dynamicRotateActions->m_finish;
v8 = v7;
v11->m_unkBool4 = 0;
v9 = (char *)m_finish - (char *)m_start;
}
else
{
LABEL_26:
if ( v11->m_unkBool3 )
goto LABEL_27;
LABEL_30:
m_start = p_m_dynamicRotateActions->m_start;
v21 = p_m_dynamicRotateActions->m_finish;
v22 = &p_m_dynamicRotateActions->m_start[v10];
v23 = v22 + 1;
if ( &v22[1] != v21 && (__int64)(0xAAAAAAAAAAAAAAABLL * (((char *)v21 - (char *)v23) >> 5)) > 0 )
{
while ( 1 )
{
memcpy(v22, v23, 0x5Cu);
v22 = v23;
if ( v23 == &v21[-1] )
break;
++v23;
}
m_start = p_m_dynamicRotateActions->m_start;
}
p_m_dynamicRotateActions->m_finish = v21 - 1;
v9 = (char *)&v21[-1] - (char *)m_start;
}
}
else
{
if ( v11->m_unkBool1 )
{
v11->m_unkBool1 = 0;
LABEL_19:
if ( !a2 )
goto LABEL_42;
goto LABEL_20;
}
if ( v16 == -1.0 )
goto LABEL_19;
if ( v19 <= a3 )
v11->m_unkFloat1 = v19 + m_unkFloat1;
else
v11->m_unkFloat1 = a3 + m_unkFloat1;
if ( !a2 )
{
LABEL_42:
EasedValue = GameToolbox::getEasedValue(
v11->m_unkFloat1 / v16,
*(_DWORD *)(m_gameObject1 + 1480),
*(float *)(m_gameObject1 + 1484));
if ( EasedValue == 1.0 && v19 > a3 )
{
if ( v11->m_unkFloat3 < 1.0 )
EasedValue = EasedValue + 0.0001;
else
EasedValue = EasedValue + -0.0001;
}
v25 = v16 - m_unkFloat2;
v26 = v11->m_unkFloat2;
v11->m_unkFloat3 = EasedValue;
v11->m_unkFloat2 = EasedValue * v16;
v27 = 0.0;
if ( v25 != 0.0 )
v27 = (float)((float)(EasedValue * v16) - v26) / v25;
getRealPosition = (void (*)(void))v11->m_gameObject3->getRealPosition;
if ( v16 <= 0.0 )
{
getRealPosition();
((void (__fastcall *)(__int64 *__return_ptr, GameObject *))v11->m_gameObject2->getRealPosition)(
&v70,
v11->m_gameObject2);
cocos2d::CCPoint::operator-(&v68, v69, &v70);
v27 = 1.0;
if ( *(_BYTE *)(m_gameObject1 + 1509) )
{
v29 = 1.0;
goto LABEL_52;
}
}
else
{
getRealPosition();
((void (__fastcall *)(__int64 *__return_ptr, GameObject *))v11->m_gameObject2->getRealPosition)(
&v70,
v11->m_gameObject2);
cocos2d::CCPoint::operator-(&v68, v69, &v70);
if ( *(_BYTE *)(m_gameObject1 + 1509) )
{
if ( v16 <= 0.0 )
v29 = 1.0;
else
v29 = v25 / v16;
LABEL_52:
v62 = v29 * *(float *)(m_gameObject1 + 1516);
cocos2d::ccpNormalize(&v68);
cocos2d::CCPoint::operator*(v69, v62);
cocos2d::CCPoint::operator=(&v68, v30, v31);
}
}
v32 = (float)(v27 * v68.x);
v33 = (float)(v27 * v68.y);
v34 = MoveCommandNode->m_unk038 + v32;
v35 = MoveCommandNode->m_unk040 + v33;
v36 = MoveCommandNode->m_unk090 + v32;
v37 = MoveCommandNode->m_unk098 + v33;
MoveCommandNode->m_unk038 = v34;
MoveCommandNode->m_unk040 = v35;
MoveCommandNode->m_unk090 = v36;
MoveCommandNode->m_unk098 = v37;
goto LABEL_21;
}
LABEL_20:
if ( a2 == 1 )
{
getRotateCommandAngleDelta(
m_gameObject1,
(__int64)v11->m_gameObject2,
(__int64)v11->m_gameObject4,
(__int64)v11->m_gameObject3,
v11->m_gameObject5,
v11->m_gameObject6,
v11->m_gameObject7,
v11->m_gameObject8);
v48 = *(_DWORD *)(m_gameObject1 + 1548);
if ( v48 <= 0 )
v48 = 1;
TempGroupCommand->m_currentRotateOrTransformDelta = (float)(v47 / (float)v48);
GroupCommandObject2::stepTransformCommand(TempGroupCommand, 0.0, 0, 1);
}
LABEL_21:
++v7;
m_start = p_m_dynamicRotateActions->m_start;
v8 = v7;
v9 = (char *)p_m_dynamicRotateActions->m_finish - (char *)p_m_dynamicRotateActions->m_start;
}
}
}
}