//
// GJEffectManager::createKeyframeCommand from 0x14025cd10 to 0x14025da42 (3378 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::playKeyframeAnimation @ 0x140217dda
// > LevelEditorLayer::updateDebugDraw @ 0x1402e7437
// > ??> @ 0x1406cfe70
//
// 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
//
// Hidden C++ exception states: #wind=2
GroupCommandObject2 *GJEffectManager::createKeyframeCommand(
GJEffectManager *a1,
int a2,
cocos2d::CCArray *a3,
GameObject *a4,
int a5,
int a6,
bool a7,
float a8,
float a9,
float a10,
float a11,
float a12,
float a13,
std::vector *const a14)
{
GroupCommandObject2 *TempGroupCommand; // r12
KeyframeObject **v19; // r13
cocos2d::CCArray *v20; // rdi
std::vector *p_m_keyframes; // rbx
unsigned int v22; // r15d
unsigned __int64 v23; // r8
float v24; // xmm14_4
float v25; // xmm15_4
struct cocos2d::CCObject *v26; // rdi
__int64 v27; // rsi
double v28; // xmm7_8
double v29; // xmm8_8
double v30; // xmm6_8
double v31; // xmm1_8
double v32; // xmm2_8
float v33; // xmm0_4
float v34; // xmm0_4
double v35; // xmm7_8
double v36; // xmm8_8
double v37; // xmm10_8
char m_uIndexInArray_high; // r12
__int64 v39; // r14
const struct cocos2d::CCPoint *v40; // rax
bool v41; // al
bool v42; // al
bool v43; // al
double v44; // xmm2_8
double v45; // xmm0_8
double v46; // xmm2_8
unsigned int v47; // eax
cocos2d::CCArray_vtbl *v48; // r9
double v49; // xmm6_8
double **v50; // rsi
cocos2d::CCArray *v51; // rdi
cocos2d::CCArray *v52; // r14
std::_Vector_val>::pointer Mylast; // r15
std::_Vector_val>::pointer Myfirst; // rbx
double v55; // xmm7_8
int acceptVisitor; // eax
double v57; // xmm1_8
int v58; // edx
double **v59; // rcx
double v60; // xmm6_8
unsigned __int64 v61; // r12
double v62; // xmm0_8
double v63; // xmm8_8
int v64; // r15d
const struct cocos2d::CCPoint **v65; // r14
double *v66; // rbx
float v67; // xmm0_4
__int64 v68; // rdx
double *v69; // rax
double v70; // xmm0_8
int v71; // r11d
std::_Vector_val>::pointer v72; // r10
std::_Vector_val>::pointer v73; // r9
std::_Vector_val>::pointer v74; // rbx
double m_duration; // xmm0_8
__int64 v76; // r8
std::_Vector_val>::pointer v77; // rcx
std::_Vector_val>::pointer Myend; // r8
unsigned __int64 v79; // rbx
int v80; // r15d
unsigned __int64 v81; // r9
__int64 v82; // rdi
std::_Simple_types::value_type *v83; // rdx
KeyframeObject **v84; // rdx
KeyframeObject **v85; // rax
double **v86; // rax
char v87; // [rsp+20h] [rbp-E0h]
unsigned __int64 v88; // [rsp+28h] [rbp-D8h] BYREF
struct cocos2d::CCObject *v89; // [rsp+30h] [rbp-D0h]
double **v90; // [rsp+38h] [rbp-C8h] BYREF
cocos2d::CCArray *v91; // [rsp+40h] [rbp-C0h]
cocos2d::CCArray *v92; // [rsp+48h] [rbp-B8h]
float v93; // [rsp+50h] [rbp-B0h]
float v94; // [rsp+54h] [rbp-ACh]
std::vector *v95; // [rsp+58h] [rbp-A8h] BYREF
std::vector v96; // [rsp+60h] [rbp-A0h] BYREF
std::_Simple_types::value_type *v97; // [rsp+78h] [rbp-88h]
GroupCommandObject2 *v98; // [rsp+80h] [rbp-80h]
float v99; // [rsp+88h] [rbp-78h]
float v100; // [rsp+8Ch] [rbp-74h]
signed int v101; // [rsp+90h] [rbp-70h]
cocos2d::CCPoint v102; // [rsp+98h] [rbp-68h] BYREF
std::_Simple_types::value_type *v103; // [rsp+A0h] [rbp-60h] BYREF
cocos2d::CCPoint v104; // [rsp+A8h] [rbp-58h] BYREF
char v105; // [rsp+B0h] [rbp-50h] BYREF
char v106[168]; // [rsp+B8h] [rbp-48h] BYREF
cocos2d::CCArray *v107; // [rsp+1A0h] [rbp+A0h] BYREF
v107 = a3;
if ( !a3 )
return nullptr;
v100 = fmaxf(0.000099999997, a13);
if ( a7 )
{
TempGroupCommand = GJEffectManager::getTempGroupCommand(a1);
}
else
{
if ( a1->m_unkVector560._Mypair._Myval2._Mylast == a1->m_unkVector560._Mypair._Myval2._Myend )
{
sub_14026B310(&a1->m_unkVector560);
}
else
{
GroupCommandObject2::GroupCommandObject2(a1->m_unkVector560._Mypair._Myval2._Mylast);
++a1->m_unkVector560._Mypair._Myval2._Mylast;
}
TempGroupCommand = a1->m_unkVector560._Mypair._Myval2._Mylast - 1;
}
v98 = TempGroupCommand;
TempGroupCommand->m_commandType = 5;
TempGroupCommand->m_triggerUniqueID = a5;
TempGroupCommand->m_controlID = a6;
TempGroupCommand->m_targetGroupID = a2;
TempGroupCommand->m_centerGroupID = a2;
sub_1400846D0((void **)&TempGroupCommand->m_remapKeys._Mypair._Myval2._Myfirst, (char **)a14);
TempGroupCommand->m_gameObject = a4;
if ( a4 )
TempGroupCommand->m_gameObjectRotation = a4->getRotation(a4);
v19 = nullptr;
v89 = nullptr;
v20 = v107;
v88 = cocos2d::CCArray::count(v107) + 1;
p_m_keyframes = &TempGroupCommand->m_keyframes;
v95 = &TempGroupCommand->m_keyframes;
if ( v88 > TempGroupCommand->m_keyframes._Mypair._Myval2._Myend
- TempGroupCommand->m_keyframes._Mypair._Myval2._Myfirst )
sub_140269450(&TempGroupCommand->m_keyframes, &v88);
cocos2d::CCPoint::CCPoint(&v102);
cocos2d::CCPoint::CCPoint(&v104);
v87 = 0;
v22 = 0;
if ( !cocos2d::CCArray::count(v20) )
goto LABEL_74;
v24 = *(float *)&v107;
v25 = *(float *)&v107;
do
{
v26 = cocos2d::CCArray::objectAtIndex(v20, v22);
if ( p_m_keyframes->_Mypair._Myval2._Mylast == p_m_keyframes->_Mypair._Myval2._Myend )
{
sub_14026B5D0(p_m_keyframes);
}
else
{
sub_14026DC00();
++p_m_keyframes->_Mypair._Myval2._Mylast;
}
v27 = (__int64)&TempGroupCommand->m_keyframes._Mypair._Myval2._Mylast[-1];
*(_DWORD *)(v27 + 388) = v26[16].m_eObjType;
v26->__vftable[16].encodeWithCoder(v26, (DS_Dictionary *)&v88);
v28 = ((float (__fastcall *)(struct cocos2d::CCObject *))v26->__vftable[1].getTag)(v26);
v29 = ((float (__fastcall *)(struct cocos2d::CCObject *))v26->__vftable[2].copyWithZone)(v26);
v30 = ((float (__fastcall *)(struct cocos2d::CCObject *))v26->__vftable[5].copyWithZone)(v26);
v31 = ((float (__fastcall *)(struct cocos2d::CCObject *))v26->__vftable[5].isEqual)(v26);
v32 = fabs(v30 - v31);
if ( v32 > 179.999 && v32 < 180.001 )
{
if ( fabs(v30) <= fabs(v31) )
{
v28 = v28 * -1.0;
goto LABEL_32;
}
if ( v30 <= 0.0 )
v30 = v30 + 180.0;
else
v30 = v30 + -180.0;
goto LABEL_31;
}
if ( v28 < 0.0 && v29 < 0.0 )
{
if ( v30 <= 0.0 )
v30 = v30 + 180.0;
else
v30 = v30 + -180.0;
v28 = v28 * -1.0;
LABEL_31:
v29 = v29 * -1.0;
}
LABEL_32:
if ( v22 )
{
if ( a8 != 1.0 )
*(float *)&v88 = (float)((float)(*(float *)&v88 - v102.x) * a8) + v102.x;
if ( a9 != 1.0 )
*((float *)&v88 + 1) = (float)((float)(*((float *)&v88 + 1) - v102.y) * a9) + v102.y;
if ( a11 != 1.0 )
v28 = a11 * (v28 - v93) + v93;
if ( a12 != 1.0 )
v29 = a12 * (v29 - v94) + v94;
if ( a10 != 1.0 )
v30 = a10 * (v30 - v99) + v99;
v35 = v28 / v93;
v36 = v29 / v94;
}
else
{
cocos2d::CCPoint::operator=(&v102, &v88);
v33 = v30;
v99 = v33;
v34 = v28;
v93 = v34;
v94 = v29;
v35 = 1.0;
v36 = 1.0;
}
cocos2d::CCPoint::operator=(v27 + 392, &v88);
cocos2d::CCPoint::operator=(v27 + 400, &v88);
*(double *)(v27 + 408) = v35;
*(double *)(v27 + 416) = v36;
v37 = (double)(360 * LODWORD(v26[34].__vftable));
*(double *)(v27 + 424) = v37 + v30;
*(double *)v27 = (float)(v100 * *(float *)&v26[26].m_nLuaID);
*(_DWORD *)(v27 + 8) = v26[27].__vftable;
*(_DWORD *)(v27 + 12) = HIDWORD(v26[27].__vftable);
*(_BYTE *)(v27 + 30) = BYTE2(v26[33].m_uIndexInArray);
*(_DWORD *)(v27 + 384) = v26[33].m_uUnknown;
*(float *)(v27 + 440) = (float)((float)LOBYTE(v26[23].m_uOrderOfArrival) / 255.0)
* *((float *)&v26[34].__vftable + 1);
m_uIndexInArray_high = HIBYTE(v26[33].m_uIndexInArray);
v39 = 0;
if ( v89 )
{
v39 = (__int64)&p_m_keyframes->_Mypair._Myval2._Myfirst[v101];
v26->__vftable[16].encodeWithCoder(v26, (DS_Dictionary *)&v105);
v40 = (const struct cocos2d::CCPoint *)((__int64 (__fastcall *)(struct cocos2d::CCObject *, char *))v89->__vftable[16].encodeWithCoder)(
v89,
v106);
v41 = cocos2d::CCPoint::equals(v40);
p_m_keyframes = v95;
if ( v41 )
*(_BYTE *)(v39 + 30) = 0;
}
v42 = (int)v22 > 0 && (m_uIndexInArray_high || v22 < cocos2d::CCArray::count(v107) - 1);
v43 = LOBYTE(v26[33].m_uIndexInArray) && v42;
*(_BYTE *)(v27 + 16) = v43;
if ( v89 )
{
cocos2d::CCPoint::operator-(v27 + 392, &v103, &v104);
cocos2d::CCPoint::operator=(v27 + 392, &v103);
*(double *)(v27 + 408) = *(double *)(v27 + 408) - v24;
*(double *)(v27 + 416) = *(double *)(v27 + 416) - v25;
v44 = *(double *)(v27 + 424) - *(float *)&v97;
*(double *)(v27 + 424) = v44;
v45 = v44 - v37;
if ( v44 - v37 > 180.0 || v45 > 0.0 && v26[33].m_unknown5 == 2 )
{
v46 = v44 - 360.0;
LABEL_66:
*(double *)(v27 + 424) = v46;
}
else if ( v45 < -180.0 || v45 < 0.0 && v26[33].m_unknown5 == 1 )
{
v46 = v44 + 360.0;
goto LABEL_66;
}
*(_DWORD *)(v39 + 20) = v26[26].m_eObjType;
*(_BYTE *)(v39 + 28) = BYTE1(v26[33].m_uIndexInArray);
*(_DWORD *)(v39 + 24) = v26[33].m_nZOrder;
}
v101 = v22;
v89 = v26;
cocos2d::CCPoint::operator=(&v104, &v88);
*(float *)&v97 = v30;
v24 = v35;
v25 = v36;
if ( v87 )
break;
v20 = v107;
if ( v22 == cocos2d::CCArray::count(v107) - 1 && m_uIndexInArray_high )
{
v22 = -1;
v87 = 1;
}
++v22;
v47 = cocos2d::CCArray::count(v20);
TempGroupCommand = v98;
}
while ( v22 < v47 );
TempGroupCommand = v98;
LABEL_74:
v48 = nullptr;
v89 = nullptr;
v95 = nullptr;
v49 = 0.0;
v50 = nullptr;
v90 = nullptr;
v51 = nullptr;
v91 = nullptr;
v52 = nullptr;
v107 = nullptr;
v92 = nullptr;
Mylast = TempGroupCommand->m_keyframes._Mypair._Myval2._Mylast;
v103 = Mylast;
Myfirst = TempGroupCommand->m_keyframes._Mypair._Myval2._Myfirst;
v97 = Myfirst;
if ( Myfirst == Mylast )
goto LABEL_118;
while ( 2 )
{
v88 = (unsigned __int64)Myfirst;
if ( Myfirst->m_unk010 )
{
if ( v50 == (double **)v51 )
{
if ( v51 == v52 )
{
sub_140063110(&v90, v51, &v95);
v52 = v92;
v107 = v92;
v51 = v91;
v50 = v90;
}
else
{
v51->__vftable = v48;
v51 = (cocos2d::CCArray *)((char *)v51 + 8);
v91 = v51;
}
}
if ( v51 == v52 )
{
sub_140063110(&v90, v51, &v88);
v52 = v92;
v107 = v92;
v51 = v91;
v50 = v90;
}
else
{
v51->__vftable = (cocos2d::CCArray_vtbl *)Myfirst;
v51 = (cocos2d::CCArray *)((char *)v51 + 8);
v91 = v51;
}
v49 = v49 + Myfirst->m_unk000;
v48 = (cocos2d::CCArray_vtbl *)v89;
}
else
{
if ( v50 != (double **)v51 )
{
if ( v51 == v52 )
{
sub_140063110(&v90, v51, &v88);
v107 = v92;
v51 = v91;
v50 = v90;
v48 = (cocos2d::CCArray_vtbl *)v89;
}
else
{
v51->__vftable = (cocos2d::CCArray_vtbl *)Myfirst;
v51 = (cocos2d::CCArray *)((char *)v51 + 8);
v91 = v51;
}
v55 = *(double *)&v48->copyWithZone;
acceptVisitor = (int)v48[5].acceptVisitor;
if ( acceptVisitor == 1 )
{
v23 = (((char *)v51 - (char *)v50) >> 3) - 1;
if ( (v23 & 0x8000000000000000uLL) != 0LL )
v57 = (double)(int)(v23 & 1 | (v23 >> 1)) + (double)(int)(v23 & 1 | (v23 >> 1));
else
v57 = (double)(int)v23;
v58 = 0;
if ( ((char *)v51 - (char *)v50) >> 3 != 1 )
{
v59 = v50;
do
{
**v59 = v55 / v57;
++v58;
++v59;
}
while ( v58 < v23 );
}
goto LABEL_103;
}
if ( acceptVisitor == 2 )
{
v60 = 0.0;
v61 = (((char *)v51 - (char *)v50) >> 3) - 1;
if ( (v61 & 0x8000000000000000uLL) != 0LL )
v62 = (double)(int)(v61 & 1 | (v61 >> 1)) + (double)(int)(v61 & 1 | (v61 >> 1));
else
v62 = (double)(int)v61;
v63 = v55 / v62;
v64 = 0;
if ( ((char *)v51 - (char *)v50) >> 3 != 1 )
{
v65 = (const struct cocos2d::CCPoint **)v50;
do
{
v66 = (double *)*v65++;
v67 = cocos2d::ccpDistance((cocos2d *)(v66 + 50), *v65 + 50, (const struct cocos2d::CCPoint *)v23);
v60 = v60 + v67;
*v66 = v67;
++v64;
}
while ( v64 < v61 );
Myfirst = v97;
v48 = (cocos2d::CCArray_vtbl *)v89;
}
v23 = 0;
if ( ((char *)v51 - (char *)v50) >> 3 != 1 )
{
v68 = 0;
do
{
v69 = v50[v68];
if ( v60 == 0.0 )
v70 = v63;
else
v70 = *v69 / v60 * v55;
*v69 = v70;
v23 = (unsigned int)(v23 + 1);
++v68;
}
while ( (int)v23 < (unsigned __int64)((((char *)v51 - (char *)v50) >> 3) - 1) );
}
Mylast = v103;
LABEL_103:
v49 = 0.0;
}
v52 = v107;
if ( SLODWORD(v48->~CCArray) > 0 )
*(double *)&v48[5].isEqual = v55 + v49;
}
v48 = (cocos2d::CCArray_vtbl *)Myfirst;
v89 = (struct cocos2d::CCObject *)Myfirst;
v95 = (std::vector *)Myfirst;
v49 = 0.0;
if ( v50 != (double **)v51 )
{
v51 = (cocos2d::CCArray *)v50;
v91 = (cocos2d::CCArray *)v50;
}
}
v97 = ++Myfirst;
if ( Myfirst != Mylast )
continue;
break;
}
TempGroupCommand = v98;
LABEL_118:
v71 = 0;
v72 = TempGroupCommand->m_keyframes._Mypair._Myval2._Mylast;
v73 = TempGroupCommand->m_keyframes._Mypair._Myval2._Myfirst;
if ( ((__int64)((unsigned __int128)(((char *)v72 - (char *)v73) * (__int128)0x4924924924924925LL) >> 64) >> 7)
+ ((unsigned __int64)((unsigned __int128)(((char *)v72 - (char *)v73) * (__int128)0x4924924924924925LL) >> 64) >> 63)
- 1 )
{
v74 = TempGroupCommand->m_keyframes._Mypair._Myval2._Myfirst;
m_duration = TempGroupCommand->m_duration;
v76 = 0;
do
{
m_duration = m_duration + v74[v76].m_unk000;
TempGroupCommand->m_duration = m_duration;
++v71;
++v76;
v72 = TempGroupCommand->m_keyframes._Mypair._Myval2._Mylast;
v74 = v73;
}
while ( v71 < ((__int64)((unsigned __int128)(((char *)v72 - (char *)v73) * (__int128)0x4924924924924925LL) >> 64) >> 7)
+ ((unsigned __int64)((unsigned __int128)(((char *)v72 - (char *)v73) * (__int128)0x4924924924924925LL) >> 64) >> 63)
- 1 );
}
memset(&v96, 0, sizeof(v96));
v77 = nullptr;
Myend = nullptr;
v79 = v72 - v73;
v80 = 0;
if ( v79 )
{
v81 = 0;
v82 = 0;
do
{
v83 = &TempGroupCommand->m_keyframes._Mypair._Myval2._Myfirst[v82];
if ( v83->m_unk01e && v81 < v79 - 1 )
{
v107 = (cocos2d::CCArray *)&TempGroupCommand->m_keyframes._Mypair._Myval2._Myfirst[v82];
if ( v77 != Myend )
{
*v77++ = v83;
LABEL_138:
v96._Mypair._Myval2._Mylast = v77;
goto LABEL_139;
}
sub_140063110(&v96, v77, &v107);
Myend = v96._Mypair._Myval2._Myend;
v77 = v96._Mypair._Myval2._Mylast;
v19 = v96._Mypair._Myval2._Myfirst;
}
else if ( v19 != v77 )
{
if ( (unsigned __int64)(v77 - v19) < 2 )
{
v84 = v19;
do
(*v84++)->m_unk01e = 0;
while ( v84 != v77 );
}
else
{
v107 = (cocos2d::CCArray *)&TempGroupCommand->m_keyframes._Mypair._Myval2._Myfirst[v82];
if ( v77 == Myend )
{
sub_140063110(&v96, v77, &v107);
v19 = v96._Mypair._Myval2._Myfirst;
}
else
{
*v77 = v83;
v96._Mypair._Myval2._Mylast = v77 + 1;
}
KeyframeObject::setupSpline(*v19, &v96);
Myend = v96._Mypair._Myval2._Myend;
v77 = v96._Mypair._Myval2._Mylast;
v19 = v96._Mypair._Myval2._Myfirst;
}
if ( v19 != v77 )
v77 = v19;
goto LABEL_138;
}
LABEL_139:
++v80;
++v82;
v81 = v80;
}
while ( v80 < v79 );
}
if ( v19 )
{
v85 = v19;
if ( (unsigned __int64)(8 * (Myend - v19)) >= 0x1000 )
{
v19 = (KeyframeObject **)*(v19 - 1);
if ( (unsigned __int64)((char *)v85 - (char *)v19 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v19);
}
if ( v50 )
{
v86 = v50;
if ( (((char *)v52 - (char *)v50) & 0xFFFFFFFFFFFFFFF8uLL) >= 0x1000 )
{
v50 = (double **)*(v50 - 1);
if ( (unsigned __int64)((char *)v86 - (char *)v50 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v50);
}
return TempGroupCommand;
}