//
// GJBaseGameLayer::processAreaActions from 0x89cdc4 to 0x89d1b4 (1008 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::processMoveActionsStep @ 0x89d288
// > ??> @ 0x2d1c8
//
// 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::processAreaActions(GJBaseGameLayer *a1, float a2, bool a3)
{
int v4; // w21
_BOOL4 v5; // w25
__int64 v7; // x23
int m_processedAreaObjectsCount; // w2
GameObject *v9; // x19
float m_positionXOffset; // s0
int v11; // w26
double m_positionX; // d1
float m_positionYOffset; // s0
double m_positionY; // d1
float m_unk2BC; // s0
float m_unk2C0; // s5
float m_unk2A8; // s3
float m_unk2B0; // s1
float v19; // s1
float v20; // s2
void (__fastcall *setRRotation)(GameObject *__hidden, float); // x1
_BOOL4 m_isDecoration2; // w0
int m_areaObjectsCount; // w4
__int64 v24; // x21
int v25; // w0
int v26; // w19
GameObject **m_finish; // x1
int m_processedAreaObjectsIndex; // w2
GameObject *v29; // x3
GameObject **m_start; // x6
__int64 v31; // x1
GameObject *v32; // x0
double v33; // d1
double v34; // d0
float v35; // w5
float v36; // w3
void (__fastcall *setRScale)(GameObject *__hidden, float); // x1
float v38; // s3
float v39; // s2
float v40; // s1
unsigned int m_commandIndex; // w0
double v42; // d1
float v43; // s0
float m_scaleX; // w2
float m_scaleY; // w1
GameObject *v46; // [xsp+60h] [xbp+60h] BYREF
v4 = 0;
LODWORD(a1->m_gameState.m_unkUint3) = a1->m_gameState.m_commandIndex - 1;
v5 = a3;
v7 = 0;
GJBaseGameLayer::processAreaEffects(a1, &a1->m_gameState.m_scaleEffectInstances, (GJAreaActionType)2, a2, a3);
GJBaseGameLayer::processAreaEffects(a1, &a1->m_gameState.m_rotateEffectInstances, Rotate, a2, v5);
GJBaseGameLayer::processAreaEffects(a1, &a1->m_gameState.m_moveEffectInstances, (GJAreaActionType)0, a2, v5);
m_processedAreaObjectsCount = a1->m_processedAreaObjectsCount;
if ( m_processedAreaObjectsCount > 0 )
{
do
{
v9 = a1->m_processedAreaObjects.m_start[v7];
if ( v9->m_unk4C8 >= (signed int)a1->m_gameState.m_commandIndex )
{
if ( !v5 )
goto LABEL_16;
}
else
{
m_positionXOffset = v9->m_positionXOffset;
v9->m_isDirty = 1;
v9->m_isObjectRectDirty = 1;
v11 = 0;
v9->m_isOrientedBoxDirty = 1;
if ( m_positionXOffset != 0.0 )
{
v9->m_isUnmodifiedPosDirty = 1;
m_positionX = v9->m_positionX;
v11 = 1;
v9->m_positionXOffset = 0.0;
v9->m_positionX = m_positionX - m_positionXOffset;
}
m_positionYOffset = v9->m_positionYOffset;
if ( m_positionYOffset != 0.0 )
{
v9->m_isUnmodifiedPosDirty = 1;
m_positionY = v9->m_positionY;
v11 = 1;
v9->m_positionYOffset = 0.0;
v9->m_positionY = m_positionY - m_positionYOffset;
}
m_unk2BC = v9->m_unk2BC;
m_unk2C0 = v9->m_unk2C0;
if ( m_unk2BC != 0.0 || m_unk2C0 != 0.0 )
{
setRScale = v9->setRScale;
v38 = v9->m_scaleX - m_unk2BC;
v39 = v9->m_scaleYOffset - m_unk2C0;
v40 = v9->m_scaleY - m_unk2C0;
v9->m_scaleXOffset = v9->m_scaleXOffset - m_unk2BC;
v9->m_scaleX = v38;
v9->m_unk2BC = 0.0;
v9->m_scaleYOffset = v39;
v9->m_scaleY = v40;
v9->m_unk2C0 = 0.0;
setRScale(v9, 1.0);
}
m_unk2A8 = v9->m_unk2A8;
m_unk2B0 = v9->m_unk2B0;
if ( m_unk2A8 != 0.0 || m_unk2B0 != 0.0 )
{
v19 = v9->m_rotationYOffset - m_unk2B0;
v20 = v9->m_rotationXOffset - m_unk2A8;
setRRotation = v9->setRRotation;
v9->m_unk2A8 = 0.0;
v9->m_rotationYOffset = v19;
v9->m_rotationXOffset = v20;
v9->m_unk2B0 = 0.0;
setRRotation(v9, 0.0);
}
m_isDecoration2 = v9->m_isDecoration2;
v9->m_unk4C8 = a1->m_gameState.m_commandIndex;
if ( !m_isDecoration2 )
{
m_commandIndex = a1->m_gameState.m_commandIndex;
if ( v9->m_unk4C4 != m_commandIndex )
{
v42 = v9->m_positionX;
v9->m_unk4C4 = m_commandIndex;
*(float *)&v42 = v42;
v43 = v9->m_positionY;
v9->m_lastPosition.x = *(float *)&v42;
v9->m_lastPosition.y = v43;
GameObject::dirtifyObjectRect(v9);
m_commandIndex = a1->m_gameState.m_commandIndex;
}
if ( v9->m_unk4CC != m_commandIndex )
{
m_scaleX = v9->m_scaleX;
v9->m_unk4CC = m_commandIndex;
m_scaleY = v9->m_scaleY;
v9->m_customScaleX = m_scaleX;
v9->m_customScaleY = m_scaleY;
GameObject::dirtifyObjectRect(v9);
}
}
if ( v11 )
a1->updateObjectSection(a1, v9);
}
v9->setRRotation(v9, 0.0);
v9->setRScale(v9, 1.0);
m_processedAreaObjectsCount = a1->m_processedAreaObjectsCount;
LABEL_16:
++v4;
++v7;
}
while ( m_processedAreaObjectsCount > v4 );
}
m_areaObjectsCount = a1->m_areaObjectsCount;
a1->m_processedAreaObjectsCount = 0;
if ( m_areaObjectsCount > 0 )
{
v24 = 0;
v25 = 0;
v26 = 0;
do
{
while ( 1 )
{
m_processedAreaObjectsIndex = a1->m_processedAreaObjectsIndex;
v29 = a1->m_areaObjects.m_start[v24];
v46 = v29;
if ( m_processedAreaObjectsIndex <= v25 )
break;
++v26;
++v24;
a1->m_processedAreaObjects.m_start[v25++] = v29;
a1->m_processedAreaObjectsCount = v25;
if ( m_areaObjectsCount <= v26 )
goto LABEL_26;
}
m_finish = a1->m_processedAreaObjects.m_finish;
if ( m_finish == a1->m_processedAreaObjects.m_reserveEnd )
{
std::vector::_M_emplace_back_aux((__int64)&a1->m_processedAreaObjects, &v46);
m_processedAreaObjectsIndex = a1->m_processedAreaObjectsIndex;
v25 = a1->m_processedAreaObjectsCount;
m_areaObjectsCount = a1->m_areaObjectsCount;
}
else
{
if ( m_finish )
{
*m_finish = v29;
m_finish = a1->m_processedAreaObjects.m_finish;
}
a1->m_processedAreaObjects.m_finish = m_finish + 1;
}
++v26;
++v25;
a1->m_processedAreaObjectsIndex = m_processedAreaObjectsIndex + 1;
a1->m_processedAreaObjectsCount = v25;
++v24;
}
while ( m_areaObjectsCount > v26 );
LABEL_26:
if ( a1->m_areaObjectsUpdated && m_areaObjectsCount > 0 )
{
m_start = a1->m_areaObjects.m_start;
v31 = 0;
do
{
v32 = m_start[v31++];
v33 = v32->m_positionX;
v32->m_isObjectRectDirty = 1;
v34 = v32->m_positionY;
v32->m_isOrientedBoxDirty = 1;
*(float *)&v33 = v33;
*(float *)&v34 = v34;
v35 = v32->m_scaleX;
v36 = v32->m_scaleY;
v32->m_lastPosition.x = *(float *)&v33;
v32->m_lastPosition.y = *(float *)&v34;
v32->m_customScaleX = v35;
v32->m_customScaleY = v36;
}
while ( m_areaObjectsCount > (int)v31 );
}
}
}