//
// GameObject::duplicateValues from 0x1005ca410 to 0x1005ca706 (758 bytes)
//
// 2 xrefs:
// > EditorUI::onCreateObject @ 0x100034ff8
// > LevelEditorLayer::breakApartTextObject @ 0x1000f1881
//
// 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 GameObject::duplicateValues(GameObject *a1)
{
_QWORD *v1; // rsi
_QWORD *v2; // r14
float v4; // xmm0_4
__int64 v5; // rax
void (__fastcall **v6)(); // rax
__int64 v7; // r15
unsigned __int8 v8; // al
unsigned __int8 v9; // al
__int64 v10; // rcx
__int64 v11; // rax
GJSpriteColor *m_baseColor; // rdx
int v13; // esi
int v14; // edi
int v15; // esi
GJSpriteColor *m_detailColor; // rcx
int v17; // edx
int v18; // esi
int v19; // edx
__int64 v20; // r15
__m128 v21; // xmm0
__m128 v22; // xmm1
__m128 v23; // xmm0
__m128 v24; // xmm2
float v25; // [rsp+0h] [rbp-1Ch]
v2 = v1;
v25 = (*(float (__fastcall **)())(*v1 + 368LL))();
v4 = (*(float (__fastcall **)())(*v1 + 384LL))();
v5 = *v1;
if ( v25 == v4 )
{
v6 = (void (__fastcall **)())(v5 + 352);
v7 = 344;
}
else
{
(*(void (__fastcall **)())(v5 + 368))();
((void (__fastcall *)(GameObject *))a1->setRotationX)(a1);
v6 = (void (__fastcall **)())(*v1 + 384LL);
v7 = 376;
}
(*v6)();
(*(void (__fastcall **)(GameObject *))((char *)&a1->copyWithZone + v7))(a1);
v8 = (*(__int64 (__fastcall **)())(*v1 + 1408LL))();
((void (__fastcall *)(GameObject *, _QWORD))a1->setFlipX)(a1, v8);
v9 = (*(__int64 (__fastcall **)())(*v1 + 1416LL))();
((void (__fastcall *)(GameObject *, _QWORD))a1->setFlipY)(a1, v9);
v10 = v1[137];
v11 = v1[138];
if ( a1->m_customSpriteColor && a1->m_detailColor == nullptr && v11 != 0 && *(_QWORD *)v11 )
v10 = v1[138];
m_baseColor = a1->m_baseColor;
v13 = *(_DWORD *)v10;
if ( !*(_DWORD *)v10 )
v13 = *(_DWORD *)(v10 + 4);
v14 = 0;
if ( v13 > 0 )
v14 = v13;
v15 = 1101;
if ( v14 < 1101 )
v15 = v14;
m_baseColor->m_colorID = v15;
m_baseColor->m_hsv = *(cocos2d::ccHSVValue *)(v10 + 16);
if ( v11 )
{
m_detailColor = a1->m_detailColor;
if ( m_detailColor )
{
v17 = *(_DWORD *)v11;
if ( !*(_DWORD *)v11 )
v17 = *(_DWORD *)(v11 + 4);
v18 = 0;
if ( v17 > 0 )
v18 = v17;
v19 = 1101;
if ( v18 < 1101 )
v19 = v18;
m_detailColor->m_colorID = v19;
m_detailColor->m_hsv = *(cocos2d::ccHSVValue *)(v11 + 16);
}
}
a1->m_zOrder = *((_DWORD *)v2 + 282);
if ( !a1->m_zFixedZLayer )
a1->m_zLayer = *((_DWORD *)v2 + 281);
a1->m_isDontFade = *((_BYTE *)v2 + 1043);
a1->m_isDontEnter = *((_BYTE *)v2 + 1042);
a1->m_hasNoEffects = *((_BYTE *)v2 + 1044);
if ( *((__int16 *)v2 + 584) > 0 )
{
v20 = 0;
do
{
((void (__fastcall *)(GameObject *))a1->addToGroup)(a1);
++v20;
}
while ( v20 < *((__int16 *)v2 + 584) );
}
v21 = (__m128)*((unsigned int *)v2 + 288);
v21.f32[0] = v21.f32[0] * 1000.0;
v22 = _mm_or_ps(_mm_and_ps(v21, (__m128)xmmword_1008150B0), (__m128)xmmword_1008150C0);
v22.f32[0] = v22.f32[0] + v21.f32[0];
v21.f32[0] = _mm_cvtepi32_ps(_mm_cvttps_epi32(_mm_round_ss((__m128)0LL, v22, 11))).f32[0] / 1000.0;
LODWORD(a1->m_scaleX) = v21.i32[0];
LODWORD(a1->m_customScaleX) = v21.i32[0];
a1->m_fScaleX = 0.0;
((void (__fastcall *)(GameObject *, float))a1->setRScaleX)(a1, 1.0);
a1->m_isDirty = 1;
a1->m_isObjectRectDirty = 1;
v23 = (__m128)*((unsigned int *)v2 + 289);
v23.f32[0] = v23.f32[0] * 1000.0;
v24 = _mm_or_ps(_mm_and_ps((__m128)xmmword_1008150B0, v23), (__m128)xmmword_1008150C0);
v24.f32[0] = v24.f32[0] + v23.f32[0];
v23.f32[0] = _mm_cvtepi32_ps(_mm_cvttps_epi32(_mm_round_ss((__m128)0LL, v24, 11))).f32[0] / 1000.0;
LODWORD(a1->m_scaleY) = v23.i32[0];
LODWORD(a1->m_customScaleY) = v23.i32[0];
a1->m_fScaleY = 0.0;
((void (__fastcall *)(GameObject *, float))a1->setRScaleY)(a1, 1.0);
a1->m_isDirty = 1;
a1->m_isObjectRectDirty = 1;
}