//
// GJBaseGameLayer::resetStoppedAreaObjects from 0x861874 to 0x861abc (584 bytes)
//
// 2 xrefs:
// > LevelEditorLayer::onStopPlaytest @ 0x662820
// > ??> @ 0xad748
//
// 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 GJBaseGameLayer::resetStoppedAreaObjects(GJBaseGameLayer *a1)
{
__int64 v2; // x23
int v3; // w22
signed int m_commandIndex; // w0
GameObject *v5; // x19
signed int m_unk4C8; // w1
float m_positionXOffset; // s0
int v8; // w24
double m_positionX; // d1
float m_positionYOffset; // s0
double m_positionY; // d1
float m_unk2BC; // s0
float m_unk2C0; // s5
void (__fastcall *setRScale)(GameObject *__hidden, float); // x1
float v15; // s3
float v16; // s2
float v17; // s1
float m_unk2A8; // s3
float m_unk2B0; // s1
float v20; // s1
float v21; // s2
void (__fastcall *setRRotation)(GameObject *__hidden, float); // x1
_BOOL4 m_isDecoration2; // w0
unsigned int v24; // w0
double v25; // d1
float v26; // s0
float m_scaleX; // w2
float m_scaleY; // w1
v2 = 0;
v3 = 0;
while ( a1->m_areaObjectsCount > v3 )
{
m_commandIndex = a1->m_gameState.m_commandIndex;
v5 = a1->m_areaObjects.m_start[v2];
m_unk4C8 = v5->m_unk4C8;
v5->m_isDirty = 1;
v5->m_isObjectRectDirty = 1;
v5->m_isOrientedBoxDirty = 1;
if ( m_unk4C8 < m_commandIndex )
{
m_positionXOffset = v5->m_positionXOffset;
v8 = 0;
if ( m_positionXOffset != 0.0 )
{
v5->m_isUnmodifiedPosDirty = 1;
m_positionX = v5->m_positionX;
v8 = 1;
v5->m_positionXOffset = 0.0;
v5->m_positionX = m_positionX - m_positionXOffset;
}
m_positionYOffset = v5->m_positionYOffset;
if ( m_positionYOffset != 0.0 )
{
v5->m_isUnmodifiedPosDirty = 1;
m_positionY = v5->m_positionY;
v8 = 1;
v5->m_positionYOffset = 0.0;
v5->m_positionY = m_positionY - m_positionYOffset;
}
m_unk2BC = v5->m_unk2BC;
m_unk2C0 = v5->m_unk2C0;
if ( m_unk2BC != 0.0 || m_unk2C0 != 0.0 )
{
setRScale = v5->setRScale;
v15 = v5->m_scaleX - m_unk2BC;
v16 = v5->m_scaleYOffset - m_unk2C0;
v17 = v5->m_scaleY - m_unk2C0;
v5->m_scaleXOffset = v5->m_scaleXOffset - m_unk2BC;
v5->m_scaleX = v15;
v5->m_unk2BC = 0.0;
v5->m_scaleYOffset = v16;
v5->m_scaleY = v17;
v5->m_unk2C0 = 0.0;
setRScale(v5, 1.0);
}
m_unk2A8 = v5->m_unk2A8;
m_unk2B0 = v5->m_unk2B0;
if ( m_unk2A8 != 0.0 || m_unk2B0 != 0.0 )
{
v20 = v5->m_rotationYOffset - m_unk2B0;
v21 = v5->m_rotationXOffset - m_unk2A8;
setRRotation = v5->setRRotation;
v5->m_unk2A8 = 0.0;
v5->m_rotationYOffset = v20;
v5->m_rotationXOffset = v21;
v5->m_unk2B0 = 0.0;
setRRotation(v5, 0.0);
}
m_isDecoration2 = v5->m_isDecoration2;
v5->m_unk4C8 = a1->m_gameState.m_commandIndex;
if ( !m_isDecoration2 )
{
v24 = a1->m_gameState.m_commandIndex;
if ( v5->m_unk4C4 != v24 )
{
v25 = v5->m_positionX;
v5->m_unk4C4 = v24;
*(float *)&v25 = v25;
v26 = v5->m_positionY;
v5->m_lastPosition.x = *(float *)&v25;
v5->m_lastPosition.y = v26;
GameObject::dirtifyObjectRect(v5);
v24 = a1->m_gameState.m_commandIndex;
}
if ( v5->m_unk4CC != v24 )
{
m_scaleX = v5->m_scaleX;
v5->m_unk4CC = v24;
m_scaleY = v5->m_scaleY;
v5->m_customScaleX = m_scaleX;
v5->m_customScaleY = m_scaleY;
GameObject::dirtifyObjectRect(v5);
}
}
if ( v8 )
a1->updateObjectSection(a1, v5);
}
++v3;
++v2;
v5->setRRotation(v5, 0.0);
v5->setRScale(v5, 1.0);
}
}