//
// PlayerObject::unrotateGameplayObject from 0x10040b370 to 0x10040b601 (657 bytes)
//
// 4 xrefs:
// > PlayerObject::handleRotatedCollisionInternal @ 0x100406b7b
// > PlayerObject::handleRotatedCollisionInternal @ 0x100406b97
// > PlayerObject::unrotatePreSlopeObjects @ 0x10040b637
// > PlayerObject::spiderTestJumpInternal @ 0x10040de35
//
// 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::unrotateGameplayObject(PlayerObject *a1, GameObject *a2)
{
unsigned __int64 value; // r9
std::unordered_map *p_m_rotateObjectsRelated; // rdi
unsigned __int64 m_uniqueID; // rcx
unsigned __int64 v5; // rdx
unsigned __int64 v6; // r11
__int64 v7; // r8
std::__hash_node_base, void *> *> *v8; // rax
std::__hash_node_base, void *> *>::__next_pointer next; // r10
std::__hash_node_base, void *> *>::__next_pointer v10; // rax
unsigned __int64 v11; // rax
__int64 v13; // r15
unsigned __int64 *LastPosition; // r12
float v15; // xmm0_4
float v16; // xmm1_4
unsigned __int64 v17; // [rsp-48h] [rbp-48h] BYREF
unsigned __int64 *v18; // [rsp-40h] [rbp-40h] BYREF
char v19; // [rsp-31h] [rbp-31h] BYREF
value = a1->m_rotateObjectsRelated.__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
if ( value )
{
p_m_rotateObjectsRelated = &a1->m_rotateObjectsRelated;
m_uniqueID = a2->m_uniqueID;
v5 = ((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)
+ ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4);
v6 = (0x101010101010101LL * (v5 & 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v6 > 1 )
{
v7 = a2->m_uniqueID;
if ( value <= m_uniqueID )
{
if ( (value | m_uniqueID) >> 32 )
{
v5 = m_uniqueID % value;
v7 = m_uniqueID % value;
}
else
{
v5 = (unsigned int)m_uniqueID % (unsigned int)value;
v7 = v5;
}
}
}
else
{
v7 = m_uniqueID & (value - 1);
}
v8 = p_m_rotateObjectsRelated->__table_.__bucket_list_.__ptr_.__value_[v7];
if ( v8 )
{
next = v8->__next_;
if ( v8->__next_ )
{
if ( (unsigned int)v6 < 2 )
{
--value;
while ( 1 )
{
v10 = next[1].__next_;
if ( v10 == (std::__hash_node_base, void *> *>::__next_pointer)m_uniqueID )
{
if ( LODWORD(next[2].__next_) == (_DWORD)m_uniqueID )
goto LABEL_27;
}
else if ( (value & (unsigned __int64)v10) != v7 )
{
return;
}
next = next->__next_;
if ( !next )
return;
}
}
do
{
v11 = (unsigned __int64)next[1].__next_;
if ( v11 == m_uniqueID )
{
if ( LODWORD(next[2].__next_) == (_DWORD)m_uniqueID )
{
LABEL_27:
((void (__fastcall *)(GameObject *, __int64, unsigned __int64, unsigned __int64, __int64, unsigned __int64))a2->setObjectRectDirty)(
a2,
1,
v5,
m_uniqueID,
v7,
value);
LODWORD(v17) = a2->m_uniqueID;
v18 = &v17;
v13 = sub_10041E850(p_m_rotateObjectsRelated, &v17, &unk_10081B88E, &v18, &v19);
GameObject::addToTempOffset(a2, -*(double *)(v13 + 24), -*(double *)(v13 + 32));
LastPosition = (unsigned __int64 *)GameObject::getLastPosition(a2);
v15 = *(double *)(v13 + 24);
v16 = *(double *)(v13 + 32);
sub_10028CBE0((float *)&v17, -v15, -v16);
sub_10028CCE0((double *)&v18, LastPosition, &v17);
GameObject::setLastPosition(a2, (const cocos2d::CCPoint *)&v18);
_mm_storel_ps(
(double *)&a2->m_startRotationX,
_mm_add_ps((__m128)*(unsigned __int64 *)&a2->m_startRotationX, (__m128)xmmword_10081B800));
((void (__fastcall *)(GameObject *, double))a2->setRRotation)(a2, 0.0);
if ( ((unsigned int (__fastcall *)(GameObject *))a2->getType)(a2) == 25 )
GameObject::determineSlopeDirection(a2);
LODWORD(v18) = a2->m_uniqueID;
sub_1000569A0(p_m_rotateObjectsRelated, (int *)&v18);
return;
}
}
else
{
if ( v11 < value )
goto LABEL_23;
if ( (value | v11) >> 32 )
{
v5 = v11 % value;
v11 %= value;
LABEL_23:
if ( v11 != v7 )
return;
goto LABEL_18;
}
v5 = (unsigned int)v11 % (unsigned int)value;
if ( v5 != v7 )
return;
}
LABEL_18:
next = next->__next_;
}
while ( next );
}
}
}
}