//
// GJBaseGameLayer::processDynamicObjectActions from 0x483098 to 0x483552 (1210 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::processMoveActionsStep @ 0x496cd2
// > GJBaseGameLayer::processMoveActionsStep @ 0x496cea
//
// 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; // r9
unsigned int v6; // r8
DynamicObjectAction *m_start; // r2
DynamicObjectAction *v8; // r4
int m_gameObject1; // r7
GroupCommandObject2 *TempGroupCommand; // r0
unsigned int m_targetGroupID; // r10
GroupCommandObject2 *v12; // r5
CCMoveCNode *MoveCommandNode; // r10
GJEffectManager *m_effectManager; // r11
_DWORD **v15; // r3
_DWORD *i; // r1
_DWORD *v17; // r3
_DWORD *v18; // r0
const void **v19; // r10
GroupCommandObject2 **v20; // r3
int v21; // r3
int v22; // r11
bool v23; // cf
char *v24; // r3
int v25; // r11
int v26; // r2
unsigned int v27; // r12
char *v28; // r0
char *v29; // r2
float m_unkFloat1; // s15
float v31; // s17
float m_unkFloat2; // s20
float v33; // s16
float v34; // s14
float EasedValue; // s15
float v36; // s15
float v37; // s14
cocos2d::CCPoint *(__fastcall *getRealPosition)(cocos2d::CCPoint *__return_ptr __struct_ptr, GameObject *__hidden); // r3
float v39; // s20
float v40; // s15
float v41; // s19
float v42; // s15
int v43; // r2
bool v44; // r3
double m_unk040; // d5
double v46; // d6
float v47; // s16
float RotateCommandAngleDelta; // r0
int v49; // r3
DynamicObjectAction *m_finish; // r7
int v51; // r5
int v52; // r10
_DWORD *v53; // r4
int v54; // r1
int v55; // r2
int v56; // r3
_DWORD *v57; // r4
int v58; // r1
int v59; // r2
int v60; // r3
_DWORD *v61; // r4
int v62; // r1
int v63; // r2
int v64; // r3
_DWORD *v65; // r4
int v66; // r1
int v67; // r2
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; // [sp+1Ch] [bp-38h]
size_t v70; // [sp+1Ch] [bp-38h]
char *v71; // [sp+1Ch] [bp-38h]
char *v72; // [sp+24h] [bp-30h]
cocos2d::CCPoint v73; // [sp+34h] [bp-20h] BYREF
cocos2d::CCPoint v74; // [sp+3Ch] [bp-18h] BYREF
_BYTE v75[8]; // [sp+44h] [bp-10h] 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 )
{
v6 = 0;
while ( 1 )
{
while ( 1 )
{
m_start = p_m_dynamicRotateActions->m_start;
if ( v6 >= -286331153
* (((char *)p_m_dynamicRotateActions->m_finish - (char *)p_m_dynamicRotateActions->m_start) >> 2) )
return;
v8 = &m_start[v6];
if ( !v8->m_unkBool3 || v8->m_unkBool4 )
break;
LABEL_88:
++v6;
}
m_gameObject1 = (int)m_start[v6].m_gameObject1;
TempGroupCommand = GJEffectManager::getTempGroupCommand(a1->m_effectManager);
m_targetGroupID = v8->m_targetGroupID;
TempGroupCommand->m_targetGroupID = m_targetGroupID;
v12 = TempGroupCommand;
TempGroupCommand->m_centerGroupID = v8->m_centerGroupID;
TempGroupCommand->m_triggerUniqueID = *(_DWORD *)(m_gameObject1 + 772);
TempGroupCommand->m_controlID = v8->m_controlID;
if ( !a2 )
{
MoveCommandNode = GJEffectManager::getMoveCommandNode(a1->m_effectManager, TempGroupCommand);
goto LABEL_43;
}
if ( a2 == 1 )
break;
LABEL_42:
MoveCommandNode = nullptr;
LABEL_43:
m_unkFloat1 = v8->m_unkFloat1;
v31 = *(float *)(m_gameObject1 + 1264);
m_unkFloat2 = v8->m_unkFloat2;
v33 = v31 - m_unkFloat1;
if ( ((float)(v31 - m_unkFloat1) > 0.0 || v31 == -1.0 || v8->m_unkBool1) && !v8->m_unkBool2 && !v8->m_unkBool3 )
{
if ( v8->m_unkBool1 )
{
v8->m_unkBool1 = 0;
}
else if ( v31 != -1.0 )
{
if ( v33 > a3 )
v34 = a3;
else
v34 = v31 - m_unkFloat1;
v8->m_unkFloat1 = m_unkFloat1 + v34;
}
if ( a2 )
{
if ( a2 == 1 )
{
RotateCommandAngleDelta = getRotateCommandAngleDelta(
m_gameObject1,
(int)v8->m_gameObject2,
(int)v8->m_gameObject4,
(int)v8->m_gameObject3,
v8->m_gameObject5,
v8->m_gameObject6,
v8->m_gameObject7,
v8->m_gameObject8);
v49 = *(_DWORD *)(m_gameObject1 + 1376);
if ( v49 < 1 )
v49 = 1;
v12->m_currentRotateOrTransformDelta = (float)(RotateCommandAngleDelta / (float)v49);
GroupCommandObject2::stepTransformCommand(v12, 0.0, 0, 1);
}
}
else
{
EasedValue = GameToolbox::getEasedValue(
v8->m_unkFloat1 / v31,
*(_DWORD *)(m_gameObject1 + 1308),
*(float *)(m_gameObject1 + 1312));
if ( EasedValue == 1.0 && v33 > a3 )
{
v36 = 0.0001;
if ( v8->m_unkFloat3 >= 1.0 )
v36 = -0.0001;
EasedValue = v36 + 1.0;
}
v8->m_unkFloat3 = EasedValue;
v37 = v8->m_unkFloat2;
getRealPosition = v8->m_gameObject3->getRealPosition;
v39 = v31 - m_unkFloat2;
v40 = EasedValue * v31;
v8->m_unkFloat2 = v40;
if ( v39 == 0.0 )
v33 = 0.0;
else
v40 = v40 - v37;
if ( v39 != 0.0 )
v33 = v40 / v39;
v41 = 1.0;
if ( v31 <= 0.0 )
v33 = 1.0;
((void (__fastcall *)(cocos2d::CCPoint *))getRealPosition)(&v74);
((void (__fastcall *)(_BYTE *))v8->m_gameObject2->getRealPosition)(v75);
cocos2d::CCPoint::operator-(&v73, &v74, v75);
if ( *(_BYTE *)(m_gameObject1 + 1337) )
{
v42 = *(float *)(m_gameObject1 + 1344);
if ( v31 > 0.0 )
v41 = v39 / v31;
cocos2d::ccpNormalize(&v74, &v73);
cocos2d::CCPoint::operator*(v75, &v74, v41 * v42);
cocos2d::CCPoint::operator=((PlayerObject *)&v73, COERCE_FLOAT(v75), v43, v44);
}
m_unk040 = MoveCommandNode->m_unk040;
v46 = (float)(v33 * v73.x);
MoveCommandNode->m_unk038 = MoveCommandNode->m_unk038 + v46;
v47 = v33 * v73.y;
MoveCommandNode->m_unk040 = m_unk040 + v47;
MoveCommandNode->m_unk090 = MoveCommandNode->m_unk090 + v46;
MoveCommandNode->m_unk098 = MoveCommandNode->m_unk098 + v47;
}
goto LABEL_88;
}
if ( a2 )
{
if ( a2 == 1 )
{
v12->m_finishRelated = 1;
GroupCommandObject2::stepTransformCommand(v12, 0.0, 0, 1);
}
}
else
{
MoveCommandNode->m_unk078 = 1;
}
if ( v8->m_unkBool3 )
{
v8->m_unkBool4 = 0;
goto LABEL_88;
}
m_finish = p_m_dynamicRotateActions->m_finish;
v51 = (int)&p_m_dynamicRotateActions->m_start[v6 + 1];
if ( (DynamicObjectAction *)v51 != m_finish )
{
v52 = -286331153 * (((int)m_finish - v51) >> 2);
while ( 1 )
{
v51 += 60;
if ( v52 <= 0 )
break;
v53 = (_DWORD *)(v51 - 120);
--v52;
v54 = *(_DWORD *)(v51 - 56);
v55 = *(_DWORD *)(v51 - 52);
v56 = *(_DWORD *)(v51 - 48);
*v53 = *(_DWORD *)(v51 - 60);
v53[1] = v54;
v53[2] = v55;
v53[3] = v56;
v57 = (_DWORD *)(v51 - 104);
v58 = *(_DWORD *)(v51 - 40);
v59 = *(_DWORD *)(v51 - 36);
v60 = *(_DWORD *)(v51 - 32);
*v57 = *(_DWORD *)(v51 - 44);
v57[1] = v58;
v57[2] = v59;
v57[3] = v60;
v61 = (_DWORD *)(v51 - 88);
v62 = *(_DWORD *)(v51 - 24);
v63 = *(_DWORD *)(v51 - 20);
v64 = *(_DWORD *)(v51 - 16);
*v61 = *(_DWORD *)(v51 - 28);
v61[1] = v62;
v61[2] = v63;
v61[3] = v64;
v65 = (_DWORD *)(v51 - 72);
v66 = *(_DWORD *)(v51 - 8);
v67 = *(_DWORD *)(v51 - 4);
*v65 = *(_DWORD *)(v51 - 12);
v65[1] = v66;
v65[2] = v67;
}
}
p_m_dynamicRotateActions->m_finish = m_finish - 1;
}
m_effectManager = a1->m_effectManager;
M_bucket_count = m_effectManager->m_unkMap5c8._M_h._M_bucket_count;
v15 = (_DWORD **)m_effectManager->m_unkMap5c8._M_h._M_buckets[m_targetGroupID % M_bucket_count];
if ( !v15 )
goto LABEL_21;
for ( i = *v15; m_targetGroupID != i[1]; i = (_DWORD *)*i )
{
if ( !*i )
goto LABEL_21;
v15 = (_DWORD **)i;
if ( *(_DWORD *)(*i + 4) % M_bucket_count != m_targetGroupID % M_bucket_count )
goto LABEL_21;
}
v17 = *v15;
if ( v17 )
{
v19 = (const void **)(v17 + 2);
}
else
{
LABEL_21:
v18 = (_DWORD *)operator new(0x14u);
*v18 = 0;
v18[1] = m_targetGroupID;
v18[2] = 0;
v18[3] = 0;
v18[4] = 0;
v19 = (const void **)(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(
(int)&m_effectManager->m_unkMap5c8,
m_targetGroupID % M_bucket_count,
m_targetGroupID,
v18)
+ 2);
}
v20 = (GroupCommandObject2 **)v19[1];
if ( v20 != v19[2] )
{
if ( v20 )
*v20 = v12;
v19[1] = (char *)v19[1] + 4;
LABEL_41:
GJEffectManager::registerRotationCommand(a1->m_effectManager, v12, a1->m_effectManager->m_unk798);
goto LABEL_42;
}
v21 = ((char *)v20 - (_BYTE *)*v19) >> 2;
if ( v21 )
v22 = v21;
else
v22 = 1;
v23 = __CFADD__(v22, v21);
v24 = (char *)(v22 + v21);
if ( v23 || (unsigned int)v24 >= 0x40000000 )
{
v25 = 0x3FFFFFFF;
}
else
{
v25 = (int)v24;
if ( !v24 )
goto LABEL_34;
}
v24 = (char *)operator new(4 * v25);
LABEL_34:
v26 = (_BYTE *)v19[1] - (_BYTE *)*v19;
if ( &v24[v26] )
*(_DWORD *)&v24[v26] = v12;
v27 = (_BYTE *)v19[1] - (_BYTE *)*v19;
if ( v27 >> 2 )
{
v70 = (_BYTE *)v19[1] - (_BYTE *)*v19;
v28 = (char *)memmove(v24, *v19, v70);
v27 = v70;
v24 = v28;
}
v29 = &v24[v27 + 4];
if ( *v19 )
{
v72 = v24;
v71 = &v24[v27 + 4];
operator delete((void *)*v19);
v24 = v72;
v29 = v71;
}
*v19 = v24;
v19[1] = v29;
v19[2] = &v24[4 * v25];
goto LABEL_41;
}
}