//
// GJBaseGameLayer::resetAreaObjectValues from 0x47cd70 to 0x47cf14 (420 bytes)
//
// 11 xrefs:
// > GJBaseGameLayer::resetStoppedAreaObjects @ 0x47cf42
// > GJBaseGameLayer::moveAreaObject @ 0x47cf88
// > GJBaseGameLayer::transformAreaObjects @ 0x47d04a
// > GJBaseGameLayer::transformAreaObjects @ 0x47d158
// > GJBaseGameLayer::processAreaTransformGroupAction @ 0x47d4fc
// > GJBaseGameLayer::rotateAreaObjects @ 0x47d6ea
// > GJBaseGameLayer::rotateAreaObjects @ 0x47d824
// > GJBaseGameLayer::processAreaRotateGroupAction @ 0x47d9f8
// > GJBaseGameLayer::processAreaMoveGroupAction @ 0x47dc42
// > GJBaseGameLayer::processAreaEffects @ 0x496714
// > GJBaseGameLayer::processAreaActions @ 0x496b94
//
// 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 GJBaseGameLayer::resetAreaObjectValues(GJBaseGameLayer *a1, GameObject *a2, bool a3)
{
_BOOL4 v3; // r8
float m_positionXOffset; // s14
bool v7; // r5
double m_positionX; // d6
float m_positionYOffset; // s14
double m_positionY; // d6
float m_unk2BC; // s13
float m_unk2C0; // s14
float m_scaleXOffset; // s15
float m_unk2A8; // s13
float m_unk2B0; // s14
float m_rotationXOffset; // s15
int m_areaObjectsCount; // r3
int m_areaObjectsIndex; // r2
_DWORD v20[3]; // [sp+0h] [bp-Ch] BYREF
v20[0] = a1;
v20[1] = a2;
v20[2] = a3;
v3 = a3;
if ( a2->m_unk4C8 >= (signed int)a1->m_gameState.m_commandIndex )
return 0;
if ( a3 )
GJBaseGameLayer::updateAreaObjectLastValues(a1, a2);
m_positionXOffset = a2->m_positionXOffset;
if ( m_positionXOffset == 0.0 )
{
v7 = 0;
}
else
{
v7 = 1;
m_positionX = a2->m_positionX;
a2->m_positionXOffset = 0.0;
a2->m_isUnmodifiedPosDirty = 1;
a2->m_positionX = m_positionX - m_positionXOffset;
}
m_positionYOffset = a2->m_positionYOffset;
if ( m_positionYOffset != 0.0 )
{
m_positionY = a2->m_positionY;
v7 = 1;
a2->m_positionYOffset = 0.0;
a2->m_isUnmodifiedPosDirty = 1;
a2->m_positionY = m_positionY - m_positionYOffset;
}
m_unk2BC = a2->m_unk2BC;
m_unk2C0 = a2->m_unk2C0;
if ( m_unk2BC != 0.0 || m_unk2C0 != 0.0 )
{
m_scaleXOffset = a2->m_scaleXOffset;
a2->m_unk2BC = 0.0;
a2->m_unk2C0 = 0.0;
a2->m_scaleXOffset = m_scaleXOffset - m_unk2BC;
a2->m_scaleX = a2->m_scaleX - m_unk2BC;
a2->m_scaleYOffset = a2->m_scaleYOffset - m_unk2C0;
a2->m_scaleY = a2->m_scaleY - m_unk2C0;
if ( !v3 )
((void (__fastcall *)(GameObject *, int))a2->setRScale)(a2, 1065353216);
}
m_unk2A8 = a2->m_unk2A8;
m_unk2B0 = a2->m_unk2B0;
if ( m_unk2A8 != 0.0 || m_unk2B0 != 0.0 )
{
m_rotationXOffset = a2->m_rotationXOffset;
a2->m_unk2A8 = 0.0;
a2->m_unk2B0 = 0.0;
a2->m_rotationXOffset = m_rotationXOffset - m_unk2A8;
a2->m_rotationYOffset = a2->m_rotationYOffset - m_unk2B0;
if ( !v3 )
((void (__fastcall *)(GameObject *, _DWORD))a2->setRRotation)(a2, 0);
}
a2->m_unk4C8 = a1->m_gameState.m_commandIndex;
if ( v3 )
{
m_areaObjectsCount = a1->m_areaObjectsCount;
m_areaObjectsIndex = a1->m_areaObjectsIndex;
v20[0] = a2;
if ( m_areaObjectsIndex > m_areaObjectsCount )
{
a1->m_areaObjects.m_start[m_areaObjectsCount] = a2;
}
else
{
std::vector::push_back((int)&a1->m_areaObjects, v20);
++a1->m_areaObjectsIndex;
}
++a1->m_areaObjectsCount;
}
else
{
GJBaseGameLayer::updateAreaObjectLastValues(a1, a2);
}
return v7;
}