//
// EditorUI::createNewKeyframeAnim from 0x140119390 to 0x14011962d (669 bytes)
//
// 4 xrefs:
// > SetGroupIDLayer::onAnim @ 0x1403fbb92
// > ??> @ 0x14066faf0
// > ??> @ 0x14066fb54
// > ??> @ 0x1406c93f0
//
// 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 EditorUI::createNewKeyframeAnim(EditorUI *a1)
{
cocos2d::CCArray *v2; // rax
GameObject *m_selectedObject; // rdx
cocos2d::CCArray *v4; // rdi
__int64 v5; // rcx
cocos2d::CCArray *v6; // rax
cocos2d::ccArray *data; // r12
__int64 num; // rcx
cocos2d::CCObject **arr; // r12
cocos2d::CCObject **v10; // rdi
cocos2d::CCObject *v11; // r15
struct cocos2d::CCObject *v12; // rax
cocos2d::CCObject_vtbl *v13; // r14
__int64 copyWithZone_low; // rax
bool (__fastcall *isEqual)(cocos2d::CCObject *__hidden, const cocos2d::CCObject *); // r14
unsigned __int64 v16; // r13
int v17; // ebx
const struct cocos2d::CCPoint *v18; // rax
cocos2d::CCPoint v19; // rax
KeyframeGameObject *Object; // rsi
LevelEditorLayer *m_editorLayer; // rbx
__int64 v22; // rcx
struct cocos2d::CCObject *v23; // rdi
cocos2d::CCObject **v24; // [rsp+70h] [rbp+8h]
cocos2d::CCArray *v25; // [rsp+78h] [rbp+10h]
cocos2d::CCObject **v26; // [rsp+80h] [rbp+18h]
cocos2d::CCPoint v27; // [rsp+88h] [rbp+20h] BYREF
if ( a1->m_selectedObject || cocos2d::CCArray::count(a1->m_selectedObjects) )
{
v2 = (cocos2d::CCArray *)cocos2d::CCArray::create(a1);
m_selectedObject = a1->m_selectedObject;
v4 = v2;
if ( m_selectedObject )
cocos2d::CCArray::addObject(v2, m_selectedObject);
else
cocos2d::CCArray::addObjectsFromArray(v2, a1->m_selectedObjects);
EditorUI::deselectAll(a1);
((void (__fastcall *)(LevelEditorLayer *))a1->m_editorLayer->updateVisibility)(a1->m_editorLayer);
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
v25 = v6;
if ( v4 )
{
data = v4->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
v24 = arr;
v10 = &arr[num - 1];
v26 = v10;
if ( arr <= v10 )
{
do
{
v11 = *arr;
if ( !*arr )
break;
if ( BYTE2(v11[21].__vftable) )
{
v12 = cocos2d::CCDictionary::objectForKey(
a1->m_editorLayer->m_parentGroupIDs,
(unsigned int)v11[16].m_eObjType);
if ( v12 )
{
v13 = v12[1].__vftable;
copyWithZone_low = LODWORD(v13->copyWithZone);
if ( (_DWORD)copyWithZone_low )
{
isEqual = v13->isEqual;
v16 = (unsigned __int64)isEqual + 8 * copyWithZone_low - 8;
if ( (unsigned __int64)isEqual <= v16 )
{
do
{
if ( !*(_QWORD *)isEqual )
break;
v17 = *(_DWORD *)(*(_QWORD *)isEqual + 56LL);
v18 = (const struct cocos2d::CCPoint *)((__int64 (__fastcall *)(cocos2d::CCObject *))v11->__vftable[2].getTag)(v11);
cocos2d::CCPoint::CCPoint(&v27, v18);
Object = (KeyframeGameObject *)EditorUI::createObject(a1, 3032, v19);
LevelEditorLayer::removeSpecial(a1->m_editorLayer, Object);
cocos2d::CCArray::addObject(v25, Object);
if ( v17 < 0 )
v17 = 0;
if ( v17 > 9999 )
v17 = 9999;
Object->m_targetGroupID = v17;
KeyframeGameObject::updateShadowObjects(Object, a1->m_editorLayer, a1);
m_editorLayer = a1->m_editorLayer;
v23 = (struct cocos2d::CCObject *)cocos2d::CCArray::create(v22);
v23->setTag(v23, m_editorLayer->m_keyframeGroup);
cocos2d::CCDictionary::setObject(
m_editorLayer->m_keyframeGroups,
v23,
m_editorLayer->m_keyframeGroup);
++m_editorLayer->m_keyframeGroup;
Object->m_keyframeGroup = v23->getTag(v23);
Object->m_keyframeIndex = 0;
LevelEditorLayer::addSpecial(a1->m_editorLayer, Object);
isEqual = (bool (__fastcall *)(cocos2d::CCObject *__hidden, const cocos2d::CCObject *))((char *)isEqual + 8);
}
while ( (unsigned __int64)isEqual <= v16 );
arr = v24;
v10 = v26;
}
}
}
}
v24 = ++arr;
}
while ( arr <= v10 );
v6 = v25;
}
}
}
EditorUI::selectObjects(a1, v6, 0);
}
}