//
// PlayerObject::preSlopeCollision from 0x14038f2e0 to 0x14038f805 (1317 bytes)
//
// 5 xrefs:
// > PlayerObject::collidedWithSlopeInternal @ 0x14038f887
// > ??> @ 0x140697720
// > ??> @ 0x140697768
// > ??> @ 0x140697790
// > ??> @ 0x1406d60d4
//
// 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::preSlopeCollision(PlayerObject *a1, float a2, GameObject *a3)
{
const struct cocos2d::CCRect *v7; // rax
const struct cocos2d::CCRect *v8; // rax
unsigned int m_slopeDirection; // ecx
char v10; // r14
float v11; // xmm7_4
bool v12; // bl
int v13; // r12d
bool v14; // r15
float v15; // xmm6_4
__int64 v16; // rax
float v17; // xmm2_4
bool m_isGoingLeft; // al
float v19; // xmm3_4
const cocos2d::CCPoint *v20; // rax
BOOL v21; // eax
const cocos2d::CCPoint *v22; // rbx
BOOL v23; // eax
cocos2d::CCRect *v24; // rax
float v25; // xmm1_4
float v26; // xmm3_4
__int64 v27; // rax
const cocos2d::CCPoint *v28; // rax
GameObject *m_currentPotentialSlope; // rax
unsigned int v30; // ecx
unsigned int v31; // eax
const cocos2d::CCPoint *v32; // rbx
GameObject *v33; // rcx
unsigned int v34; // eax
float *v35; // rbx
bool v36; // al
bool v37; // cl
__int64 v38; // rax
const cocos2d::CCPoint *v39; // rax
cocos2d::CCRect *v40; // rax
cocos2d::CCRect v41; // [rsp+30h] [rbp-69h] BYREF
cocos2d::CCRect v42; // [rsp+40h] [rbp-59h] BYREF
cocos2d::CCRect v43; // [rsp+50h] [rbp-49h] BYREF
cocos2d::CCRect v44; // [rsp+60h] [rbp-39h] BYREF
cocos2d::CCRect v45; // [rsp+70h] [rbp-29h] BYREF
int m_uniqueID; // [rsp+100h] [rbp+67h] BYREF
float v47; // [rsp+110h] [rbp+77h] BYREF
float v48; // [rsp+114h] [rbp+7Bh]
if ( a3->m_uniqueID == a1->m_collidingWithSlopeId )
return 0;
v7 = a3->getObjectRect_0(a3);
cocos2d::CCRect::CCRect(&v41, v7);
v8 = a1->getObjectRect_0(a1);
cocos2d::CCRect::CCRect(&v43, v8);
m_slopeDirection = a3->m_slopeDirection;
v10 = 0;
v11 = 0.0;
v12 = m_slopeDirection - 2 <= 2 || m_slopeDirection == 6;
v13 = 106;
v14 = m_slopeDirection <= 6 && _bittest(&v13, m_slopeDirection);
if ( a1->m_isPlatformer && (a1->m_isOnSlope || a1->m_wasOnSlope) )
v15 = 5.0;
else
v15 = 0.0;
v16 = ((__int64 (__fastcall *)(GameObject *, int *))a3->getRealPosition)(a3, &m_uniqueID);
cocos2d::CCPoint::operator-(v16, &v47, &a3->m_lastPosition);
if ( a1->m_isSideways )
v17 = v48;
else
v17 = v47;
m_isGoingLeft = a1->m_isGoingLeft;
v19 = a1->m_playerSpeed * a1->m_speedMultiplier * a2;
if ( v12 )
{
if ( m_isGoingLeft && !a1->m_isPlatformer && v19 <= v17 )
goto LABEL_40;
v20 = a1->getPosition_0(a1);
if ( v41.origin.x <= v20->x )
goto LABEL_40;
v10 = 1;
v21 = a1->m_isGoingLeft && !a1->m_isPlatformer;
v11 = (float)v21;
cocos2d::CCRect::CCRect(
&v44,
v41.origin.x,
(float)(v15 + v11) + v41.origin.y,
1.0,
v41.size.height - (float)((float)(v15 + v11) + (float)(v15 + v11)));
}
else
{
if ( !m_isGoingLeft && !a1->m_isPlatformer && v17 <= v19 )
goto LABEL_40;
v22 = a1->getPosition_0(a1);
if ( v22->x <= cocos2d::CCRect::getMaxX(&v41) )
goto LABEL_40;
v10 = 1;
v23 = !a1->m_isGoingLeft && !a1->m_isPlatformer;
v11 = (float)v23;
cocos2d::CCRect::CCRect(
&v44,
(float)(v41.size.width + v41.origin.x) - 1.0,
(float)(v15 + v11) + v41.origin.y,
1.0,
v41.size.height - (float)((float)(v15 + v11) + (float)(v15 + v11)));
}
if ( cocos2d::CCRect::intersectsRect(&v43, &v44) )
{
cocos2d::CCRect::CCRect(&v45, &v44);
PlayerObject::collidedWithObjectInternal(a1, a2, a3, v24, 0);
}
LABEL_40:
cocos2d::CCRect::CCRect(&v42);
v25 = v41.origin.x + v11;
v26 = v41.size.width - (float)(v11 + v11);
if ( v14 )
{
cocos2d::CCRect::CCRect(&v45, v25, (float)(v41.origin.y + v41.size.height) - 1.0, v26, 1.0);
cocos2d::CCRect::operator=(&v42, v27);
v28 = a1->getPosition_0(a1);
if ( v28->y < (float)(v42.size.height + v42.origin.y) )
goto LABEL_42;
LABEL_61:
v10 = 1;
if ( cocos2d::CCRect::intersectsRect(&v43, &v42) )
{
cocos2d::CCRect::CCRect(&v45, &v42);
PlayerObject::collidedWithObjectInternal(a1, a2, a3, v40, 0);
}
goto LABEL_57;
}
cocos2d::CCRect::CCRect(&v45, v25, v41.origin.y, v26, 1.0);
cocos2d::CCRect::operator=(&v42, v38);
v39 = a1->getPosition_0(a1);
if ( (float)(v42.size.height + v42.origin.y) >= v39->y )
goto LABEL_61;
LABEL_42:
if ( !v10 )
{
a1->m_unk669 = 0;
if ( !a1->m_isOnSlope )
{
m_uniqueID = a3->m_uniqueID;
*(_QWORD *)(*(_QWORD *)sub_14024E530(
(__int64)&a1->m_potentialSlopeMap,
(__int64)&v45,
(unsigned __int8 *)&m_uniqueID)
+ 24LL) = a3;
m_currentPotentialSlope = a1->m_currentPotentialSlope;
if ( !m_currentPotentialSlope )
goto LABEL_56;
if ( !m_currentPotentialSlope->m_slopeUphill
|| (v30 = m_currentPotentialSlope->m_slopeDirection, v30 <= 6) && _bittest(&v13, v30) )
{
if ( !a3->m_slopeUphill || (v31 = a3->m_slopeDirection, v31 <= 6) && _bittest(&v13, v31) )
{
v32 = a1->m_currentPotentialSlope->getPosition_0(a1->m_currentPotentialSlope);
if ( v32->x > a3->getPosition_0(a3)->x )
goto LABEL_56;
}
}
v33 = a1->m_currentPotentialSlope;
if ( v33->m_slopeUphill )
{
v34 = v33->m_slopeDirection;
if ( v34 > 6 || !_bittest(&v13, v34) )
{
v35 = (float *)v33->getPosition_0(v33);
if ( a3->getPosition_0(a3)->x > *v35 )
LABEL_56:
a1->m_currentPotentialSlope = a3;
}
}
}
}
LABEL_57:
v36 = cocos2d::CCRect::intersectsRect(&v41, &v43);
v37 = v10;
if ( !v36 )
return 1;
return v37;
}