//
// GJBaseGameLayer::rotateAreaObjects from 0x14022a100 to 0x14022a4cf (975 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::processAreaRotateGroupAction @ 0x140229ff5
// > ??> @ 0x1406806ec
// > ??> @ 0x14068075c
// > ??> @ 0x1406cdaa0
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void GJBaseGameLayer::rotateAreaObjects(GJBaseGameLayer *a1, GameObject *a2, cocos2d::CCArray *a3, float a4, bool a5)
{
__m128 v6; // xmm7
struct cocos2d::CCAffineTransform *v9; // rax
cocos2d::CCNode *m_areaTransformNode2; // rcx
cocos2d::ccArray *data; // rsi
__int64 num; // rax
GameObject **arr; // rsi
GameObject **i; // r14
GameObject *v15; // rbx
bool v16; // al
GameObject_vtbl *v17; // r8
bool v18; // bp
__int64 v19; // rax
struct cocos2d::CCAffineTransform *v20; // rax
const struct cocos2d::CCAffineTransform *v21; // r9
struct cocos2d::CCAffineTransform *v22; // rax
GameObject_vtbl *v23; // rax
cocos2d::CCPoint v24; // [rsp+20h] [rbp-F8h] BYREF
_BYTE v25[8]; // [rsp+28h] [rbp-F0h] BYREF
_BYTE v26[8]; // [rsp+30h] [rbp-E8h] BYREF
_BYTE v27[8]; // [rsp+38h] [rbp-E0h] BYREF
_BYTE v28[24]; // [rsp+40h] [rbp-D8h] BYREF
struct cocos2d::CCAffineTransform v29; // [rsp+58h] [rbp-C0h] BYREF
_BYTE v30[24]; // [rsp+70h] [rbp-A8h] BYREF
_BYTE v31[24]; // [rsp+88h] [rbp-90h] BYREF
v6 = _mm_shuffle_ps(*(__m128 *)&a4, *(__m128 *)&a4, 0);
if ( GJBaseGameLayer::resetAreaObjectValues(a1, a2, 1) )
a1->updateObjectSection(a1, a2);
((void (__fastcall *)(GameObject *, _BYTE *))a2->getRealPosition)(a2, v25);
a1->m_areaTransformNode->setPosition_0(a1->m_areaTransformNode, (const cocos2d::CCPoint *)v25);
((void (__fastcall *)(cocos2d::CCNode *))a1->m_areaTransformNode->setScaleX)(a1->m_areaTransformNode);
((void (__fastcall *)(cocos2d::CCNode *))a1->m_areaTransformNode->setScaleY)(a1->m_areaTransformNode);
((void (__fastcall *)(cocos2d::CCNode *))a1->m_areaTransformNode->setSkewX)(a1->m_areaTransformNode);
((void (__fastcall *)(cocos2d::CCNode *))a1->m_areaTransformNode->setSkewY)(a1->m_areaTransformNode);
((void (__fastcall *)(cocos2d::CCNode *))a1->m_areaTransformNode->setRotation)(a1->m_areaTransformNode);
cocos2d::CCObject::retain(a1->m_areaTransformNode2);
a1->m_areaTransformNode2->removeFromParentAndCleanup(a1->m_areaTransformNode2, 0);
a1->m_areaTransformNode->addChild_1(a1->m_areaTransformNode, a1->m_areaTransformNode2);
cocos2d::CCObject::release(a1->m_areaTransformNode2);
v9 = a1->m_areaTransformNode->nodeToWorldTransform(a1->m_areaTransformNode, v30);
m_areaTransformNode2 = a1->m_areaTransformNode2;
v29 = *v9;
((void (__fastcall *)(cocos2d::CCNode *))m_areaTransformNode2->setScaleX)(m_areaTransformNode2);
((void (__fastcall *)(cocos2d::CCNode *))a1->m_areaTransformNode2->setScaleY)(a1->m_areaTransformNode2);
((void (__fastcall *)(cocos2d::CCNode *))a1->m_areaTransformNode2->setSkewX)(a1->m_areaTransformNode2);
((void (__fastcall *)(cocos2d::CCNode *))a1->m_areaTransformNode2->setSkewY)(a1->m_areaTransformNode2);
((void (__fastcall *)(cocos2d::CCNode *))a1->m_areaTransformNode2->setRotation)(a1->m_areaTransformNode2);
cocos2d::CCPoint::CCPoint(&v24);
if ( a3 )
{
data = a3->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (GameObject **)data->arr;
for ( i = &arr[num - 1]; arr <= i; ++arr )
{
v15 = *arr;
if ( !*arr )
break;
if ( !v15->m_unk508 )
{
v16 = GJBaseGameLayer::resetAreaObjectValues(a1, *arr, 1);
v17 = v15->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v15->m_isDirty = 1;
v18 = v16;
v19 = ((__int64 (__fastcall *)(GameObject *, _BYTE *))v17->getRealPosition)(v15, v27);
cocos2d::CCPoint::operator=(&v24, v19);
cocos2d::CCPoint::operator-(&v24, v26, v25);
a1->m_areaTransformNode2->setPosition_0(a1->m_areaTransformNode2, (const cocos2d::CCPoint *)v26);
v20 = a1->m_areaTransformNode2->nodeToParentTransform(a1->m_areaTransformNode2, v31);
v22 = cocos2d::CCAffineTransformConcat((cocos2d *)v28, v20, &v29, v21);
GJBaseGameLayer::moveAreaObject(
a1,
v15,
COERCE_FLOAT(*(_QWORD *)&v22->tx) - v24.x,
_mm_shuffle_ps((__m128)*(unsigned __int64 *)&v22->tx, (__m128)*(unsigned __int64 *)&v22->tx, 85).m128_f32[0]
- v24.y);
if ( v6.m128_f32[0] != 0.0 && v15->m_canRotateFree )
{
*(__m128 *)&v15->m_rotationXOffset = _mm_add_ps(*(__m128 *)&v15->m_rotationXOffset, v6);
if ( a5 )
((void (__fastcall *)(GameObject *))v15->setRRotation)(v15);
if ( v15->m_objectType != Decoration && !v15->m_shouldUseOuterOb )
{
v23 = v15->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v15->m_shouldUseOuterOb = 1;
v23->updateOrientedBox(v15);
v15->getObjectRect_0(v15);
}
}
if ( v18 )
a1->updateObjectSection(a1, v15);
}
}
}
}
a1->updateDisabledObjectsLastPos(a1, a3);
}