//
// PlayLayer::saveActiveSaveObjects from 0x1403b89f0 to 0x1403b8bed (509 bytes)
//
// 4 xrefs:
// > PlayLayer::createCheckpoint @ 0x1403b54a1
// > ??> @ 0x14069a04c
// > ??> @ 0x14069a05c
// > ??> @ 0x1406d7070
//
// 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::saveActiveSaveObjects(
PlayLayer *a1,
std::vector *a2,
std::vector *a3)
{
unsigned __int64 v6; // rdx
unsigned __int64 v7; // rax
std::_Vector_val>::pointer Myfirst; // rbx
std::_Vector_val>::pointer i; // rbp
GameObject *v10; // r8
std::_Vector_val>::pointer Mylast; // rdx
bool *p_m_obAnchorPoint; // r9
char v13; // cl
std::_Simple_types::value_type *v14; // rax
std::_Vector_val>::pointer v15; // rdi
std::_Vector_val>::pointer j; // rbx
int v17; // ecx
std::_Vector_val>::pointer v18; // rdx
std::_List_val>>>::_Nodeptr Myhead; // rdi
_QWORD *k; // rbx
__int64 *v21; // rbp
__int64 *m; // r14
__int64 v23; // rax
std::_Vector_val>::pointer v24; // rdx
__int64 v25; // [rsp+50h] [rbp+8h] BYREF
__int64 v26; // [rsp+58h] [rbp+10h] BYREF
v6 = a1->m_activeSaveObjects1._Mypair._Myval2._Mylast - a1->m_activeSaveObjects1._Mypair._Myval2._Myfirst;
v7 = a2->_Mypair._Myval2._Myend - a2->_Mypair._Myval2._Myfirst;
v25 = v6;
if ( v6 > v7 )
{
if ( v6 > 0xFFFFFFFFFFFFFFFLL )
sub_140062A20(a1, v6);
sub_1403BBAC0(a2, &v25);
}
Myfirst = a1->m_activeSaveObjects1._Mypair._Myval2._Myfirst;
for ( i = a1->m_activeSaveObjects1._Mypair._Myval2._Mylast; Myfirst != i; ++Myfirst )
{
if ( (*Myfirst)->hasBeenActivated(*Myfirst) )
{
v10 = *Myfirst;
Mylast = a2->_Mypair._Myval2._Mylast;
p_m_obAnchorPoint = (bool *)&(*Myfirst)[1].m_obAnchorPoint;
if ( Mylast == a2->_Mypair._Myval2._Myend )
{
sub_1403BD8B0(a2, Mylast, Myfirst, p_m_obAnchorPoint, (char *)&(*Myfirst)[1].m_obAnchorPoint.x + 1);
}
else
{
v13 = BYTE1((*Myfirst)[1].m_obAnchorPoint.x);
Mylast->m_activatedByPlayer1 = *p_m_obAnchorPoint;
Mylast->m_gameObject = v10;
Mylast->m_activatedByPlayer2 = v13;
++a2->_Mypair._Myval2._Mylast;
}
}
}
v14 = a2->_Mypair._Myval2._Mylast;
if ( v14 != a2->_Mypair._Myval2._Myend )
{
if ( a2->_Mypair._Myval2._Myfirst == v14 )
{
sub_1400CDA80((__int64)a2);
}
else
{
v25 = v14 - a2->_Mypair._Myval2._Myfirst;
sub_1403BBAC0(a2, &v25);
}
}
v15 = a1->m_activeSaveObjects2._Mypair._Myval2._Mylast;
for ( j = a1->m_activeSaveObjects2._Mypair._Myval2._Myfirst; j != v15; ++j )
{
v17 = *((_DWORD *)&(*j)[1].m_sInverse + 6);
if ( v17 )
{
v18 = a3->_Mypair._Myval2._Mylast;
if ( v18 == a3->_Mypair._Myval2._Myend )
{
sub_1403BD9E0(a3, v18, j);
}
else
{
v18->m_gameObject = *j;
v18->m_animationID = v17;
++a3->_Mypair._Myval2._Mylast;
}
}
}
Myhead = a1->m_labelObjects._List._Mypair._Myval2._Myhead;
for ( k = *(_QWORD **)Myhead; k != (_QWORD *)Myhead; k = (_QWORD *)*k )
{
v21 = (__int64 *)k[4];
for ( m = (__int64 *)k[3]; m != v21; ++m )
{
v23 = *m;
v26 = v23;
if ( *(_BYTE *)(v23 + 1928) )
{
v24 = a3->_Mypair._Myval2._Mylast;
LOBYTE(v25) = 1;
if ( v24 == a3->_Mypair._Myval2._Myend )
{
sub_1403BDB00(a3, v24, &v26, &v25);
}
else
{
v24->m_gameObject = (GameObject *)v23;
v24->m_animationID = 1;
++a3->_Mypair._Myval2._Mylast;
}
}
}
}
}