//
// PlayerObject::preSlopeCollision from 0x10040b650 to 0x10040bb3b (1259 bytes)
//
// 1 xrefs:
// > PlayerObject::collidedWithSlopeInternal @ 0x100406f7a
//
// 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 __fastcall PlayerObject::preSlopeCollision(PlayerObject *a1, float a2, GameObject *a3)
{
unsigned __int64 *v6; // rsi
double v7; // xmm0_8
unsigned __int64 *v8; // rax
bool v9; // r12
int v10; // xmm0_4
unsigned __int64 *LastPosition; // rax
double *v12; // rax
double v13; // xmm0_8
double v14; // xmm1_8
bool m_isGoingLeft; // al
float *v16; // rax
float v17; // xmm0_4
float v18; // xmm1_4
float v19; // xmm2_4
__m128 v20; // xmm3
double v21; // xmm0_8
float v22; // xmm0_4
char v24; // r12
cocos2d::CCPoint v25; // xmm1_8
__m128 v26; // xmm2
__int64 v27; // rax
char v28; // r13
GameObject *m_currentPotentialSlope; // rdi
float *v30; // rax
GameObject *v31; // rdi
float *v32; // rax
__int64 v33; // rax
double v34; // [rsp+8h] [rbp-88h] BYREF
__m128 v35; // [rsp+10h] [rbp-80h] BYREF
__m128 v36; // [rsp+20h] [rbp-70h] BYREF
int m_uniqueID; // [rsp+30h] [rbp-60h] BYREF
float v38; // [rsp+34h] [rbp-5Ch]
__m128 v39; // [rsp+38h] [rbp-58h] BYREF
char v40; // [rsp+4Bh] [rbp-45h] BYREF
__m128 v41; // [rsp+4Ch] [rbp-44h] BYREF
bool v42; // [rsp+5Fh] [rbp-31h]
float v43; // [rsp+60h] [rbp-30h]
float v44; // [rsp+64h] [rbp-2Ch]
cocos2d::CCRect v45; // 0:kr00_16.16
cocos2d::CCRect v46; // 0:xmm1_8.8,8:xmm2_8.8
v43 = a2;
if ( a3->m_uniqueID == a1->m_collidingWithSlopeId )
return 0;
v6 = (unsigned __int64 *)((__int64 (__fastcall *)(GameObject *))a3->getObjectRect)(a3);
v7 = sub_10028D180(&v41, v6);
v8 = (unsigned __int64 *)((__int64 (__fastcall *)(PlayerObject *, double))a1->getObjectRect)(a1, v7);
sub_10028D180(&v35, v8);
v9 = GameObject::slopeWallLeft(a3);
v42 = GameObject::slopeFloorTop(a3);
*(float *)&v10 = 0.0;
if ( a1->m_isPlatformer && (a1->m_isOnSlope || a1->m_wasOnSlope) )
*(float *)&v10 = 5.0;
v38 = *(float *)&v10;
((void (__fastcall *)(__m128 *, GameObject *))a3->getRealPosition)(&v39, a3);
LastPosition = (unsigned __int64 *)GameObject::getLastPosition(a3);
sub_10028CD00(&v34, (unsigned __int64 *)&v39, LastPosition);
v12 = (double *)((char *)&v34 + 4);
if ( !a1->m_isSideways )
v12 = &v34;
*(_QWORD *)&v13 = *(unsigned int *)v12;
HIDWORD(v14) = 0;
*(float *)&v14 = v43 * (a1->m_playerSpeed * a1->m_speedMultiplier);
m_isGoingLeft = a1->m_isGoingLeft;
if ( v9 )
{
if ( !m_isGoingLeft || a1->m_isPlatformer || *(float *)&v14 > *(float *)&v13 )
{
v16 = (float *)((__int64 (__fastcall *)(PlayerObject *, double, double))a1->getPosition)(a1, v13, v14);
v17 = v41.f32[0];
if ( v41.f32[0] > *v16 )
{
v18 = 0.0;
if ( a1->m_isGoingLeft )
v18 = (float)!a1->m_isPlatformer;
v44 = v18;
v19 = v38 + v18;
v46.origin = (cocos2d::CCPoint)v41.u32[1];
v46.origin.x = v41.f32[1] + v19;
v20 = (__m128)v41.u32[3];
goto LABEL_22;
}
}
LABEL_41:
v44 = 0.0;
v24 = 0;
sub_10028D130(&v39);
if ( !v42 )
goto LABEL_25;
goto LABEL_42;
}
if ( !m_isGoingLeft && !a1->m_isPlatformer && *(float *)&v13 <= *(float *)&v14 )
goto LABEL_41;
v44 = *(float *)((__int64 (__fastcall *)(PlayerObject *, double, double))a1->getPosition)(a1, v13, v14);
v21 = sub_10028D230(v41.f32);
if ( v44 <= *(float *)&v21 )
goto LABEL_41;
v22 = 0.0;
if ( !a1->m_isGoingLeft )
v22 = (float)!a1->m_isPlatformer;
v44 = v22;
v19 = v38 + v22;
v20 = (__m128)v41.u32[3];
v17 = (float)(v41.f32[0] + v41.f32[2]) + -1.0;
v46.origin = (cocos2d::CCPoint)v41.u32[1];
v46.origin.x = v41.f32[1] + v19;
LABEL_22:
v20.f32[0] = v20.f32[0] - (float)(v19 + v19);
v46.size = (cocos2d::CCSize)1065353216LL;
sub_10028CC00((__int64)&v39, v17, v46.origin.x, (__m128)0x3F800000u, v20);
if ( sub_10028D320(v35.f32, v39.f32) )
{
sub_10028D180(&v36, (unsigned __int64 *)&v39);
PlayerObject::collidedWithObjectInternal(a1, v43, a3, v46, (bool)&v36);
}
v24 = 1;
sub_10028D130(&v39);
if ( !v42 )
{
LABEL_25:
v25 = (cocos2d::CCPoint)v41.u32[1];
v26 = (__m128)v41.u32[2];
v26.f32[0] = v41.f32[2] - (float)(v44 + v44);
sub_10028CC00((__int64)&v36, v41.f32[0] + v44, v41.f32[1], v26, (__m128)0x3F800000u);
sub_10028D1A0(&v39, (unsigned __int64 *)&v36);
v27 = ((__int64 (__fastcall *)(PlayerObject *))a1->getPosition)(a1);
if ( (float)(v39.f32[1] + v39.f32[3]) < *(float *)(v27 + 4) )
goto LABEL_26;
LABEL_43:
v28 = 1;
if ( sub_10028D320(v35.f32, v39.f32) )
{
sub_10028D180(&v36, (unsigned __int64 *)&v39);
v45.origin = v25;
v45.size = (cocos2d::CCSize)v26.i64[0];
PlayerObject::collidedWithObjectInternal(a1, v43, a3, v45, (bool)&v36);
}
return v28 | !sub_10028D320(v41.f32, v35.f32);
}
LABEL_42:
v26 = (__m128)v41.u32[2];
v26.f32[0] = v41.f32[2] - (float)(v44 + v44);
sub_10028CC00((__int64)&v36, v41.f32[0] + v44, (float)(v41.f32[1] + v41.f32[3]) + -1.0, v26, (__m128)0x3F800000u);
sub_10028D1A0(&v39, (unsigned __int64 *)&v36);
v33 = ((__int64 (__fastcall *)(PlayerObject *))a1->getPosition)(a1);
v25 = (cocos2d::CCPoint)v39.u32[1];
v25.x = v39.f32[1] + v39.f32[3];
if ( *(float *)(v33 + 4) >= (float)(v39.f32[1] + v39.f32[3]) )
goto LABEL_43;
LABEL_26:
v28 = 1;
if ( !v24 )
{
a1->m_unk669 = 0;
if ( !a1->m_isOnSlope )
{
m_uniqueID = a3->m_uniqueID;
v36.i64[0] = (__int64)&m_uniqueID;
*(_QWORD *)(sub_10041E3B0(&a1->m_potentialSlopeMap, &m_uniqueID, &unk_10081B88E, &v36, &v40) + 24) = a3;
m_currentPotentialSlope = a1->m_currentPotentialSlope;
if ( !m_currentPotentialSlope )
goto LABEL_37;
if ( (!m_currentPotentialSlope->m_slopeUphill || GameObject::slopeFloorTop(m_currentPotentialSlope))
&& (!a3->m_slopeUphill || GameObject::slopeFloorTop(a3)) )
{
v43 = *(float *)((__int64 (__fastcall *)(GameObject *))a1->m_currentPotentialSlope->getPosition)(a1->m_currentPotentialSlope);
v30 = (float *)((__int64 (__fastcall *)(GameObject *))a3->getPosition)(a3);
if ( v43 > *v30 )
goto LABEL_37;
}
v31 = a1->m_currentPotentialSlope;
if ( v31->m_slopeUphill && !GameObject::slopeFloorTop(v31) )
{
v43 = *(float *)((__int64 (__fastcall *)(GameObject *))a1->m_currentPotentialSlope->getPosition)(a1->m_currentPotentialSlope);
v32 = (float *)((__int64 (__fastcall *)(GameObject *))a3->getPosition)(a3);
if ( *v32 > v43 )
LABEL_37:
a1->m_currentPotentialSlope = a3;
}
}
v28 = 0;
}
return v28 | !sub_10028D320(v41.f32, v35.f32);
}