//
// PlayLayer::saveDynamicSaveObjects from 0x1403b86e0 to 0x1403b89ec (780 bytes)
//
// 4 xrefs:
// > PlayLayer::createCheckpoint @ 0x1403b548b
// > ??> @ 0x140699fec
// > ??> @ 0x14069a028
// > ??> @ 0x1406d7034
//
// 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 PlayLayer::saveDynamicSaveObjects(PlayLayer *a1, std::vector *a2)
{
signed __int64 v3; // r8
signed __int64 v5; // rcx
unsigned __int64 v6; // r8
std::_Vector_val>::pointer Mylast; // rsi
std::_Vector_val>::pointer i; // rbx
std::_Simple_types::value_type v9; // rax
double v10; // xmm2_8
double m_positionY; // xmm8_8
float v12; // xmm3_4
float v13; // xmm4_4
float v14; // xmm5_4
float v15; // xmm7_4
std::_Vector_val>::pointer v16; // rdx
double m_positionYOffset; // xmm0_8
double v18; // xmm8_8
float y; // xmm1_4
std::_Simple_types::value_type *v20; // rcx
double v21; // [rsp+60h] [rbp-68h] BYREF
double v22; // [rsp+68h] [rbp-60h] BYREF
signed __int64 v23; // [rsp+D0h] [rbp+8h] BYREF
float v24; // [rsp+D8h] [rbp+10h] BYREF
float v25; // [rsp+E0h] [rbp+18h] BYREF
float v26; // [rsp+E8h] [rbp+20h] BYREF
v3 = (char *)a1->m_dynamicSaveObjects._Mypair._Myval2._Mylast
- (char *)a1->m_dynamicSaveObjects._Mypair._Myval2._Myfirst;
v5 = (char *)a2->_Mypair._Myval2._Myend - (char *)a2->_Mypair._Myval2._Myfirst;
v6 = v3 >> 3;
v23 = v6;
if ( v6 > v5 / 48 )
{
if ( v6 > 0x555555555555555LL )
sub_140062A20(v5, v5 / 48);
sub_1403BBB40(a2, &v23);
}
Mylast = a1->m_dynamicSaveObjects._Mypair._Myval2._Mylast;
for ( i = a1->m_dynamicSaveObjects._Mypair._Myval2._Myfirst; i != Mylast; ++i )
{
v9 = *i;
v10 = (*i)->m_positionX - (*i)->m_positionXOffset;
if ( v10 != (*i)->m_startPosition.x
|| v9->m_positionY - v9->m_positionYOffset != v9->m_startPosition.y
|| v9->m_rotationXOffset != 0.0
|| v9->m_rotationYOffset != 0.0
|| v9->m_scaleXOffset != 0.0
|| v9->m_scaleYOffset != 0.0 )
{
m_positionY = v9->m_positionY;
v12 = v9->m_scaleYOffset - v9->m_unk2C0;
v13 = v9->m_scaleXOffset - v9->m_unk2BC;
v14 = v9->m_rotationYOffset - v9->m_unk2B0;
v15 = v9->m_rotationXOffset - v9->m_unk2A8;
v16 = a2->_Mypair._Myval2._Mylast;
m_positionYOffset = v9->m_positionYOffset;
*(float *)&v23 = v12;
v18 = m_positionY - m_positionYOffset;
v24 = v13;
v25 = v14;
v26 = v15;
v22 = v10;
v21 = v18;
if ( v16 == a2->_Mypair._Myval2._Myend )
{
sub_1403BD6B0(a2, v16, i, &v22, &v21, &v26, &v25, &v24, &v23, &v9->m_lastPosition, &v9->m_lastPosition.y);
}
else
{
y = v9->m_lastPosition.y;
v16->m_unkFloat3 = v9->m_lastPosition.x;
v16->m_unkFloat4 = y;
v16->m_positionX = v10;
v16->m_positionY = v18;
v16->m_rotationXOffset = v15;
v16->m_rotationYOffset = v14;
v16->m_addToCustomScaleX = v13;
v16->m_addToCustomScaleY = v12;
v16->m_gameObject = v9;
++a2->_Mypair._Myval2._Mylast;
}
}
}
v20 = a2->_Mypair._Myval2._Mylast;
if ( v20 != a2->_Mypair._Myval2._Myend )
{
if ( a2->_Mypair._Myval2._Myfirst == v20 )
{
sub_1403BB6B0(a2);
}
else
{
v23 = v20 - a2->_Mypair._Myval2._Myfirst;
sub_1403BBB40(a2, &v23);
}
}
}