//
// GJBaseGameLayer::processAdvancedFollowAction from 0x48a0d8 to 0x48ae6a (3474 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::processAdvancedFollowActions @ 0x494620
//
// 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::processAdvancedFollowAction(GJBaseGameLayer *a1, AdvancedFollowInstance *a2, bool a3, float a4)
{
float v4; // s16
float v5; // s23
float v6; // s25
float v7; // s26
float v8; // s27
float v9; // s28
float v10; // s29
std::unordered_map> *p_m_targetGroups; // r6
AdvancedFollowTriggerObject *m_gameObject; // r7
int v16; // r6
int v17; // r3
cocos2d::CCArray *Group; // r0
cocos2d::ccArray *data; // r3
GameObject *v20; // r5
GJGameState *p_m_gameState; // r0
GameObjectPhysics *v22; // r11
float m_delay; // s14
float *p_m_delayVariance; // r3
float m_delayVariance; // s15
bool v26; // zf
float Length; // r0
int m_otherObjectKey; // r1
float *p_m_maxSpeedVariance; // r3
float m_maxSpeedVariance; // s15
float m_acceleration; // s17
float *p_m_accelerationVariance; // r3
float v33; // s15
float v34; // s24
bool v35; // zf
float *p_m_maxRangeVariance; // r3
float v37; // s15
bool v38; // zf
float v39; // s18
GameObject *MainObject; // r0
float v41; // s15
float m_startSpeed; // s18
float m_startSpeedVariance; // s19
float v44; // s18
float m_startDirection; // s19
float m_startDirectionVariance; // s21
int m_startMode; // r3
_BOOL4 m_exclusive; // r2
unsigned int v49; // r3
int m_followMode; // r3
float v51; // s17
const cocos2d::CCPoint *p_m_unkPoint2; // r9
int v53; // r2
bool v54; // r3
float *p_m_steerForceVariance; // r3
float m_steerForceVariance; // s16
float v57; // s18
float *p_m_steerForceLowVariance; // r3
float m_steerForceLowVariance; // s15
float *p_m_steerFroceHighVariance; // r3
float m_steerFroceHighVariance; // s15
float m_speedRangeLow; // s31
float *p_m_speedRangeLowVariance; // r3
float v64; // s15
bool v65; // zf
float *p_m_speedRangeHighVariance; // r3
float m_speedRangeHighVariance; // s15
float *p_m_breakForceVariance; // r3
float m_breakForceVariance; // s14
float v70; // s15
float *p_m_breakAngleVariance; // r3
float m_breakAngleVariance; // s14
float v73; // s16
float v74; // s21
float *p_m_breakSteerForceVariance; // r3
float m_breakSteerForceVariance; // s15
float *p_m_breakSteerSpeedLimitVariance; // r3
float m_breakSteerSpeedLimitVariance; // s15
float v79; // s30
float Angle; // s26
float v81; // r0
float v82; // r0
float v83; // s18
float v84; // s24
float v85; // r0
float x; // s13
float y; // s15
float v88; // r0
int v89; // r2
bool v90; // r3
float v91; // s14
float v92; // s15
float v93; // s13
float v94; // s16
int v95; // r10
float *p_m_nearDistanceVariance; // r3
float m_nearDistanceVariance; // s15
bool v98; // zf
float m_friction; // s13
float *p_m_frictionVariance; // r3
float v101; // s14
bool v102; // zf
float v103; // s16
float v104; // s18
float v105; // s16
float m_nearAcceleration; // s14
float *p_m_nearAccelerationVariance; // r3
float m_nearAccelerationVariance; // s15
bool v109; // zf
float v110; // s16
float *p_m_nearFrictionVariance; // r3
float v112; // s13
float v113; // s15
bool v114; // zf
float v115; // s15
float *p_m_easingVariance; // r3
float m_easingVariance; // s15
bool v118; // zf
float v119; // s15
float m_unkFloat1; // s17
float m_rotateEasing; // s16
float v122; // r0
float v123; // s16
float v124; // r0
int v125; // r2
float v126; // s16
float v127; // r0
PlayerObject *p_m_unkPoint1; // r9
float v129; // s15
float v130; // s15
int v131; // r2
bool v132; // r3
float v133; // r2
int v134; // r2
cocos2d::CCArray *v135; // r0
cocos2d::CCArray *v136; // r10
GameObjectPhysics *GameObjectPhysics; // r0
signed int m_commandIndex; // r2
cocos2d::CCArray *TargetGroup; // r0
bool v140; // [sp+Ch] [bp-80h]
int i; // [sp+10h] [bp-7Ch]
GameObject **arr; // [sp+14h] [bp-78h]
int v143; // [sp+18h] [bp-74h]
int m_objectKey; // [sp+1Ch] [bp-70h]
_BOOL4 m_rotateDirection; // [sp+20h] [bp-6Ch]
GameObject **v146; // [sp+24h] [bp-68h]
float m_maxSpeed; // [sp+28h] [bp-64h]
_BOOL4 m_targetDirection; // [sp+2Ch] [bp-60h]
float m_steerForceLow; // [sp+30h] [bp-5Ch]
float m_steerForceHigh; // [sp+34h] [bp-58h]
float m_speedRangeHigh; // [sp+38h] [bp-54h]
float m_breakSteerForce; // [sp+3Ch] [bp-50h]
float m_breakSteerSpeedLimit; // [sp+40h] [bp-4Ch]
_BOOL4 v154; // [sp+44h] [bp-48h]
unsigned int SpecialKey; // [sp+50h] [bp-3Ch] BYREF
cocos2d::CCPoint v156; // [sp+54h] [bp-38h] BYREF
cocos2d::CCPoint v157; // [sp+5Ch] [bp-30h] BYREF
cocos2d::CCPoint v158; // [sp+64h] [bp-28h] BYREF
cocos2d::CCPoint v159; // [sp+6Ch] [bp-20h] BYREF
cocos2d::CCPoint v160; // [sp+74h] [bp-18h] BYREF
cocos2d::CCPoint v161; // [sp+7Ch] [bp-10h] BYREF
cocos2d::CCPoint v162; // 0:kr00_8.8
p_m_targetGroups = &a1->m_targetGroups;
m_gameObject = a2->m_gameObject;
v154 = a3;
SpecialKey = GJBaseGameLayer::getSpecialKey(
a1,
a2->m_group,
m_gameObject->m_ignoreGroupParent,
m_gameObject->m_ignoreLinkedObjects);
if ( sub_46C73E(p_m_targetGroups, SpecialKey) )
v16 = *std::__detail::_Map_base>,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,true>::operator[](
p_m_targetGroups,
&SpecialKey);
else
v16 = 0;
m_objectKey = a2->m_objectKey;
m_rotateDirection = m_gameObject->m_rotateDirection;
if ( v16 <= 0 )
v17 = 1;
else
v17 = 2;
v143 = v17;
for ( i = 0; i != v143; ++i )
{
if ( v16 <= 0 )
Group = GJBaseGameLayer::getGroup(a1, a2->m_group);
else
Group = (cocos2d::CCArray *)cocos2d::CCArray::objectAtIndex(a1->m_targetGroupsArray, v16 - 1 + i);
if ( Group )
{
data = Group->data;
if ( data->num )
{
arr = (GameObject **)data->arr;
v146 = &arr[data->num] + 0x3FFFFFFF;
while ( 1 )
{
while ( 1 )
{
while ( 1 )
{
if ( arr > v146 )
goto LABEL_12;
v20 = *arr++;
if ( !v20 )
goto LABEL_12;
p_m_gameState = &a1->m_gameState;
if ( !v154 )
break;
GameObjectPhysics = GJGameState::getGameObjectPhysics(p_m_gameState, v20);
m_commandIndex = a1->m_gameState.m_commandIndex;
if ( GameObjectPhysics->m_unkInt2 < m_commandIndex )
{
GameObjectPhysics->m_unkInt2 = m_commandIndex;
if ( i == 1 )
{
TargetGroup = GJBaseGameLayer::getTargetGroup(a1, v16, v20->m_uniqueID);
GJBaseGameLayer::moveObjects(a1, TargetGroup, 0.0, 0.0, 0);
}
else
{
GJBaseGameLayer::moveObject(a1, v20, 0.0, 0.0, 0);
}
}
}
v22 = GJGameState::getGameObjectPhysics(p_m_gameState, v20);
if ( v22->m_unkInt3 < (signed int)a1->m_gameState.m_commandIndex )
{
m_delay = m_gameObject->m_delay;
p_m_delayVariance = &m_gameObject->m_delayVariance;
m_delayVariance = m_gameObject->m_delayVariance;
v26 = m_delayVariance == 0.0;
if ( m_delayVariance == 0.0 )
m_delayVariance = 0.0;
else
p_m_delayVariance = (float *)v20->m_varianceIndex;
if ( !v26 )
m_delayVariance = m_delayVariance * *((float *)&a1->m_uID + (_DWORD)p_m_delayVariance + 666);
GJBaseGameLayer::getSavedPosition(&v156, a1, m_objectKey, m_delay + m_delayVariance);
if ( (!m_gameObject->m_ignoreDisabled || !v20->m_isGroupDisabled) && (v156.x != 0.0 || v156.y != 0.0) )
{
v20->getRealPosition(&v161, v20);
cocos2d::CCPoint::operator-(&v157, &v156, &v161);
Length = cocos2d::CCPoint::getLength(&v157);
m_otherObjectKey = a2->m_otherObjectKey;
p_m_maxSpeedVariance = &m_gameObject->m_maxSpeedVariance;
m_maxSpeed = m_gameObject->m_maxSpeed;
m_maxSpeedVariance = m_gameObject->m_maxSpeedVariance;
if ( m_maxSpeedVariance == 0.0 )
v5 = 0.0;
else
p_m_maxSpeedVariance = (float *)v20->m_varianceIndex;
if ( m_maxSpeedVariance != 0.0 )
v5 = *((float *)&a1->m_uID + (_DWORD)p_m_maxSpeedVariance + 667);
m_acceleration = m_gameObject->m_acceleration;
p_m_accelerationVariance = &m_gameObject->m_accelerationVariance;
if ( m_maxSpeedVariance != 0.0 )
v5 = m_maxSpeedVariance * v5;
v33 = *p_m_accelerationVariance;
v34 = Length;
v35 = *p_m_accelerationVariance == 0.0;
if ( *p_m_accelerationVariance == 0.0 )
v4 = 0.0;
else
p_m_accelerationVariance = (float *)v20->m_varianceIndex;
if ( !v35 )
v4 = *((float *)&a1->m_uID + (_DWORD)(p_m_accelerationVariance + 167));
p_m_maxRangeVariance = &m_gameObject->m_maxRangeVariance;
if ( !v35 )
v4 = v33 * v4;
v37 = *p_m_maxRangeVariance;
v38 = *p_m_maxRangeVariance == 0.0;
if ( *p_m_maxRangeVariance == 0.0 )
v37 = 0.0;
else
p_m_maxRangeVariance = (float *)v20->m_varianceIndex;
if ( !v38 )
{
m_delay = *((float *)&a1->m_uID + (_DWORD)p_m_maxRangeVariance + 669);
v37 = v37 * m_delay;
}
v39 = m_gameObject->m_maxRange + v37;
if ( m_otherObjectKey > 0
&& (MainObject = GJBaseGameLayer::tryGetMainObject(a1, m_otherObjectKey)) != nullptr )
{
MainObject->getRealPosition(&v160, MainObject);
cocos2d::CCPoint::operator-(&v161, &v156, &v160);
v41 = cocos2d::CCPoint::getLength(&v161);
}
else
{
v41 = v34;
}
if ( m_gameObject->m_xOnly )
{
v157.y = 0.0;
}
else if ( m_gameObject->m_yOnly )
{
v157.x = 0.0;
}
if ( v39 == 0.0 || v41 <= v39 )
break;
}
}
}
if ( !a2->m_processed )
{
m_startSpeed = m_gameObject->m_startSpeed;
m_startSpeedVariance = m_gameObject->m_startSpeedVariance;
v41 = GameToolbox::fast_rand_0_1();
v44 = m_startSpeed + (float)(m_startSpeedVariance * v41);
if ( v44 != 0.0 )
{
m_startDirection = m_gameObject->m_startDirection;
m_startDirectionVariance = m_gameObject->m_startDirectionVariance;
v41 = GameToolbox::fast_rand_0_1();
GJBaseGameLayer::getFollowSpeedVal(
&v161,
a1,
v20,
m_gameObject->m_startSpeedReference,
m_gameObject->m_startDirectionReference,
m_startDirection + (float)(m_startDirectionVariance * v41),
v44);
if ( v22->m_unkInt2 && (m_startMode = m_gameObject->m_startMode, m_startMode != 1) )
{
if ( m_startMode == 2 )
{
if ( !m_gameObject->m_xOnly )
{
m_delay = v161.y;
v41 = v22->m_unkPoint1.y + v161.y;
v22->m_unkPoint1.y = v41;
}
if ( !m_gameObject->m_yOnly )
{
m_delay = v161.x;
v41 = v22->m_unkPoint1.x + v161.x;
v22->m_unkPoint1.x = v41;
}
}
}
else
{
if ( !m_gameObject->m_xOnly )
v22->m_unkPoint1.y = v161.y;
if ( !m_gameObject->m_yOnly )
v22->m_unkPoint1.x = v161.x;
}
}
}
m_exclusive = m_gameObject->m_exclusive;
a2->m_processed = 1;
v49 = a1->m_gameState.m_commandIndex;
v22->m_unkInt2 = v49;
if ( m_exclusive )
v22->m_unkInt3 = v49;
m_followMode = m_gameObject->m_followMode;
v51 = (float)(m_acceleration + v4) * 0.01;
if ( m_followMode == 2 )
{
p_m_unkPoint2 = &v22->m_unkPoint2;
m_targetDirection = m_gameObject->m_targetDirection;
cocos2d::CCPoint::CCPoint(&v159, &v22->m_unkPoint2);
cocos2d::ccpNormalize(&v160, &v157);
if ( cocos2d::CCPoint::isZero(&v22->m_unkPoint2) )
cocos2d::CCPoint::operator=((PlayerObject *)&v22->m_unkPoint2, COERCE_FLOAT(&v160), v53, v54);
p_m_steerForceVariance = &m_gameObject->m_steerForceVariance;
m_steerForceVariance = m_gameObject->m_steerForceVariance;
if ( m_steerForceVariance == 0.0 )
v41 = 0.0;
else
p_m_steerForceVariance = (float *)v20->m_varianceIndex;
if ( m_steerForceVariance != 0.0 )
v41 = m_steerForceVariance * *((float *)&a1->m_uID + (_DWORD)p_m_steerForceVariance + 675);
v57 = (float)(m_gameObject->m_steerForce + v41) * 0.01;
p_m_steerForceLowVariance = &m_gameObject->m_steerForceLowVariance;
m_steerForceLow = m_gameObject->m_steerForceLow;
m_steerForceLowVariance = m_gameObject->m_steerForceLowVariance;
if ( m_steerForceLowVariance == 0.0 )
v9 = 0.0;
else
p_m_steerForceLowVariance = (float *)v20->m_varianceIndex;
if ( m_steerForceLowVariance != 0.0 )
v9 = m_steerForceLowVariance * *((float *)&a1->m_uID + (_DWORD)(p_m_steerForceLowVariance + 169));
p_m_steerFroceHighVariance = &m_gameObject->m_steerFroceHighVariance;
m_steerForceHigh = m_gameObject->m_steerForceHigh;
m_steerFroceHighVariance = m_gameObject->m_steerFroceHighVariance;
if ( m_steerFroceHighVariance == 0.0 )
v7 = 0.0;
else
p_m_steerFroceHighVariance = (float *)v20->m_varianceIndex;
if ( m_steerFroceHighVariance != 0.0 )
v7 = *((float *)&a1->m_uID + (_DWORD)p_m_steerFroceHighVariance + 677);
m_speedRangeLow = m_gameObject->m_speedRangeLow;
p_m_speedRangeLowVariance = &m_gameObject->m_speedRangeLowVariance;
if ( m_steerFroceHighVariance != 0.0 )
v7 = m_steerFroceHighVariance * v7;
v64 = *p_m_speedRangeLowVariance;
v65 = *p_m_speedRangeLowVariance == 0.0;
if ( *p_m_speedRangeLowVariance == 0.0 )
v10 = 0.0;
else
p_m_speedRangeLowVariance = (float *)v20->m_varianceIndex;
if ( !v65 )
v10 = v64 * *((float *)&a1->m_uID + (_DWORD)p_m_speedRangeLowVariance + 678);
p_m_speedRangeHighVariance = &m_gameObject->m_speedRangeHighVariance;
m_speedRangeHigh = m_gameObject->m_speedRangeHigh;
m_speedRangeHighVariance = m_gameObject->m_speedRangeHighVariance;
if ( m_speedRangeHighVariance == 0.0 )
v8 = 0.0;
else
p_m_speedRangeHighVariance = (float *)v20->m_varianceIndex;
if ( m_speedRangeHighVariance != 0.0 )
v8 = *((float *)&a1->m_uID + (_DWORD)p_m_speedRangeHighVariance + 679);
p_m_breakForceVariance = &m_gameObject->m_breakForceVariance;
m_breakForceVariance = m_gameObject->m_breakForceVariance;
if ( m_speedRangeHighVariance != 0.0 )
v8 = m_speedRangeHighVariance * v8;
if ( m_breakForceVariance == 0.0 )
m_speedRangeHighVariance = 0.0;
else
p_m_breakForceVariance = (float *)v20->m_varianceIndex;
if ( m_breakForceVariance != 0.0 )
m_speedRangeHighVariance = m_breakForceVariance
* *((float *)&a1->m_uID + (_DWORD)(p_m_breakForceVariance + 170));
v70 = m_gameObject->m_breakForce + m_speedRangeHighVariance;
p_m_breakAngleVariance = &m_gameObject->m_breakAngleVariance;
m_breakAngleVariance = m_gameObject->m_breakAngleVariance;
if ( m_breakAngleVariance != 0.0 )
p_m_breakAngleVariance = (float *)v20->m_varianceIndex;
v73 = v70 * 0.01;
if ( m_breakAngleVariance == 0.0 )
v70 = 0.0;
else
p_m_breakAngleVariance = (float *)((char *)p_m_breakAngleVariance + 681);
if ( m_breakAngleVariance != 0.0 )
v70 = m_breakAngleVariance * *((float *)&a1->m_uID + (_DWORD)p_m_breakAngleVariance);
v74 = (float)(m_gameObject->m_breakAngle + v70) * 0.017453;
p_m_breakSteerForceVariance = &m_gameObject->m_breakSteerForceVariance;
m_breakSteerForce = m_gameObject->m_breakSteerForce;
m_breakSteerForceVariance = m_gameObject->m_breakSteerForceVariance;
if ( m_breakSteerForceVariance == 0.0 )
v34 = 0.0;
else
p_m_breakSteerForceVariance = (float *)v20->m_varianceIndex;
if ( m_breakSteerForceVariance != 0.0 )
v34 = m_breakSteerForceVariance * *((float *)&a1->m_uID + (_DWORD)p_m_breakSteerForceVariance + 682);
p_m_breakSteerSpeedLimitVariance = &m_gameObject->m_breakSteerSpeedLimitVariance;
m_breakSteerSpeedLimit = m_gameObject->m_breakSteerSpeedLimit;
m_breakSteerSpeedLimitVariance = m_gameObject->m_breakSteerSpeedLimitVariance;
if ( m_breakSteerSpeedLimitVariance == 0.0 )
v6 = 0.0;
else
p_m_breakSteerSpeedLimitVariance = (float *)v20->m_varianceIndex;
if ( m_breakSteerSpeedLimitVariance != 0.0 )
v6 = m_breakSteerSpeedLimitVariance
* *((float *)&a1->m_uID + (_DWORD)p_m_breakSteerSpeedLimitVariance + 682);
v79 = fabsf(cocos2d::CCPoint::getLength(&v22->m_unkPoint1));
if ( m_gameObject->m_steerForceLowEnabled && (v10 = m_speedRangeLow + v10, v79 <= v10) )
{
v9 = m_steerForceLow + v9;
v57 = v9 * 0.01;
}
else if ( m_gameObject->m_steerForceHighEnabled )
{
v8 = m_speedRangeHigh + v8;
if ( v79 >= v8 && v8 > 0.0 )
v57 = (float)(m_steerForceHigh + v7) * 0.01;
}
Angle = cocos2d::CCPoint::getAngle(&v160);
v81 = cocos2d::CCPoint::getAngle(&v22->m_unkPoint2);
v82 = GJBaseGameLayer::convertToClosestDirection(Angle - v81, 3.1416);
v7 = v82;
if ( v73 > 0.0 && fabsf(v82) > v74 )
{
v6 = m_breakSteerSpeedLimit + v6;
if ( v79 > v6 )
v57 = (float)(m_breakSteerForce + v34) * 0.01;
}
v83 = v22->m_unkFloat2 + (float)((float)(v57 - v22->m_unkFloat2) / 10.0);
v22->m_unkFloat2 = v83;
if ( v82 < 0.0 )
{
v83 = -v83;
if ( v83 < v82 )
v83 = v82;
}
else if ( v83 > v82 )
{
v83 = v82;
}
if ( v83 != 0.0 )
{
v84 = cosf(v83 * a4);
v85 = sinf(v83 * a4);
x = v22->m_unkPoint1.x;
y = v22->m_unkPoint1.y;
if ( !m_gameObject->m_xOnly )
v22->m_unkPoint1.y = (float)(x * v85) + (float)(y * v84);
if ( !m_gameObject->m_yOnly )
v22->m_unkPoint1.x = (float)(x * v84) - (float)(y * v85);
v88 = cocos2d::CCPoint::getAngle(&v22->m_unkPoint2);
cocos2d::ccpForAngle(&v161, v88 + (float)(v83 * a4));
cocos2d::CCPoint::operator=((PlayerObject *)&v22->m_unkPoint2, COERCE_FLOAT(&v161), v89, v90);
}
if ( v73 > 0.0 && (float)(fabsf(v7 - v83) - v74) > 0.0 )
{
v91 = v22->m_unkPoint1.x;
v92 = fabsf((float)(v73 * v22->m_unkPoint2.x) * a4);
if ( v91 < 0.0 )
{
v92 = -v92;
if ( v91 >= v92 )
v92 = v22->m_unkPoint1.x;
}
else if ( v91 <= v92 )
{
v92 = v22->m_unkPoint1.x;
}
v93 = v22->m_unkPoint1.y;
v94 = fabsf((float)(v73 * v22->m_unkPoint2.y) * a4);
if ( v93 < 0.0 )
{
v94 = -v94;
if ( v93 >= v94 )
v94 = v22->m_unkPoint1.y;
}
else if ( v93 <= v94 )
{
v94 = v22->m_unkPoint1.y;
}
if ( !m_gameObject->m_xOnly )
v22->m_unkPoint1.y = v93 - v94;
if ( !m_gameObject->m_yOnly )
v22->m_unkPoint1.x = v91 - v92;
v51 = 0.0;
}
if ( m_targetDirection )
p_m_unkPoint2 = &v160;
cocos2d::CCPoint::CCPoint(&v161, p_m_unkPoint2);
if ( !m_gameObject->m_xOnly )
v22->m_unkPoint1.y = v22->m_unkPoint1.y + (float)((float)(v51 * v161.y) * a4);
if ( !m_gameObject->m_yOnly )
v22->m_unkPoint1.x = v22->m_unkPoint1.x + (float)((float)(v51 * v161.x) * a4);
v95 = 0;
}
else
{
if ( m_followMode == 1 )
{
p_m_nearDistanceVariance = &m_gameObject->m_nearDistanceVariance;
m_nearDistanceVariance = m_gameObject->m_nearDistanceVariance;
v98 = m_nearDistanceVariance == 0.0;
if ( m_nearDistanceVariance == 0.0 )
m_nearDistanceVariance = 0.0;
else
p_m_nearDistanceVariance = (float *)v20->m_varianceIndex;
if ( !v98 )
m_delay = *((float *)&a1->m_uID + (_DWORD)(p_m_nearDistanceVariance + 168));
m_friction = m_gameObject->m_friction;
p_m_frictionVariance = &m_gameObject->m_frictionVariance;
if ( !v98 )
m_nearDistanceVariance = m_nearDistanceVariance * m_delay;
v101 = *p_m_frictionVariance;
v102 = *p_m_frictionVariance == 0.0;
if ( *p_m_frictionVariance != 0.0 )
p_m_frictionVariance = (float *)v20->m_varianceIndex;
v103 = m_gameObject->m_nearDistance + m_nearDistanceVariance;
if ( v102 )
m_nearDistanceVariance = 0.0;
else
p_m_frictionVariance = (float *)((char *)p_m_frictionVariance + 673);
if ( !v102 )
m_nearDistanceVariance = v101 * *((float *)&a1->m_uID + (_DWORD)p_m_frictionVariance);
v104 = (float)(m_friction + m_nearDistanceVariance) * 0.01;
cocos2d::ccpNormalize(&v159, &v157);
if ( v103 > 0.0 && v34 < v103 )
{
v105 = v34 / v103;
m_nearAcceleration = m_gameObject->m_nearAcceleration;
p_m_nearAccelerationVariance = &m_gameObject->m_nearAccelerationVariance;
m_nearAccelerationVariance = m_gameObject->m_nearAccelerationVariance;
v109 = m_nearAccelerationVariance == 0.0;
if ( m_nearAccelerationVariance == 0.0 )
m_nearAccelerationVariance = 0.0;
else
p_m_nearAccelerationVariance = (float *)v20->m_varianceIndex;
if ( !v109 )
p_m_nearAccelerationVariance = (float *)(&a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable
+ (_DWORD)p_m_nearAccelerationVariance
+ 674);
v110 = 1.0 - v105;
if ( !v109 )
m_friction = p_m_nearAccelerationVariance[1];
p_m_nearFrictionVariance = &m_gameObject->m_nearFrictionVariance;
if ( !v109 )
m_nearAccelerationVariance = m_nearAccelerationVariance * m_friction;
v112 = *p_m_nearFrictionVariance;
v113 = m_nearAcceleration + m_nearAccelerationVariance;
v114 = *p_m_nearFrictionVariance == 0.0;
if ( *p_m_nearFrictionVariance != 0.0 )
p_m_nearFrictionVariance = (float *)v20->m_varianceIndex;
v115 = v113 * 0.01;
if ( v114 )
m_nearAcceleration = 0.0;
else
p_m_nearFrictionVariance = (float *)((char *)p_m_nearFrictionVariance + 675);
if ( !v114 )
m_nearAcceleration = v112 * *((float *)&a1->m_uID + (_DWORD)p_m_nearFrictionVariance);
v51 = v51 + (float)(v110 * (float)(v115 - v51));
v104 = v104
+ (float)(v110
* (float)((float)((float)(m_gameObject->m_nearFriction + m_nearAcceleration) * 0.01) - v104));
}
if ( v104 != 0.0 )
{
cocos2d::CCPoint::operator*(&v161, &v22->m_unkPoint1, v104 * a4);
cocos2d::CCPoint::operator-(&v160, &v22->m_unkPoint1, &v161);
if ( !m_gameObject->m_xOnly )
v22->m_unkPoint1.y = v160.y;
if ( !m_gameObject->m_yOnly )
v22->m_unkPoint1.x = v160.x;
}
cocos2d::CCPoint::operator*(&v161, &v159, v51 * a4);
cocos2d::CCPoint::operator+(&v160, &v22->m_unkPoint1, &v161);
if ( !m_gameObject->m_xOnly )
v22->m_unkPoint1.y = v160.y;
if ( !m_gameObject->m_yOnly )
v22->m_unkPoint1.x = v160.x;
v95 = 0;
}
else
{
p_m_easingVariance = &m_gameObject->m_easingVariance;
m_easingVariance = m_gameObject->m_easingVariance;
v118 = m_easingVariance == 0.0;
if ( m_easingVariance == 0.0 )
m_easingVariance = 0.0;
else
p_m_easingVariance = (float *)v20->m_varianceIndex;
if ( !v118 )
m_easingVariance = m_easingVariance * *((float *)&a1->m_uID + (_DWORD)(p_m_easingVariance + 168));
v119 = m_gameObject->m_easing + m_easingVariance;
if ( v119 > 1.0 )
{
v95 = 0;
}
else
{
v119 = 1.0;
v95 = 1;
}
cocos2d::CCPoint::operator*(&v161, &v157, 1.0 / v119);
if ( !m_gameObject->m_xOnly )
v22->m_unkPoint1.y = v161.y;
if ( !m_gameObject->m_yOnly )
v22->m_unkPoint1.x = v161.x;
}
if ( v34 >= m_gameObject->m_rotateDeadZ )
v22->m_unkFloat1 = cocos2d::CCPoint::getAngle(&v22->m_unkPoint1);
m_unkFloat1 = v22->m_unkFloat1;
m_rotateEasing = m_gameObject->m_rotateEasing;
if ( m_rotateEasing <= 1.0 )
m_rotateEasing = 1.0;
v122 = cocos2d::CCPoint::getAngle(&v22->m_unkPoint2);
v123 = GJBaseGameLayer::convertToClosestDirection(m_unkFloat1 - v122, 3.1416) / m_rotateEasing;
v124 = cocos2d::CCPoint::getAngle(&v22->m_unkPoint2);
cocos2d::ccpForAngle(&v161, v124 + v123);
cocos2d::CCPoint::operator=((PlayerObject *)&v22->m_unkPoint2, COERCE_FLOAT(&v161), v125, (bool)&v161);
}
if ( m_rotateDirection )
{
v126 = (float)(90.0 - (float)(cocos2d::CCPoint::getAngle(&v22->m_unkPoint2) * 57.296))
+ m_gameObject->m_rotationOffset;
v127 = v20->getRotation(v20);
v4 = GJBaseGameLayer::convertToClosestDirection(v126 - v127, 180.0) * 0.25;
}
else
{
v4 = 0.0;
}
p_m_unkPoint1 = (PlayerObject *)&v22->m_unkPoint1;
v129 = cocos2d::CCPoint::getLength(&v22->m_unkPoint1);
if ( m_gameObject->m_xOnly )
break;
if ( m_gameObject->m_yOnly )
{
v130 = v22->m_unkPoint1.y;
goto LABEL_244;
}
LABEL_245:
v5 = m_maxSpeed + v5;
if ( v129 > v5 && v5 > 0.0 )
{
v5 = v5 / v129;
if ( m_gameObject->m_xOnly )
{
v5 = v22->m_unkPoint1.x * v5;
v22->m_unkPoint1.x = v5;
}
else if ( m_gameObject->m_yOnly )
{
v5 = v22->m_unkPoint1.y * v5;
v22->m_unkPoint1.y = v5;
}
else
{
cocos2d::CCPoint::operator*(&v161, p_m_unkPoint1, LODWORD(v5));
cocos2d::CCPoint::operator=(p_m_unkPoint1, COERCE_FLOAT(&v161), v131, v132);
}
}
cocos2d::CCPoint::CCPoint(&v158, &stru_AC68C0);
if ( v95 )
v133 = 1.0;
else
v133 = a4;
cocos2d::CCPoint::operator*(&v159, p_m_unkPoint1, LODWORD(v133));
if ( m_gameObject->m_xOnly )
{
v159.y = 0.0;
}
else if ( m_gameObject->m_yOnly )
{
v159.x = 0.0;
}
if ( v159.x == 0.0 && v159.y == 0.0 )
goto LABEL_267;
if ( i == 1 )
{
if ( v4 != 0.0 )
cocos2d::CCPoint::operator=((PlayerObject *)&v158, COERCE_FLOAT(&v159), v134, 1);
v135 = GJBaseGameLayer::getTargetGroup(a1, v16, v20->m_uniqueID);
GJBaseGameLayer::moveObjects(a1, v135, v159.x, v159.y, 0);
if ( v4 != 0.0 )
{
LABEL_270:
v136 = GJBaseGameLayer::getTargetGroup(a1, v16, v20->m_uniqueID);
GameObject::getUnmodifiedPosition(&v160, v20);
cocos2d::CCPoint::CCPoint(&v161, &v158);
LODWORD(v162.x) = &v160;
LODWORD(v162.y) = &v161;
GJBaseGameLayer::rotateObjects(a1, v136, v4, v162, 0, v140, i);
}
}
else
{
GJBaseGameLayer::moveObject(a1, v20, v159.x, v159.y, 0);
LABEL_267:
if ( v4 != 0.0 )
{
if ( i )
goto LABEL_270;
GJBaseGameLayer::rotateObject(a1, v20, v4);
}
}
}
v130 = v22->m_unkPoint1.x;
LABEL_244:
v129 = fabsf(v130);
goto LABEL_245;
}
}
LABEL_12:
;
}
}