//
// EditorUI::createNewKeyframeAnim from 0x1000454f0 to 0x100045772 (642 bytes)
//
// 1 xrefs:
// > SetGroupIDLayer::onAnim @ 0x10031687c
//
// 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 __fastcall EditorUI::createNewKeyframeAnim(EditorUI *a1)
{
__int64 v1; // rsi
EditorUI *v2; // rbx
__int64 v3; // rax
__int64 v4; // r14
void *m_selectedObject; // rsi
LevelEditorLayer *m_editorLayer; // rdi
unsigned int *v7; // rax
__int64 v8; // rcx
_QWORD *v9; // rax
__int64 v10; // rcx
__int64 v11; // r14
cocos2d::CCObject *v12; // rax
cocos2d::CCObject_vtbl *v13; // rax
__int64 v14; // rdi
unsigned __int64 v15; // r12
cocos2d::CCArray *NewKeyframeAnim; // rax
LevelEditorLayer *v17; // r14
cocos2d::CCPoint v18; // xmm0_8
GameObject *Object; // rax
KeyframeGameObject *v20; // r14
float m_pixelScaleX; // xmm0_4
_BYTE v22[8]; // [rsp+8h] [rbp-68h] BYREF
_BYTE v23[8]; // [rsp+10h] [rbp-60h] BYREF
__int64 v24; // [rsp+18h] [rbp-58h]
unsigned __int64 v25; // [rsp+20h] [rbp-50h]
_QWORD *v26; // [rsp+28h] [rbp-48h]
unsigned __int64 v27; // [rsp+30h] [rbp-40h]
cocos2d::CCArray *v28; // [rsp+38h] [rbp-38h]
int v29; // [rsp+44h] [rbp-2Ch]
v2 = a1;
if ( a1->m_selectedObject || (a1 = (EditorUI *)a1->m_selectedObjects, (unsigned int)sub_100720070(a1)) )
{
v3 = sub_10071F9E0(a1, v1);
v4 = v3;
m_selectedObject = v2->m_selectedObject;
if ( m_selectedObject )
{
sub_10071FCD0(v3, m_selectedObject);
}
else
{
m_selectedObject = v2->m_selectedObjects;
sub_100720050(v3, m_selectedObject);
}
EditorUI::deselectAll(v2);
m_editorLayer = v2->m_editorLayer;
((void (__fastcall *)(LevelEditorLayer *, double))m_editorLayer->updateVisibility)(m_editorLayer, 0.0);
v28 = (cocos2d::CCArray *)sub_10071F9E0(m_editorLayer, m_selectedObject);
if ( v4 )
{
v7 = *(unsigned int **)(v4 + 56);
v8 = *v7;
if ( *v7 )
{
v9 = *((_QWORD **)v7 + 2);
v27 = (unsigned __int64)&v9[v8 - 1];
do
{
v10 = *v9;
if ( !*v9 )
break;
v26 = v9;
if ( *(_BYTE *)(v10 + 1170) == 1 )
{
v11 = v10;
v12 = cocos2d::CCDictionary::objectForKey(v2->m_editorLayer->m_parentGroupIDs, *(unsigned int *)(v10 + 916));
if ( v12 )
{
v13 = v12[1].__vftable;
if ( LODWORD(v13->copyWithZone) )
{
v14 = v11;
v15 = (unsigned __int64)v13->~CCObject_0;
v25 = v15 + 8LL * LODWORD(v13->copyWithZone) - 8;
v24 = v11;
do
{
if ( !*(_QWORD *)v15 )
break;
v29 = *(_DWORD *)(*(_QWORD *)v15 + 56LL);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v14 + 192LL))(v14);
sub_10028CC60(v23);
v17 = v2->m_editorLayer;
*(double *)&v18 = sub_10028CC60(v22);
Object = LevelEditorLayer::createObject(v17, 3032, v18, (bool)v22);
v20 = (KeyframeGameObject *)Object;
if ( Object )
{
m_pixelScaleX = Object->m_pixelScaleX;
if ( m_pixelScaleX != 1.0 || Object->m_pixelScaleY != 1.0 )
{
GameObject::updateCustomScaleX(Object, m_pixelScaleX);
GameObject::updateCustomScaleY(v20, v20->m_pixelScaleY);
}
}
LevelEditorLayer::removeSpecial(v2->m_editorLayer, v20);
sub_10071FCD0(v28, v20);
EffectGameObject::setTargetID(v20, v29);
KeyframeGameObject::updateShadowObjects(v20, v2->m_editorLayer, v2);
NewKeyframeAnim = GJBaseGameLayer::createNewKeyframeAnim(v2->m_editorLayer);
v20->m_keyframeGroup = ((__int64 (__fastcall *)(cocos2d::CCArray *))NewKeyframeAnim->getTag)(NewKeyframeAnim);
v20->m_keyframeIndex = 0;
LevelEditorLayer::addSpecial(v2->m_editorLayer, v20);
v15 += 8LL;
v14 = v24;
}
while ( v15 <= v25 );
}
}
}
v9 = v26 + 1;
}
while ( (unsigned __int64)(v26 + 1) <= v27 );
}
}
EditorUI::selectObjects(v2, v28, 0);
}
}