//
// GJBaseGameLayer::processAreaRotateGroupAction from 0x100141cf0 to 0x100142016 (806 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::processAreaEffects @ 0x100141233
// > GJBaseGameLayer::processAreaEffects @ 0x1001413ec
//
// 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 __fastcall GJBaseGameLayer::processAreaRotateGroupAction(
GJBaseGameLayer *a1,
cocos2d::CCArray *a2,
EnterEffectInstance *a3,
cocos2d::CCPoint a4,
int a5,
int a6,
int a7,
int a8,
int a9,
bool a10,
bool a11)
{
int m_areaRotatedCount; // eax
int v14; // esi
cocos2d::ccArray *data; // rcx
int v16; // edi
int v17; // r14d
GameObject **arr; // r12
GameObject *v19; // r15
EnterEffectInstance *v20; // r13
float AreaObjectValue; // xmm0_4
__m128 m_rotationVariance_low; // xmm1
float v23; // xmm1_4
__m128 v24; // xmm0
float v25; // xmm1_4
cocos2d::CCDictionary *v26; // rax
cocos2d::CCDictionary *v27; // rax
int v28; // eax
unsigned __int64 v29; // [rsp+8h] [rbp-88h]
cocos2d::CCPoint *v30; // [rsp+10h] [rbp-80h]
__m128 v32; // [rsp+20h] [rbp-70h]
int v35; // [rsp+48h] [rbp-48h]
intptr_t v36; // [rsp+50h] [rbp-40h]
GameObject *v37; // [rsp+50h] [rbp-40h]
intptr_t m_uniqueID; // [rsp+58h] [rbp-38h]
cocos2d::CCArray *v39; // [rsp+58h] [rbp-38h]
int v40; // [rsp+60h] [rbp-30h]
bool v41; // [rsp+66h] [rbp-2Ah]
bool v42; // [rsp+67h] [rbp-29h] BYREF
bool v43; // [rsp+C0h] [rbp+30h]
v30 = *(cocos2d::CCPoint **)&a5;
m_areaRotatedCount = a1->m_areaRotatedCount + sub_100720070(a2);
a1->m_areaRotatedCount = m_areaRotatedCount;
v14 = 0;
if ( !a2 )
{
v16 = 0;
goto LABEL_29;
}
data = a2->data;
v16 = 0;
if ( data->num )
{
v17 = a10;
arr = (GameObject **)data->arr;
v29 = (unsigned __int64)&arr[data->num - 1];
v40 = 0;
v35 = 0;
while ( 1 )
{
v19 = *arr;
if ( !*arr )
{
LABEL_27:
m_areaRotatedCount = a1->m_areaRotatedCount;
v14 = v35;
v16 = v40;
goto LABEL_29;
}
if ( v19->m_isActivated
|| v19->m_outerSectionIndex <= a7
&& v19->m_outerSectionIndex >= a6
&& v19->m_middleSectionIndex <= a9
&& v19->m_middleSectionIndex >= a8 )
{
break;
}
LABEL_5:
++arr;
++v17;
if ( (unsigned __int64)arr > v29 )
goto LABEL_27;
}
v41 = GJBaseGameLayer::resetAreaObjectValues(a1, *arr, 1);
v42 = 0;
v20 = a3;
AreaObjectValue = GJBaseGameLayer::getAreaObjectValue(a1, a3, v19, v30, &v42);
if ( AreaObjectValue < 1.0 )
{
m_rotationVariance_low = (__m128)LODWORD(a3->m_rotationVariance);
m_rotationVariance_low.f32[0] = (float)(m_rotationVariance_low.f32[0]
* a1->m_varianceValues.__elems_[v19->m_varianceIndex + 18])
+ a3->m_rotation;
if ( m_rotationVariance_low.f32[0] != 0.0 )
{
v32 = m_rotationVariance_low;
v23 = 1.0 - GJBaseGameLayer::getEasedAreaValue(a1, v19, a3, AreaObjectValue, v42, v17);
v24 = v32;
v24.f32[0] = v32.f32[0] * v23;
v25 = v32.f32[0] * v23;
if ( !a11 )
{
if ( v24.f32[0] != 0.0 )
{
*(__m128 *)&v19->m_rotationXOffset = _mm_add_ps(
_mm_shuffle_ps(v24, v24, 0),
*(__m128 *)&v19->m_rotationXOffset);
if ( v43 )
((void (__fastcall *)(GameObject *, double))v19->setRRotation)(v19, 0.0);
if ( v19->m_objectType != Decoration )
{
*(_WORD *)&v19->m_isObjectRectDirty = 257;
if ( !v19->m_shouldUseOuterOb )
GameObject::calculateOrientedBox(v19);
}
}
goto LABEL_19;
}
v20 = a3;
goto LABEL_16;
}
v25 = 0.0;
if ( a11 )
{
LABEL_16:
m_uniqueID = v19->m_uniqueID;
v26 = (cocos2d::CCDictionary *)sub_1007200C0(
a1->m_targetGroupsArray,
(unsigned int)(v20->m_targetGroupIndex + 1));
v39 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v26, m_uniqueID);
v36 = v19->m_uniqueID;
v27 = (cocos2d::CCDictionary *)sub_1007200C0(
a1->m_targetGroupsArray,
(unsigned int)(v20->m_targetGroupIndex + 2));
v37 = (GameObject *)cocos2d::CCDictionary::objectForKey(v27, v36);
v28 = sub_100720070(v39);
if ( v20->m_gameObject->m_dontEditAreaParent )
v19->m_unk508 = 1;
v35 = v28 + v35 - 1;
GJBaseGameLayer::rotateAreaObjects(a1, v37, v39, v25, v43);
v19->m_unk508 = 0;
}
}
LABEL_19:
if ( v41 )
((void (__fastcall *)(GJBaseGameLayer *, GameObject *))a1->updateObjectSection)(a1, v19);
++v40;
goto LABEL_5;
}
LABEL_29:
a1->m_areaRotatedCount = v14 + m_areaRotatedCount;
a1->m_areaRotatedCountTotal += v14 + v16;
}