//
// PlayerObject::preCollision from 0x100404660 to 0x1004047ea (394 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::checkCollisions @ 0x100125831
//
// 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
//
void __fastcall PlayerObject::preCollision(PlayerObject *a1)
{
bool m_isOnGround2; // cl
std::unordered_map *p_m_potentialSlopeMap; // r14
std::__hash_node_base, void *> *>::__next_pointer next; // rdi
std::__hash_node_base, void *> *> *v5; // r15
unsigned __int64 value; // rsi
GameObject *m_currentPotentialSlope; // r15
GameObject *m_currentSlope; // rbx
int *p_m_uniqueID; // [rsp+8h] [rbp-28h] BYREF
int m_uniqueID; // [rsp+10h] [rbp-20h] BYREF
_BYTE v11[25]; // [rsp+17h] [rbp-19h] BYREF
a1->m_ringJumpRelated = 0;
*(_OWORD *)&a1->m_collidedTopMinY = 0;
*(_OWORD *)&a1->m_collidedLeftMaxX = 0;
m_isOnGround2 = a1->m_isOnGround2;
a1->m_wasOnSlope = a1->m_isOnSlope;
a1->m_isOnSlope = 0;
a1->m_isOnGround4 = m_isOnGround2;
if ( m_isOnGround2 && !a1->m_platformerMovingLeft && !a1->m_platformerMovingRight && a1->m_maybeSlidingTime > 0 )
{
a1->m_maybeSlidingTime = 0;
a1->m_maybeSlidingStartTime = a1->m_totalTime;
}
if ( a1->m_unk669 )
{
a1->m_currentPotentialSlope = nullptr;
p_m_potentialSlopeMap = &a1->m_potentialSlopeMap;
if ( !a1->m_potentialSlopeMap.__table_.__p2_.__value_ )
goto LABEL_15;
}
else
{
a1->m_unk669 = 1;
p_m_potentialSlopeMap = &a1->m_potentialSlopeMap;
if ( !a1->m_potentialSlopeMap.__table_.__p2_.__value_ )
goto LABEL_15;
}
next = a1->m_potentialSlopeMap.__table_.__p1_.__value_.__next_;
if ( next )
{
do
{
v5 = next->__next_;
operator delete(next);
next = v5;
}
while ( v5 );
}
a1->m_potentialSlopeMap.__table_.__p1_.__value_.__next_ = nullptr;
value = a1->m_potentialSlopeMap.__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
if ( value )
__bzero(p_m_potentialSlopeMap->__table_.__bucket_list_.__ptr_.__value_, 8 * value);
a1->m_potentialSlopeMap.__table_.__p2_.__value_ = 0;
LABEL_15:
m_currentPotentialSlope = a1->m_currentPotentialSlope;
if ( m_currentPotentialSlope )
{
m_uniqueID = m_currentPotentialSlope->m_uniqueID;
p_m_uniqueID = &m_uniqueID;
*(_QWORD *)(sub_10041E3B0(p_m_potentialSlopeMap, &m_uniqueID, &unk_10081B88E, &p_m_uniqueID, v11) + 24) = m_currentPotentialSlope;
}
m_currentSlope = a1->m_currentSlope;
if ( m_currentSlope )
{
m_uniqueID = m_currentSlope->m_uniqueID;
p_m_uniqueID = &m_uniqueID;
*(_QWORD *)(sub_10041E3B0(p_m_potentialSlopeMap, &m_uniqueID, &unk_10081B88E, &p_m_uniqueID, v11) + 24) = m_currentSlope;
}
}