//
// GJBaseGameLayer::resetAreaObjectValues from 0x100141460 to 0x1001418a8 (1096 bytes)
//
// 16 xrefs:
// > GJBaseGameLayer::processAreaEffects @ 0x100140ae4
// > GJBaseGameLayer::processAreaTransformGroupAction @ 0x1001419f7
// > GJBaseGameLayer::processAreaRotateGroupAction @ 0x100141dbd
// > GJBaseGameLayer::processAreaMoveGroupAction @ 0x100142154
// > GJBaseGameLayer::processAreaMoveGroupAction @ 0x100142531
// > GJBaseGameLayer::processAreaMoveGroupAction @ 0x100142590
// > GJBaseGameLayer::processAreaMoveGroupAction @ 0x100142718
// > GJBaseGameLayer::processAreaActions @ 0x10014340e
// > GJBaseGameLayer::processAreaActions @ 0x10014349d
// > GJBaseGameLayer::resetStoppedAreaObjects @ 0x1001437e7
// > GJBaseGameLayer::transformAreaObjects @ 0x100143bcf
// > GJBaseGameLayer::transformAreaObjects @ 0x100143d67
// > GJBaseGameLayer::transformAreaObjects @ 0x100143e8a
// > GJBaseGameLayer::rotateAreaObjects @ 0x1001441b9
// > GJBaseGameLayer::rotateAreaObjects @ 0x10014439e
// > GJBaseGameLayer::rotateAreaObjects @ 0x100144448
//
// 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
//
bool __fastcall GJBaseGameLayer::resetAreaObjectValues(GJBaseGameLayer *a1, GameObject *a2, bool a3)
{
signed int m_commandIndex; // eax
bool v5; // r15
bool v6; // r15
__m128 v7; // xmm0
float m_positionYOffset; // xmm2_4
_BOOL4 v9; // r13d
__m128 v10; // xmm0
__m128 v11; // xmm2
float m_unk2A8; // xmm1_4
float m_unk2B0; // xmm0_4
unsigned int v14; // eax
int m_areaObjectsCount; // r15d
int m_areaObjectsIndex; // esi
float m_rotationYOffset; // xmm3_4
std::__vector_base::pointer end; // rdx
GameObject **value; // rax
GameObject **v20; // r14
std::__vector_base::pointer begin; // r8
signed __int64 v22; // rdx
__int64 v23; // r9
__int64 v24; // rax
unsigned __int64 v25; // r12
_QWORD *v26; // r13
std::__vector_base::pointer __src; // [rsp+0h] [rbp-50h]
__int64 v29; // [rsp+8h] [rbp-48h]
signed __int64 v30; // [rsp+18h] [rbp-38h]
bool v31; // [rsp+24h] [rbp-2Ch]
m_commandIndex = a1->m_gameState.m_commandIndex;
if ( a2->m_unk4C8 >= m_commandIndex )
{
LOBYTE(v9) = 0;
}
else
{
if ( a3 && !a2->m_isDecoration2 )
{
if ( a2->m_unk4C4 != m_commandIndex )
{
a2->m_lastPosition = *(cocos2d::CCPoint *)&a2->m_positionX;
a2->m_unk4C4 = m_commandIndex;
v5 = a3;
GameObject::dirtifyObjectRect(a2);
a3 = v5;
m_commandIndex = a1->m_gameState.m_commandIndex;
}
if ( a2->m_unk4CC != m_commandIndex )
{
*(_QWORD *)&a2->m_customScaleX = *(_QWORD *)&a2->m_scaleX;
a2->m_unk4CC = m_commandIndex;
v6 = a3;
GameObject::dirtifyObjectRect(a2);
a3 = v6;
}
}
v7.i32[0] = LODWORD(a2->m_positionXOffset);
if ( v7.f32[0] != 0.0 )
{
a2->m_positionX = a2->m_positionX - v7.f32[0];
a2->m_positionXOffset = 0.0;
a2->m_isUnmodifiedPosDirty = 1;
}
m_positionYOffset = a2->m_positionYOffset;
if ( m_positionYOffset == 0.0 )
{
v9 = _mm_cvtsi128_si32((__m128i)_mm_cmpneq_ss((__m128)0LL, v7)) & 1;
}
else
{
a2->m_positionY = a2->m_positionY - m_positionYOffset;
a2->m_positionYOffset = 0.0;
a2->m_isUnmodifiedPosDirty = 1;
LOBYTE(v9) = 1;
}
v10 = (__m128)*(unsigned __int64 *)&a2->m_unk2BC;
if ( v10.f32[0] != 0.0 || _mm_movehdup_ps(v10).f32[0] != 0.0 )
{
v11 = (__m128)*(unsigned __int64 *)&a2->m_scaleX;
*(__m128i *)&a2->m_scaleXOffset = _mm_move_epi64((__m128i)_mm_sub_ps(
(__m128)*(unsigned __int64 *)&a2->m_scaleXOffset,
v10));
_mm_storel_ps((double *)&a2->m_scaleX, _mm_sub_ps(v11, v10));
if ( !a3 )
{
((void (__fastcall *)(GameObject *, float))a2->setRScale)(a2, 1.0);
a3 = 0;
}
}
m_unk2A8 = a2->m_unk2A8;
m_unk2B0 = a2->m_unk2B0;
if ( m_unk2A8 == 0.0 && m_unk2B0 == 0.0 )
{
v14 = a1->m_gameState.m_commandIndex;
a2->m_unk4C8 = v14;
if ( a3 )
{
m_areaObjectsCount = a1->m_areaObjectsCount;
m_areaObjectsIndex = a1->m_areaObjectsIndex;
if ( m_areaObjectsIndex > m_areaObjectsCount )
{
LABEL_22:
a1->m_areaObjects.__begin_[m_areaObjectsCount] = a2;
LABEL_47:
a1->m_areaObjectsCount = m_areaObjectsCount + 1;
return v9;
}
LABEL_25:
end = a1->m_areaObjects.__end_;
value = a1->m_areaObjects.__end_cap_.__value_;
if ( end >= value )
{
begin = a1->m_areaObjects.__begin_;
v22 = (char *)end - (char *)begin;
v23 = v22 >> 3;
if ( (unsigned __int64)((v22 >> 3) + 1) >> 61 )
sub_1000CACE0();
__src = a1->m_areaObjects.__begin_;
v24 = (char *)value - (char *)begin;
v25 = v24 >> 2;
if ( v24 >> 2 <= (unsigned __int64)((v22 >> 3) + 1) )
v25 = (v22 >> 3) + 1;
if ( (unsigned __int64)v24 >= 0x7FFFFFFFFFFFFFF8LL )
v25 = 0x1FFFFFFFFFFFFFFFLL;
v31 = v9;
if ( v25 )
{
v29 = v22 >> 3;
v30 = v22;
if ( v25 > 0x1FFFFFFFFFFFFFFFLL )
sub_100054850();
v26 = operator new(8 * v25);
v22 = v30;
v23 = v29;
}
else
{
v26 = nullptr;
}
v26[v23] = a2;
v20 = (GameObject **)&v26[v23 + 1];
memcpy(v26, __src, v22);
a1->m_areaObjects.__begin_ = (std::__vector_base::pointer)v26;
a1->m_areaObjects.__end_ = v20;
a1->m_areaObjects.__end_cap_.__value_ = (GameObject **)&v26[v25];
if ( __src )
{
operator delete(__src);
m_areaObjectsCount = a1->m_areaObjectsCount;
m_areaObjectsIndex = a1->m_areaObjectsIndex;
}
LOBYTE(v9) = v31;
}
else
{
*end = a2;
v20 = end + 1;
}
a1->m_areaObjects.__end_ = v20;
a1->m_areaObjectsIndex = m_areaObjectsIndex + 1;
goto LABEL_47;
}
}
else
{
m_rotationYOffset = a2->m_rotationYOffset;
a2->m_rotationXOffset = a2->m_rotationXOffset - m_unk2A8;
a2->m_unk2A8 = 0.0;
a2->m_rotationYOffset = m_rotationYOffset - m_unk2B0;
a2->m_unk2B0 = 0.0;
if ( a3 )
{
a2->m_unk4C8 = a1->m_gameState.m_commandIndex;
m_areaObjectsCount = a1->m_areaObjectsCount;
m_areaObjectsIndex = a1->m_areaObjectsIndex;
if ( m_areaObjectsIndex > m_areaObjectsCount )
goto LABEL_22;
goto LABEL_25;
}
((void (__fastcall *)(GameObject *, double))a2->setRRotation)(a2, 0.0);
v14 = a1->m_gameState.m_commandIndex;
a2->m_unk4C8 = v14;
}
if ( !a2->m_isDecoration2 )
{
if ( a2->m_unk4C4 != v14 )
{
a2->m_lastPosition = *(cocos2d::CCPoint *)&a2->m_positionX;
a2->m_unk4C4 = v14;
GameObject::dirtifyObjectRect(a2);
v14 = a1->m_gameState.m_commandIndex;
}
if ( a2->m_unk4CC != v14 )
{
*(_QWORD *)&a2->m_customScaleX = *(_QWORD *)&a2->m_scaleX;
a2->m_unk4CC = v14;
GameObject::dirtifyObjectRect(a2);
}
}
}
return v9;
}