//
// PlayerObject::pushButton from 0x140397f40 to 0x1403981c3 (643 bytes)
//
// 8 xrefs:
// > GJBaseGameLayer::handleButton @ 0x1402339e7
// > GJBaseGameLayer::handleButton @ 0x140233a23
// > MenuGameLayer::tryJump @ 0x1403321b5
// > PlayerObject::enablePlayerControls @ 0x14039f688
// > ??> @ 0x140697f3c
// > ??> @ 0x140697f5c
// > ??> @ 0x140697f6c
// > ??> @ 0x1406d64ac
//
// 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::pushButton(PlayerObject *a1, PlayerButton a2)
{
cocos2d::CCArray *m_touchingRings; // rcx
signed int v6; // eax
unsigned int v7; // edi
struct cocos2d::CCArray *v8; // rbp
struct cocos2d::CCArray *v9; // rax
cocos2d::CCArray *v10; // rsi
struct cocos2d::CCArray *v11; // r15
cocos2d::ccArray *data; // rsi
__int64 num; // rcx
RingObject **arr; // rsi
RingObject **i; // r14
RingObject *v16; // rdi
GameObjectType v17; // eax
cocos2d::CCArray *v18; // rcx
cocos2d::ccArray *v19; // rdi
__int64 v20; // rax
RingObject **v21; // rdi
RingObject **j; // rsi
cocos2d::ccArray *v23; // rdi
__int64 v24; // rax
RingObject **v25; // rdi
RingObject **k; // rsi
PlayerButton v27; // [rsp+40h] [rbp+8h] BYREF
if ( !a1->m_inputsLocked )
{
v27 = a2;
*(_BYTE *)sub_1400CDBF0((__int64 *)&a1->m_holdingButtons, (int *)&v27) = 1;
}
if ( a1->m_isLocked || a1->m_controlsDisabled )
return 0;
if ( a2 == Jump )
{
if ( !a1->m_jumpBuffered )
PlayerObject::placeStreakPoint(a1);
*(_WORD *)&a1->m_jumpBuffered = 257;
a1->m_padRingRelated = 0;
sub_14005E0D0(&a1->m_ringRelatedSet._Traitsobj._Mypair._Myval2._Myval2);
m_touchingRings = a1->m_touchingRings;
a1->m_stateJumpBuffered = a1->m_jumpBuffered;
a1->m_stateRingJump2 = a1->m_stateRingJump;
*(_DWORD *)&a1->m_touchedRing = 0;
if ( cocos2d::CCArray::count(m_touchingRings) )
{
v6 = cocos2d::CCArray::count(a1->m_touchingRings);
v7 = v6;
if ( v6 > 0 )
{
v8 = cocos2d::CCArray::createWithCapacity(v6);
v9 = cocos2d::CCArray::createWithCapacity(v7);
v10 = a1->m_touchingRings;
v11 = v9;
if ( v10 )
{
data = v10->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (RingObject **)data->arr;
for ( i = &arr[num - 1]; arr <= i; ++arr )
{
v16 = *arr;
if ( !*arr )
break;
if ( v16->m_claimTouch )
{
PlayerObject::ringJump(a1, *arr, 0);
a1->m_jumpBuffered = 0;
return 1;
}
v17 = v16->getType(*arr);
v18 = v8;
if ( v17 != CustomRing )
v18 = v11;
cocos2d::CCArray::addObject(v18, v16);
}
}
}
if ( v8 )
{
v19 = v8->data;
v20 = v19->num;
if ( (_DWORD)v20 )
{
v21 = (RingObject **)v19->arr;
for ( j = &v21[v20 - 1]; v21 <= j; ++v21 )
{
if ( !*v21 )
break;
PlayerObject::ringJump(a1, *v21, 0);
}
}
}
if ( v11 )
{
v23 = v11->data;
v24 = v23->num;
if ( (_DWORD)v24 )
{
v25 = (RingObject **)v23->arr;
for ( k = &v25[v24 - 1]; v25 <= k; ++v25 )
{
if ( !*v25 )
break;
PlayerObject::ringJump(a1, *v25, 0);
}
}
}
}
}
else if ( (a1->m_isBall || !a1->m_isShip && !a1->m_isBird && !a1->m_isDart && !a1->m_isSwing && a1->m_jumpBuffered)
&& a1->m_isOnGround )
{
PlayerObject::updateJump(a1, 0.0);
}
}
else if ( (unsigned int)(a2 - 2) <= 1 )
{
PlayerObject::switchedDirTo(a1, a2);
}
return 1;
}