//
// PlayerObject::preSlopeCollision from 0x633270 to 0x633754 (1252 bytes)
//
// 2 xrefs:
// > PlayerObject::collidedWithSlopeInternal @ 0x637bd4
// > ??> @ 0x4e708
//
// 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)
{
bool result; // w0
float v7; // s9
const cocos2d::CCRect *v8; // x0
const cocos2d::CCRect *v9; // x0
_BOOL4 v10; // w26
_BOOL4 v11; // w25
const cocos2d::CCPoint *LastPosition; // x0
long double v13; // q0
float v14; // s3
float *v15; // x0
float x; // s0
float v17; // s8
float v18; // s3
float v19; // s1
float v20; // s2
_BOOL4 v21; // w26
const cocos2d::CCPoint *v22; // x0
_BOOL4 m_isOnSlope; // w0
const cocos2d::CCPoint *v24; // x0
float v25; // s8
float v26; // s0
GameObject *m_currentPotentialSlope; // x0
float v28; // s8
GameObject *v29; // x0
float v30; // s8
_QWORD v31[2]; // [xsp+0h] [xbp+0h] BYREF
__int64 v32; // [xsp+70h] [xbp+70h] BYREF
cocos2d::CCRect v33; // [xsp+78h] [xbp+78h] BYREF
cocos2d::CCRect v34; // [xsp+88h] [xbp+88h] BYREF
cocos2d::CCRect v35; // [xsp+98h] [xbp+98h] BYREF
cocos2d::CCRect v36; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::CCRect v37; // 0:s1.4,4:s2.4,8:s3.4,12:s4.4
cocos2d::CCRect v38; // 0:s1.4,4:s2.4,8:s3.4,12:s4.4
result = 0;
if ( a3->m_uniqueID != a1->m_collidingWithSlopeId )
{
v7 = 0.0;
v8 = a3->getObjectRect(a3);
cocos2d::CCRect::CCRect(&v33, v8);
v9 = a1->getObjectRect(a1);
cocos2d::CCRect::CCRect(&v34, v9);
v10 = GameObject::slopeWallLeft(a3);
v11 = GameObject::slopeFloorTop(a3);
if ( a1->m_isPlatformer )
{
if ( a1->m_isOnSlope )
{
v7 = 5.0;
}
else if ( a1->m_wasOnSlope )
{
v7 = 5.0;
}
}
((void (__fastcall *)(cocos2d::CCRect *__return_ptr, GameObject *))a3->getRealPosition)(&v36, a3);
LastPosition = GameObject::getLastPosition(a3);
cocos2d::CCPoint::operator-(&v32, &v36, LastPosition);
if ( a1->m_isSideways )
v14 = *((float *)&v32 + 1);
else
v14 = *(float *)&v32;
*(double *)&v13 = a1->m_playerSpeed * a1->m_speedMultiplier * a2;
*(float *)&v13 = *(double *)&v13;
if ( v10 )
{
if ( !a1->m_isGoingLeft || a1->m_isPlatformer || *(float *)&v13 > v14 )
{
v15 = (float *)((__int64 (__fastcall *)(PlayerObject *, long double))a1->getPosition)(a1, v13);
x = v33.origin.x;
if ( *v15 < v33.origin.x )
{
v17 = 0.0;
if ( a1->m_isGoingLeft )
{
v17 = 0.0;
if ( !a1->m_isPlatformer )
v17 = 1.0;
}
v18 = v33.size.height - (float)((float)(v7 + v17) * 2.0);
v19 = (float)(v7 + v17) + v33.origin.y;
v20 = 1.0;
LABEL_13:
cocos2d::CCRect::CCRect(&v35, x, v19, v20, v18);
if ( (unsigned __int8)cocos2d::CCRect::intersectsRect(&v34, &v35) )
{
cocos2d::CCRect::CCRect(&v36, &v35);
PlayerObject::collidedWithObjectInternal(a1, a2, a3, v37, (unsigned __int8)v31 - 88);
}
v21 = 1;
LABEL_16:
cocos2d::CCRect::CCRect(&v35);
if ( v11 )
{
cocos2d::CCRect::CCRect(
&v36,
v17 + v33.origin.x,
(float)(v33.origin.y + v33.size.height) - 1.0,
v33.size.width - (float)(v17 * 2.0),
1.0);
cocos2d::CCRect::operator=(&v35, &v36);
v22 = a1->getPosition(a1);
if ( v22->y < (float)(v35.origin.y + v35.size.height) )
goto LABEL_18;
}
else
{
cocos2d::CCRect::CCRect(&v36, v17 + v33.origin.x, v33.origin.y, v33.size.width - (float)(v17 * 2.0), 1.0);
cocos2d::CCRect::operator=(&v35, &v36);
v24 = a1->getPosition(a1);
if ( v24->y > (float)(v35.origin.y + v35.size.height) )
{
LABEL_18:
if ( !v21 )
{
m_isOnSlope = a1->m_isOnSlope;
a1->m_unk669 = 0;
if ( !m_isOnSlope )
{
if ( (LODWORD(v36.origin.x) = a3->m_uniqueID,
*(_QWORD *)std::__detail::_Map_base,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[](
(__int64)&a1->m_potentialSlopeMap,
(int *)&v36) = a3,
(m_currentPotentialSlope = a1->m_currentPotentialSlope) == nullptr)
|| (!m_currentPotentialSlope->m_slopeUphill || GameObject::slopeFloorTop(m_currentPotentialSlope))
&& (!a3->m_slopeUphill || GameObject::slopeFloorTop(a3))
&& (v28 = a1->m_currentPotentialSlope->getPosition(a1->m_currentPotentialSlope)->x,
v28 > a3->getPosition(a3)->x)
|| (v29 = a1->m_currentPotentialSlope, v29->m_slopeUphill)
&& !GameObject::slopeFloorTop(v29)
&& (v30 = a1->m_currentPotentialSlope->getPosition(a1->m_currentPotentialSlope)->x,
v30 < a3->getPosition(a3)->x) )
{
a1->m_currentPotentialSlope = a3;
}
}
}
return !(unsigned __int8)cocos2d::CCRect::intersectsRect(&v33, &v34) || v21;
}
}
LOBYTE(v21) = 1;
if ( (unsigned __int8)cocos2d::CCRect::intersectsRect(&v34, &v35) )
{
cocos2d::CCRect::CCRect(&v36, &v35);
PlayerObject::collidedWithObjectInternal(a1, a2, a3, v38, (unsigned __int8)v31 - 88);
}
return !(unsigned __int8)cocos2d::CCRect::intersectsRect(&v33, &v34) || v21;
}
}
}
else if ( a1->m_isGoingLeft || a1->m_isPlatformer || *(float *)&v13 < v14 )
{
v25 = *(float *)((__int64 (__fastcall *)(PlayerObject *, long double))a1->getPosition)(a1, v13);
cocos2d::CCRect::getMaxX(&v33);
if ( v25 > v26 )
{
v17 = 0.0;
if ( !a1->m_isGoingLeft && !a1->m_isPlatformer )
v17 = 1.0;
v18 = v33.size.height - (float)((float)(v7 + v17) * 2.0);
v20 = 1.0;
v19 = (float)(v7 + v17) + v33.origin.y;
x = (float)(v33.origin.x + v33.size.width) - 1.0;
goto LABEL_13;
}
}
v21 = 0;
v17 = 0.0;
goto LABEL_16;
}
return result;
}