//
// PlayerObject::switchedDirTo from 0x63b8d4 to 0x63bb74 (672 bytes)
//
// 4 xrefs:
// > PlayerObject::pushButton @ 0x63c940
// > PlayerObject::enablePlayerControls @ 0x63cd58
// > PlayerObject::enablePlayerControls @ 0x63ce1c
// > ??> @ 0xaaa90
//
// 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
//
bool PlayerObject::switchedDirTo(PlayerObject *a1, PlayerButton a2)
{
bool result; // w0
_BOOL4 v5; // w1
std::_rb_tree_base *m_parent; // x0
std::_rb_tree_base *p_m_header; // x22
std::_rb_tree_base *v8; // x3
std::_rb_tree_base *v9; // x1
std::_rb_tree_base *v10; // x1
std::map *p_m_holdingButtons; // x23
__int64 v12; // x20
__int64 insert_hint_unique_pos; // x0
__int64 v14; // x1
__int64 v15; // x3
_BOOL8 v16; // x0
std::_rb_tree_base *v17; // x20
_BOOL4 m_isSliding; // w0
__int64 v19; // x0
__int64 v20; // x1
std::_rb_tree_base *v21; // x3
_BOOL8 v22; // x0
void *v23; // x0
std::_rb_tree_base *v24; // x0
__int64 v25; // [xsp+48h] [xbp+48h]
__int64 v26; // [xsp+48h] [xbp+48h]
if ( !a1->m_inputsLocked )
{
m_parent = a1->m_holdingButtons.m_header.m_parent;
p_m_header = &a1->m_holdingButtons.m_header;
if ( !m_parent )
goto LABEL_48;
v8 = &a1->m_holdingButtons.m_header;
v9 = a1->m_holdingButtons.m_header.m_parent;
do
{
while ( *(int *)&v9[1].m_isblack > 2 )
{
v8 = v9;
v9 = v9->m_left;
if ( !v9 )
goto LABEL_15;
}
v9 = v9->m_right;
}
while ( v9 );
LABEL_15:
v10 = v8;
if ( v8 == p_m_header )
{
LABEL_48:
v10 = &a1->m_holdingButtons.m_header;
}
else if ( *(int *)&v8[1].m_isblack <= 3 )
{
*(&v8[1].m_isblack + 4) = a2 == 3;
goto LABEL_32;
}
v25 = (__int64)v10;
p_m_holdingButtons = &a1->m_holdingButtons;
v12 = operator new(0x28u);
*(_DWORD *)(v12 + 32) = 3;
*(_BYTE *)(v12 + 36) = 0;
insert_hint_unique_pos = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_hint_unique_pos(
&a1->m_holdingButtons.compare.pad,
v25,
(int *)(v12 + 32));
v15 = insert_hint_unique_pos;
if ( v14 )
{
v16 = insert_hint_unique_pos
|| p_m_header == (std::_rb_tree_base *)v14
|| *(_DWORD *)(v12 + 32) < *(_DWORD *)(v14 + 32);
sub_CFAD74(v16, v12, v14, &a1->m_holdingButtons.m_header);
++a1->m_holdingButtons.m_nodecount;
}
else
{
v23 = (void *)v12;
v12 = v15;
operator delete(v23);
}
m_parent = a1->m_holdingButtons.m_header.m_parent;
*(_BYTE *)(v12 + 36) = a2 == 3;
if ( !m_parent )
{
v17 = &a1->m_holdingButtons.m_header;
goto LABEL_38;
}
LABEL_32:
v17 = &a1->m_holdingButtons.m_header;
do
{
while ( *(int *)&m_parent[1].m_isblack > 1 )
{
v17 = m_parent;
m_parent = m_parent->m_left;
if ( !m_parent )
goto LABEL_35;
}
m_parent = m_parent->m_right;
}
while ( m_parent );
LABEL_35:
if ( p_m_header != v17 && *(int *)&v17[1].m_isblack <= 2 )
goto LABEL_43;
p_m_holdingButtons = &a1->m_holdingButtons;
LABEL_38:
v26 = (__int64)v17;
v17 = (std::_rb_tree_base *)operator new(0x28u);
*(_DWORD *)&v17[1].m_isblack = 2;
*(&v17[1].m_isblack + 4) = 0;
v19 = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_hint_unique_pos(
p_m_holdingButtons,
v26,
(int *)&v17[1].m_isblack);
v21 = (std::_rb_tree_base *)v19;
if ( v20 )
{
v22 = v19 || p_m_header == (std::_rb_tree_base *)v20 || *(_DWORD *)&v17[1].m_isblack < *(_DWORD *)(v20 + 32);
sub_CFAD74(v22, v17, v20, &a1->m_holdingButtons.m_header);
++p_m_holdingButtons->m_nodecount;
}
else
{
v24 = v17;
v17 = v21;
operator delete(v24);
}
LABEL_43:
*(&v17[1].m_isblack + 4) = a2 == 2;
}
result = 0;
if ( a1->m_controlsDisabled )
return result;
if ( a2 == 3 )
{
m_isSliding = a1->m_isSliding;
a1->m_leftPressedFirst = 0;
a1->m_holdingRight = 1;
if ( m_isSliding && a1->m_isSlidingRight )
{
a1->m_isSliding = 0;
a1->m_maybeSlopeForce = 0.0;
}
if ( a1->m_platformerXVelocity >= 0.0 )
return 1;
}
else
{
v5 = a1->m_isSliding;
a1->m_holdingLeft = 1;
a1->m_leftPressedFirst = 1;
if ( v5 && !a1->m_isSlidingRight )
{
a1->m_isSliding = 0;
a1->m_maybeSlopeForce = 0.0;
}
if ( a1->m_platformerXVelocity <= 0.0 )
return 1;
}
a1->m_isMoving = 0;
return 1;
}