//
// PlayerObject::rotateGameplayObject from 0x348744 to 0x3488e2 (414 bytes)
//
// 3 xrefs:
// > PlayerObject::rotatePreSlopeObjects @ 0x3488fe
// > PlayerObject::spiderTestJumpInternal @ 0x348f68
// > PlayerObject::handleRotatedCollisionInternal @ 0x34c404
//
// 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 PlayerObject::rotateGameplayObject(PlayerObject *a1, GameObject *a2)
{
std::unordered_map *p_m_rotateObjectsRelated; // r8
const cocos2d::CCPoint *v5; // r0
float v6; // s10
float v7; // s16
float v8; // s17
float v9; // s16
double v10; // d9
const cocos2d::CCPoint *LastPosition; // r10
void (__fastcall *setRRotation)(GameObject *__hidden, float); // r3
_DWORD *v13; // r0
unsigned int m_uniqueID; // r4
_DWORD *v15; // r5
std::_Hashtable, 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>::size_type v16; // r7
_DWORD **v17; // r0
cocos2d::CCPoint v18; // [sp+Ch] [bp-2Ch] BYREF
cocos2d::CCPoint v19; // [sp+14h] [bp-24h] BYREF
cocos2d::CCPoint v20; // [sp+1Ch] [bp-1Ch] BYREF
cocos2d::CCPoint v21; // [sp+24h] [bp-14h] BYREF
cocos2d::CCPoint v22; // [sp+2Ch] [bp-Ch] BYREF
p_m_rotateObjectsRelated = &a1->m_rotateObjectsRelated;
if ( !sub_33C364(&a1->m_rotateObjectsRelated._M_h._M_buckets, a2->m_uniqueID) )
{
a2->getRealPosition(&v18, a2);
cocos2d::CCPoint::CCPoint(&v19, &v18);
v5 = a1->getPosition(a1);
cocos2d::CCPoint::CCPoint(&v20, v5);
v6 = (float)((float)((float)(v18.x - v20.x) * -0.000000043711) - (float)(v18.y - v20.y)) + v20.x;
v7 = (float)((float)(v18.x - v20.x) + (float)((float)(v18.y - v20.y) * -0.000000043711)) + v20.y;
v18.x = v6;
v8 = v6 - v19.x;
v18.y = v7;
v9 = v7 - v19.y;
v10 = (float)(v6 - v19.x);
GameObject::addToTempOffset(a2, v10, v9);
LastPosition = GameObject::getLastPosition(a2);
cocos2d::CCPoint::CCPoint(&v21, v8, v9);
cocos2d::CCPoint::operator+(&v22, LastPosition, &v21);
GameObject::setLastPosition(a2, &v22);
setRRotation = a2->setRRotation;
a2->m_startRotationX = a2->m_startRotationX - 90.0;
a2->m_startRotationY = a2->m_startRotationY - 90.0;
((void (__fastcall *)(GameObject *, _DWORD))setRRotation)(a2, 0);
a2->setObjectRectDirty(a2, 1);
if ( a2->getType(a2) == Slope )
GameObject::determineSlopeDirection(a2);
v13 = (_DWORD *)operator new(0x20u);
m_uniqueID = a2->m_uniqueID;
v13[2] = m_uniqueID;
v15 = v13;
*((double *)v13 + 2) = v10;
*v13 = 0;
*((double *)v13 + 3) = v9;
v16 = m_uniqueID % a1->m_rotateObjectsRelated._M_h._M_bucket_count;
v17 = sub_33C3B0(p_m_rotateObjectsRelated, v16, v13 + 2);
if ( v17 && *v17 )
operator delete(v15);
else
std::_Hashtable,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>::_M_insert_unique_node(
(int)p_m_rotateObjectsRelated,
v16,
m_uniqueID,
v15);
}
}