//
// GJBaseGameLayer::triggerMoveCommand from 0x14021ea40 to 0x14021efa3 (1379 bytes)
//
// 4 xrefs:
// > EffectGameObject::triggerObject @ 0x1404a63fd
// > ??> @ 0x14067fb04
// > ??> @ 0x14067fb14
// > ??> @ 0x1406cd410
//
// 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::triggerMoveCommand(GJBaseGameLayer *a1, EffectGameObject *a2)
{
bool m_lockToPlayerX; // bl
bool m_lockToPlayerY; // r14
bool m_lockToCameraX; // r15
bool m_lockToCameraY; // r12
float m_moveModX; // xmm7_4
float m_moveModY; // xmm8_4
int m_targetModCenterID; // edx
GameObject *Object; // rax
bool v12; // zf
GameObject *v13; // rbx
PlayerObject *m_player2; // rcx
std::_Vector_val>::pointer Mylast; // rdx
int m_targetGroupID; // edx
bool m_enable22Changes; // r14
GameObject *MainObject; // rax
GameObject *v19; // rbx
int m_centerGroupID; // edx
PlayerObject *m_player1; // r14
__int64 v22; // rbx
__int64 v23; // rax
struct cocos2d::CCPoint v24; // rax
MoveTargetType m_moveTargetMode; // eax
float v26; // r12d
double y; // xmm7_8
double x; // xmm6_8
cocos2d::CCArray *Group; // rax
cocos2d::ccArray *data; // r14
__int64 num; // rax
cocos2d::CCObject **arr; // r14
cocos2d::CCObject **i; // r15
cocos2d::CCObject *v34; // rbx
double v35; // xmm0_8
float v36; // xmm1_4
GJEffectManager *m_effectManager; // rbx
__int64 v38; // rax
__int64 v39; // rax
cocos2d::CCPoint v40; // rax
EffectGameObject *v41; // [rsp+78h] [rbp-19h] BYREF
PlayerObject *v42; // [rsp+100h] [rbp+6Fh] BYREF
cocos2d::CCPoint v43; // [rsp+108h] [rbp+77h] BYREF
GameObject *v44; // [rsp+110h] [rbp+7Fh] BYREF
cocos2d::CCPoint::CCPoint(&v43);
m_lockToPlayerX = a2->m_lockToPlayerX;
m_lockToPlayerY = a2->m_lockToPlayerY;
m_lockToCameraX = a2->m_lockToCameraX;
m_lockToCameraY = a2->m_lockToCameraY;
m_moveModX = a2->m_moveModX;
m_moveModY = a2->m_moveModY;
if ( (unsigned int)((int)(float)(v43.x / fmaxf(1.0, a2->m_duration)) + 999999) > 0x1E847E
|| (m_lockToPlayerX || m_lockToCameraX) && fabs(m_moveModX) > 99999.0
|| (m_lockToPlayerY || m_lockToCameraY) && fabs(m_moveModY) > 99999.0 )
{
return;
}
if ( a2->m_isDynamicMode && (a2->m_useMoveTarget || a2->m_isDirectionFollowSnap360) )
{
m_targetModCenterID = a2->m_targetModCenterID;
v41 = a2;
if ( m_targetModCenterID <= 0 )
m_targetModCenterID = a2->m_targetGroupID;
Object = GJBaseGameLayer::tryGetObject(a1, m_targetModCenterID);
v12 = !a2->m_targetPlayer1;
v13 = Object;
v44 = Object;
if ( v12 )
{
if ( !a2->m_targetPlayer2 )
{
m_player2 = (PlayerObject *)GJBaseGameLayer::tryGetObject(a1, a2->m_centerGroupID);
LABEL_19:
v42 = m_player2;
if ( v13 && m_player2 )
{
Mylast = a1->m_gameState.m_dynamicMoveActions._Mypair._Myval2._Mylast;
if ( Mylast == a1->m_gameState.m_dynamicMoveActions._Mypair._Myval2._Myend )
{
sub_1402518B0(&a1->m_gameState.m_dynamicMoveActions, Mylast, &v41, &v44, &v42);
}
else
{
*(_DWORD *)&Mylast->m_unkBool1 = 1;
*(_QWORD *)&Mylast->m_controlID = 0;
Mylast->m_gameObject2 = nullptr;
Mylast->m_gameObject3 = nullptr;
Mylast->m_centerGroupID = 0;
Mylast->m_gameObject4 = nullptr;
Mylast->m_gameObject5 = nullptr;
Mylast->m_gameObject6 = nullptr;
Mylast->m_gameObject7 = nullptr;
Mylast->m_gameObject8 = nullptr;
*(_QWORD *)&Mylast->m_unkFloat1 = 0;
Mylast->m_unkFloat3 = 0.0;
Mylast->m_gameObject1 = a2;
Mylast->m_controlID = a2->m_controlID;
Mylast->m_targetGroupID = a2->m_targetGroupID;
Mylast->m_centerGroupID = a2->m_centerGroupID;
Mylast->m_gameObject2 = v13;
Mylast->m_gameObject3 = m_player2;
++a1->m_gameState.m_dynamicMoveActions._Mypair._Myval2._Mylast;
}
}
return;
}
if ( a1->m_gameState.m_isDualMode )
{
m_player2 = a1->m_player2;
goto LABEL_19;
}
}
m_player2 = a1->m_player1;
goto LABEL_19;
}
if ( a2->m_useMoveTarget || a2->m_isDirectionFollowSnap360 )
{
m_targetGroupID = a2->m_targetModCenterID;
m_enable22Changes = a1->m_enable22Changes;
if ( m_targetGroupID <= 0 )
m_targetGroupID = a2->m_targetGroupID;
if ( m_enable22Changes )
MainObject = GJBaseGameLayer::tryGetObject(a1, m_targetGroupID);
else
MainObject = GJBaseGameLayer::tryGetMainObject(a1, m_targetGroupID);
v19 = MainObject;
if ( a2->m_targetPlayer1 )
goto LABEL_38;
if ( !a2->m_targetPlayer2 )
{
m_centerGroupID = a2->m_centerGroupID;
if ( m_enable22Changes )
m_player1 = (PlayerObject *)GJBaseGameLayer::tryGetObject(a1, m_centerGroupID);
else
m_player1 = (PlayerObject *)GJBaseGameLayer::tryGetMainObject(a1, m_centerGroupID);
goto LABEL_39;
}
if ( !a1->m_gameState.m_isDualMode )
LABEL_38:
m_player1 = a1->m_player1;
else
m_player1 = a1->m_player2;
LABEL_39:
if ( v19 && m_player1 && v19->m_uniqueID != m_player1->m_uniqueID )
{
v22 = ((__int64 (__fastcall *)(GameObject *, GameObject **))v19->getRealPosition)(v19, &v44);
v23 = ((__int64 (__fastcall *)(PlayerObject *, EffectGameObject **))m_player1->getRealPosition)(m_player1, &v41);
cocos2d::CCPoint::operator-(v23, &v42, v22);
}
else
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v42);
}
cocos2d::CCPoint::operator=(&v43, &v42);
if ( a2->m_isDirectionFollowSnap360 )
{
v24 = cocos2d::ccpNormalize((cocos2d *)&v44, &v43);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator*)(v24, &v42);
cocos2d::CCPoint::operator=(&v43, &v42);
}
m_lockToPlayerX = 0;
m_lockToPlayerY = 0;
m_lockToCameraX = 0;
m_lockToCameraY = 0;
if ( a2->m_useMoveTarget )
{
m_moveTargetMode = a2->m_moveTargetMode;
if ( m_moveTargetMode == XOnly )
{
v43.y = 0.0;
}
else if ( m_moveTargetMode == YOnly )
{
v43.x = 0.0;
}
}
}
if ( a2->m_isSilent )
{
v26 = *(float *)&a2->m_targetGroupID;
y = v43.y;
x = v43.x;
Group = GJBaseGameLayer::getGroup(a1, SLODWORD(v26));
if ( Group )
{
data = Group->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
for ( i = &arr[num - 1]; arr <= i; *((float *)&v34[22].__vftable + 1) = v36 )
{
v34 = *arr;
if ( !*arr )
break;
if ( !LOBYTE(v34[12].m_unknown2) )
*(double *)&v34[17].__vftable = x + *(double *)&v34[17].__vftable;
LOWORD(v34[15].m_uIndexInArray) = 257;
v35 = y + *(double *)&v34[17].m_uID;
*(_WORD *)((char *)&v34[15].m_uID + 1) = 257;
*(double *)&v34[17].m_uID = v35;
a1->updateObjectSection(a1, (GameObject *)v34);
++arr;
v36 = *(double *)&v34[17].m_uID;
*(float *)&v34[22].__vftable = *(double *)&v34[17].__vftable;
}
}
}
m_effectManager = a1->m_effectManager;
*(float *)&v42 = v26;
v38 = sub_1402675E0(&m_effectManager->m_unkMap578, &v41, &v42);
*(double *)(*(_QWORD *)v38 + 24LL) = x + *(double *)(*(_QWORD *)v38 + 24LL);
v39 = sub_1402675E0(&m_effectManager->m_unkMap578, &v41, &v42);
*(double *)(*(_QWORD *)v39 + 32LL) = y + *(double *)(*(_QWORD *)v39 + 32LL);
}
else
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v42);
GJEffectManager::createMoveCommand(
a1->m_effectManager,
v40,
a2->m_targetGroupID,
a2->m_duration,
a2->m_easingType,
a2->m_easingRate,
m_lockToPlayerX,
m_lockToPlayerY,
m_lockToCameraX,
m_lockToCameraY,
m_moveModX,
m_moveModY,
a2->m_uniqueID,
a2->m_controlID);
}
}