//
// LevelEditorLayer::updateGameObjects from 0x1003585a0 to 0x100358ef4 (2388 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::init @ 0x100357730
// > LevelEditorLayer::updateEditor @ 0x1003583cc
// > EditorUI::onPlayback @ 0x1003c7848
//
// 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 __fastcall LevelEditorLayer::updateGameObjects(LevelEditorLayer *a1)
{
cocos2d::CCPoint v1; // x29
cocos2d::CCPoint v2; // x30
cocos2d::CCPoint v3; // d8
cocos2d::CCPoint v4; // d9
cocos2d::CCPoint v5; // d10
cocos2d::CCPoint v6; // d11
cocos2d::CCPoint v7; // d12
cocos2d::CCPoint v8; // d13
cocos2d::CCPoint v9; // d14
cocos2d::CCPoint v10; // d15
int *p_m_activeGradients; // x27
EffectGameObject *m_playbackObject; // x23
int m_objectID; // w8
EffectGameObject_vtbl *v15; // x8
int getRotationX_high; // w21
int setRotationY; // w22
int v18; // w23
std::__vector_base::pointer begin; // x0
signed __int64 v20; // x2
std::__vector_base::pointer end; // x10
int v22; // w8
std::__vector_base::pointer v23; // x9
unsigned __int64 v24; // x10
cocos2d::CCDirector *v25; // x0
__n128 v26; // q0
__n128 v27; // q1
EditorUI *m_editorUI; // x8
cocos2d::CCLayer *m_objectLayer; // x24
__n128 v30; // q0
__n128 v31; // q1
float m_playbackY; // s8
float m_playbackX; // s9
PlaybackMode m_playbackMode; // w8
EditorUI *v35; // x8
DrawGridLayer *m_drawGridLayer; // x8
_BOOL4 v37; // w8
cocos2d::CCArray *m_spawnOrderObjects; // x8
cocos2d::ccArray *data; // x9
__int64 num; // x8
GameObject **arr; // x20
unsigned __int64 v42; // x25
EffectGameObject *v43; // x24
EditorUI *v44; // x8
DrawGridLayer *v45; // x0
cocos2d::CCArray *v46; // x8
cocos2d::ccArray *v47; // x9
__int64 v48; // x8
cocos2d::CCObject **v49; // x20
unsigned __int64 v50; // x25
cocos2d::CCObject *v51; // x24
cocos2d::CCArray *v52; // x8
cocos2d::ccArray *v53; // x10
__int64 v54; // x9
cocos2d::CCObject **v55; // x28
unsigned __int64 v56; // x20
__int64 v57; // x24
cocos2d::CCObject *v58; // x25
DrawGridLayer *v59; // x26
DrawGridLayer *v60; // x24
float m_playbackTime; // s8
GJEffectManager *m_effectManager; // x20
ShaderLayer *m_shaderLayer; // x0
ShaderLayer *v64; // x8
cocos2d::CCArray *v65; // x8
cocos2d::ccArray *v66; // x8
__int64 v67; // x9
cocos2d::CCObject **v68; // x8
unsigned __int64 v69; // x9
cocos2d::CCObject *v70; // x10
double v71; // d12
__int64 v72; // x28
double v73; // d14
double v74; // d15
_BOOL4 v75; // w20
__int64 i; // x21
__int64 *v77; // x0
std::__vector_base::pointer v78; // x1
unsigned __int64 v79; // x8
__int64 v80; // x3
EffectGameObject *v81; // x22
DelayedSpawnNode **v82; // x8
cocos2d::CCPoint v83; // x8
_BOOL4 v84; // w9
float v85; // s11
EffectGameObject *v86; // x22
int m_targetGroupID; // w23
float v88; // s0
float v89; // s2
float v90; // s4
bool v91; // w10
float m_spawnTriggerDelay; // s0
bool v93; // w2
__int64 v94; // x23
int m_ordValue; // w8
float v96; // s0
float v97; // s2
bool v98; // w2
float v99; // s0
float v100; // s2
float *v101; // x0
float v102; // s0
ShaderLayer *v103; // x8
char v104; // w8
std::__tree, SFXTriggerInstance>, std::__map_value_compare, std::__value_type, SFXTriggerInstance>, std::less>, true>, std::allocator, SFXTriggerInstance>>>::__iter_pointer begin_node; // x22
std::__compressed_pair *>> *p_pair1; // x21
int left; // w19
AudioTargetType left_high; // w20
FMODAudioEngine *v109; // x0
std::__tree_end_node *> *v110; // x9
std::__tree_end_node *> *v111; // x8
bool v112; // zf
float v113; // [xsp+8h] [xbp-B8h]
float v114; // [xsp+Ch] [xbp-B4h]
float v115; // [xsp+10h] [xbp-B0h]
float v116; // [xsp+14h] [xbp-ACh]
cocos2d::CCPoint v117[21]; // [xsp+18h] [xbp-A8h] BYREF
cocos2d::ccColor3B v118; // 0:w0.3
cocos2d::CCPoint v119; // 0:kr08_8.8
cocos2d::CCPoint v120; // 0:s0.4,4:s1.4
cocos2d::CCPoint v121; // 0:s0.4,4:s1.4
if ( a1->m_playbackMode )
return;
v117[1] = v10;
v117[2] = v9;
v117[3] = v8;
v117[4] = v7;
v117[5] = v6;
v117[6] = v5;
v117[7] = v4;
v117[8] = v3;
v117[19] = v1;
v117[20] = v2;
p_m_activeGradients = &a1->m_activeGradients;
m_playbackObject = a1->m_playbackObject;
if ( m_playbackObject )
{
m_objectID = m_playbackObject->m_objectID;
if ( m_objectID == 31 )
{
v15 = m_playbackObject[1].EnhancedGameObject::GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
getRotationX_high = HIDWORD(v15->getRotationX);
setRotationY = (int)v15->setRotationY;
}
else
{
getRotationX_high = m_playbackObject->m_ordValue;
setRotationY = m_playbackObject->m_channelValue;
if ( m_objectID == 2900 && (m_playbackObject[1].m_nTag & 0x100) == 0 )
{
v18 = GameObject::getObjectDirection(m_playbackObject) != 1
&& GameObject::getObjectDirection(m_playbackObject) != 2;
goto LABEL_9;
}
}
}
else
{
getRotationX_high = 0;
LOBYTE(setRotationY) = 0;
}
v18 = 1;
LABEL_9:
if ( *((_BYTE *)p_m_activeGradients + 1745) == 1 )
GJEffectManager::reset(a1->m_effectManager);
GJBaseGameLayer::updateMGOffsetY(a1, 0.0, 0.0, 0, 0.0, -1, -1);
begin = a1->m_spawnGroupDelays.__begin_;
v20 = (char *)a1->m_spawnGroupDelays.__end_ - (char *)begin;
if ( v20 >= 1 )
memset_pattern16(begin, &unk_100645650, v20);
end = a1->m_sortedGroups.__end_;
if ( (__int64)end >= 1 )
{
v22 = 0;
v23 = a1->m_sortedGroups.__begin_;
v24 = (unsigned __int64)(end + 1);
do
{
*(_QWORD *)v23 &= ~(1LL << v22);
v23 += 8 * (v22 == 63);
if ( v22 == 63 )
v22 = 0;
else
++v22;
--v24;
}
while ( v24 > 1 );
}
v25 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v25);
m_editorUI = a1->m_editorUI;
if ( m_editorUI )
v27.n128_f32[0] = m_editorUI->m_toolbarHeight * 0.5;
else
v27.n128_u32[0] = 0;
m_objectLayer = a1->m_objectLayer;
v26.n128_f32[0] = v115 * 0.5;
v27.n128_f32[0] = v27.n128_f32[0] + (float)(v116 * 0.5);
sub_100022980(v26, v27, v117);
v119 = cocos2d::CCNode::convertToNodeSpace(m_objectLayer, v117);
m_playbackX = v113;
m_playbackY = v114;
*((_BYTE *)p_m_activeGradients + 2264) = 0;
m_playbackMode = a1->m_playbackMode;
if ( m_playbackMode )
{
if ( m_playbackMode == Playing )
m_playbackX = *(float *)((__int64 (__fastcall *)(PlayerObject *, float, float))a1->m_player1->getPosition)(
a1->m_player1,
v119.x,
v119.y);
}
else
{
v35 = a1->m_editorUI;
if ( v35 && v35->m_playbackActive )
{
LOBYTE(setRotationY) = 0;
getRotationX_high = 0;
m_drawGridLayer = a1->m_drawGridLayer;
m_playbackX = m_drawGridLayer->m_playbackX;
m_playbackY = m_drawGridLayer->m_playbackY;
*((_BYTE *)p_m_activeGradients + 2264) = 1;
}
else
{
v37 = a1->m_previewPosition.x != 0.0;
if ( a1->m_previewPosition.y != 0.0 )
v37 = 1;
if ( v37 )
{
m_playbackY = a1->m_previewPosition.y;
m_playbackX = a1->m_previewPosition.x;
}
}
}
m_spawnOrderObjects = a1->m_spawnOrderObjects;
if ( m_spawnOrderObjects )
{
data = m_spawnOrderObjects->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (GameObject **)data->arr;
v42 = (unsigned __int64)&arr[num - 1];
do
{
v43 = (EffectGameObject *)*arr;
if ( !*arr )
break;
GameObject::resetGroupDisabled(*arr);
if ( v43->m_isSpawnTriggered )
EffectGameObject::resetSpawnTrigger(v43);
++arr;
}
while ( (unsigned __int64)arr <= v42 );
}
}
v44 = a1->m_editorUI;
if ( (p_m_activeGradients[408] & 1) != 0 )
goto LABEL_44;
if ( v44 && v44->m_speedObjectsUpdated )
{
*((_BYTE *)p_m_activeGradients + 1632) = 0;
LABEL_45:
v44->m_speedObjectsUpdated = 0;
LABEL_46:
v45 = a1->m_drawGridLayer;
v45->m_updateSpeedObjects = 0;
v46 = a1->m_spawnOrderObjects;
if ( v46 )
{
v47 = v46->data;
v48 = v47->num;
if ( (_DWORD)v48 )
{
v49 = v47->arr;
v50 = (unsigned __int64)&v49[v48 - 1];
do
{
v51 = *v49;
if ( !*v49 )
break;
((void (__fastcall *)(cocos2d::CCPoint *__return_ptr, cocos2d::CCObject *))v51->__vftable[22].update)(
v117,
*v49);
sub_1000229D0(&v51[31].m_uOrderOfArrival, (double *)v117);
++v49;
}
while ( (unsigned __int64)v49 <= v50 );
v45 = a1->m_drawGridLayer;
}
}
DrawGridLayer::updateTimeMarkers(v45);
LevelTools::sortChannelOrderObjects(a1->m_spawnOrderObjects, nullptr, 1);
v52 = a1->m_spawnOrderObjects;
v53 = v52->data;
v54 = v53->num;
if ( (_DWORD)v54 )
{
v55 = v53->arr;
v56 = (unsigned __int64)&v55[v54 - 1];
v57 = 1;
do
{
v58 = *v55;
if ( !*v55 )
break;
v59 = a1->m_drawGridLayer;
v120.x = sub_1000229B8((__int64 *)v117, (__int64 *)&v58[31].m_uOrderOfArrival);
*(float *)&v58[32].m_nTag = DrawGridLayer::timeForPos(
v59,
v120,
(int)v117,
v58[31].m_uUnknown,
v58[31].m_unknown2,
0,
1,
0);
((void (__fastcall *)(cocos2d::CCObject *, __int64))v58->setTag)(v58, v57);
++v55;
v57 = (unsigned int)(v57 + 1);
}
while ( (unsigned __int64)v55 <= v56 );
v52 = a1->m_spawnOrderObjects;
}
qsort(v52->data->arr, v52->data->num, 8u, (int (__cdecl *)(const void *, const void *))sub_100356640);
goto LABEL_58;
}
if ( a1->m_drawGridLayer->m_updateSpeedObjects )
{
LABEL_44:
*((_BYTE *)p_m_activeGradients + 1632) = 0;
if ( !v44 )
goto LABEL_46;
goto LABEL_45;
}
LABEL_58:
if ( *((_BYTE *)p_m_activeGradients + 1745) == 1 )
LevelEditorLayer::transferDefaultColors(
a1,
a1->m_levelSettings->GJBaseGameLayer::m_effectManager,
a1->m_effectManager);
v60 = a1->m_drawGridLayer;
if ( *((_BYTE *)p_m_activeGradients + 2264) == 1 )
{
m_playbackTime = v60->m_playbackTime;
}
else
{
v30.n128_f32[0] = m_playbackX;
v31.n128_f32[0] = m_playbackY;
sub_100022980(v30, v31, v117);
m_playbackTime = DrawGridLayer::timeForPos(v60, v121, (int)v117, getRotationX_high, setRotationY, 0, 1, v18);
}
if ( *((_BYTE *)p_m_activeGradients + 1745) == 1 )
{
GJEffectManager::updateEffects(a1->m_effectManager, 0.0);
GJEffectManager::processColors(a1->m_effectManager);
m_effectManager = a1->m_effectManager;
v118 = GJEffectManager::activeColorForIndex(m_effectManager, 1005);
GJEffectManager::calculateLightBGColor(m_effectManager, (cocos2d::ccColor3B)(*(_DWORD *)&v118.r & 0xFFFFFF));
}
GJBaseGameLayer::resetSpawnChannelIndex(a1);
a1->m_gameState.m_currentChannel = 0;
m_shaderLayer = a1->m_shaderLayer;
if ( m_shaderLayer )
{
ShaderLayer::resetAllShaders(m_shaderLayer);
v64 = a1->m_shaderLayer;
v64->m_timesyncShaderActions = 1;
if ( a1->m_drawGridLayer->m_sortEffects )
v64->m_state.m_prevTime = -1.0;
}
GJBaseGameLayer::resetGradientLayers(a1);
v65 = a1->m_spawnOrderObjects;
if ( v65 )
{
v66 = v65->data;
v67 = v66->num;
if ( (_DWORD)v67 )
{
v68 = v66->arr;
v69 = (unsigned __int64)&v68[v67 - 1];
do
{
v70 = *v68;
if ( !*v68 )
break;
if ( LOBYTE(v70[26].m_nTag) == 1 )
LOBYTE(v70[25].m_nZOrder) = v70[31].m_uIndexInArray;
++v68;
}
while ( (unsigned __int64)v68 <= v69 );
}
}
v71 = m_playbackTime;
LevelEditorLayer::resetDelayedSpawnNodes(a1);
if ( m_playbackTime <= -0.000001 )
goto LABEL_132;
v72 = 0;
v73 = -0.000000999999997;
do
{
if ( v73 + 10.0 <= v71 )
v74 = 10.0;
else
v74 = v71 - (v73 + 10.0) + 10.0;
if ( v73 + 10.0 <= v71 )
v73 = v73 + 10.0;
else
v73 = m_playbackTime;
v75 = *((_BYTE *)p_m_activeGradients + 2264) == 1 && v73 > a1->m_drawGridLayer->m_oldPlaybackTime;
for ( i = v72; ; i = v94 )
{
if ( *((_BYTE *)p_m_activeGradients + 1633) == 1 )
{
v77 = (__int64 *)a1->m_delayedSpawnNodes.__begin_;
v78 = a1->m_delayedSpawnNodes.__end_;
v79 = 126 - 2 * __clz(((char *)v78 - (char *)v77) >> 3);
*((_BYTE *)p_m_activeGradients + 1633) = 0;
v117[0] = (cocos2d::CCPoint)sub_100356624;
if ( v78 == (std::__vector_base::pointer)v77 )
v80 = 0;
else
v80 = v79;
sub_10020AA24(v77, (__int64)v78, (__int64 (__fastcall **)(__int64, __int64))v117, v80, 1);
}
if ( (unsigned int)i >= (unsigned int)sub_10024A36C((__int64)a1->m_spawnOrderObjects) )
v81 = nullptr;
else
v81 = (EffectGameObject *)sub_10024A388((__int64)a1->m_spawnOrderObjects, i);
v82 = a1->m_delayedSpawnNodes.__end_;
if ( a1->m_delayedSpawnNodes.__begin_ == v82 )
{
v84 = 0;
v117[0] = 0;
v91 = v81 != nullptr;
LABEL_103:
if ( !v91 && !v84 )
goto LABEL_129;
goto LABEL_109;
}
v83 = (cocos2d::CCPoint)*(v82 - 1);
v117[0] = v83;
v84 = v83 != 0;
if ( !v81 )
{
if ( v83 )
break;
}
v91 = v81 != nullptr;
if ( !v81 || !*(_QWORD *)&v83 )
goto LABEL_103;
v85 = *(float *)(*(_QWORD *)&v83 + 8LL);
if ( v81->m_spawnTriggerDelay > v85 )
goto LABEL_99;
LABEL_109:
m_spawnTriggerDelay = v81->m_spawnTriggerDelay;
if ( v73 < m_spawnTriggerDelay && !v81->m_isSpawnTriggered )
goto LABEL_128;
v93 = v75 && m_spawnTriggerDelay > a1->m_drawGridLayer->m_oldPlaybackTime;
v94 = (unsigned int)(i + 1);
if ( v81->m_isSpawnTriggered )
goto LABEL_120;
m_ordValue = v81->m_ordValue;
if ( m_ordValue > a1->m_playbackOrder )
a1->m_playbackOrder = m_ordValue;
if ( a1->m_gameState.m_currentChannel != v81->m_channelValue )
{
LABEL_120:
v72 = (unsigned int)(i + 1);
}
else
{
v96 = v73;
v97 = v74;
v72 = (unsigned int)(i + 1);
if ( !LevelEditorLayer::activateTriggerEffect(a1, v81, v96, m_playbackTime, v97, v93) )
{
v74 = v74 + v81->m_spawnTriggerDelay - v73;
v73 = v81->m_spawnTriggerDelay;
goto LABEL_128;
}
}
LABEL_126:
;
}
v85 = *(float *)(*(_QWORD *)&v83 + 8LL);
LABEL_99:
if ( v73 >= v85 )
{
v86 = **(EffectGameObject ***)&v83;
sub_1000115B8((__int64)&a1->m_delayedSpawnNodes2, v117);
--a1->m_delayedSpawnNodes.__end_;
if ( v86->m_objectID == 1268 )
{
m_targetGroupID = v86->m_targetGroupID;
v88 = ((float (__fastcall *)(EffectGameObject *))v86->spawnXPosition)(v86);
v89 = v73;
v90 = v74;
LevelEditorLayer::spawnGroupPreview(
a1,
m_targetGroupID,
v88,
v85,
v89,
m_playbackTime,
v90,
v86->m_spawnOrdered,
v75);
}
else
{
v86->m_spawnTriggerDelay = v85;
v98 = v75 && v85 > a1->m_drawGridLayer->m_oldPlaybackTime;
v99 = v73;
v100 = v74;
LevelEditorLayer::activateTriggerEffect(a1, v86, v99, m_playbackTime, v100, v98);
v101 = (float *)((__int64 (__fastcall *)(EffectGameObject *))v86->getPosition)(v86);
((void (__fastcall *)(EffectGameObject *, float))v86->triggerActivated)(v86, *v101);
}
v94 = i;
goto LABEL_126;
}
i = v72;
LABEL_128:
v72 = i;
LABEL_129:
if ( *((_BYTE *)p_m_activeGradients + 1745) == 1 )
{
v102 = v74;
GJEffectManager::updateEffects(a1->m_effectManager, v102);
GJEffectManager::processColors(a1->m_effectManager);
}
}
while ( v73 < v71 );
LABEL_132:
v103 = a1->m_shaderLayer;
if ( v103 )
{
v103->m_state.m_time = v103->m_state.m_startTime + v71;
GJShaderState::timesyncShaderActions(&v103->m_state);
GJBaseGameLayer::updateShaderLayer(a1, 0.0);
a1->m_shaderLayer->m_timesyncShaderActions = 0;
}
if ( *((_BYTE *)p_m_activeGradients + 1745) == 1 )
GJBaseGameLayer::updateLevelColors(a1);
LevelEditorLayer::updateToggledGroups(a1);
LevelEditorLayer::updateBlendValues(a1);
v104 = *((_BYTE *)p_m_activeGradients + 2264);
if ( *((_BYTE *)p_m_activeGradients + 2265) == 1 )
{
*((_BYTE *)p_m_activeGradients + 2265) = 0;
if ( (v104 & 1) != 0 )
{
GJBaseGameLayer::processActivatedAudioTriggers(a1, a1->m_editorUI->m_playbackStartTime);
GJBaseGameLayer::clearActivatedAudioTriggers(a1);
v104 = *((_BYTE *)p_m_activeGradients + 2264);
goto LABEL_139;
}
}
else
{
LABEL_139:
if ( (v104 & 1) != 0 )
{
begin_node = a1->m_gameState.m_proximityVolumeRelated.__tree_.__begin_node_;
p_pair1 = &a1->m_gameState.m_proximityVolumeRelated.__tree_.__pair1_;
if ( begin_node != (std::__tree, SFXTriggerInstance>, std::__map_value_compare, std::__value_type, SFXTriggerInstance>, std::less>, true>, std::allocator, SFXTriggerInstance>>>::__iter_pointer)&a1->m_gameState.m_proximityVolumeRelated.__tree_.__pair1_ )
{
do
{
left = (int)begin_node[4].__left_;
left_high = HIDWORD(begin_node[4].__left_);
v109 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::setChannelVolumeMod(v109, left, left_high, 0.0);
v110 = (std::__tree_end_node *> *)begin_node[1].__left_;
if ( v110 )
{
do
{
v111 = v110;
v110 = (std::__tree_end_node *> *)v110->__left_;
}
while ( v110 );
}
else
{
do
{
v111 = (std::__tree_end_node *> *)begin_node[2].__left_;
v112 = v111->__left_ == (std::__tree_end_node *>::pointer)begin_node;
begin_node = v111;
}
while ( !v112 );
}
begin_node = v111;
}
while ( v111 != (std::__tree_end_node *> *)p_pair1 );
}
}
}
}