//
// LevelEditorLayer::updateVisibility from 0x1000eac30 to 0x1000eb767 (2871 bytes)
//
// 1 xrefs:
// > ??> @ 0x1008c0638
//
// 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::updateVisibility(LevelEditorLayer *a1, float a2)
{
EditorUI *m_editorUI; // rax
int v4; // eax
EditorUI *v5; // rcx
__int64 m_selectedObjects; // rax
GameObject *m_selectedObject; // rdi
unsigned int *v8; // rax
__int64 v9; // rcx
__int64 *v10; // rax
unsigned __int64 v11; // rcx
__int64 v12; // rdx
EditorUI *v13; // rax
int v14; // eax
EditorUI *v15; // rcx
__int64 v16; // rax
GameObject *v17; // rdi
unsigned int *v18; // rax
__int64 v19; // rcx
unsigned __int64 v20; // rax
unsigned __int64 v21; // rcx
PlaybackMode m_playbackMode; // r12d
GJEffectManager *m_effectManager; // r14
int v24; // eax
const cocos2d::ccColor3B *v25; // rax
int v26; // eax
GameManager *v27; // rax
__int64 v28; // r13
std::__vector_base::pointer begin; // rax
EffectGameObject *v30; // r14
unsigned __int8 v31; // al
int MainColorMode; // eax
__int64 v33; // rcx
bool v34; // r15
float m_totalTime; // xmm0_4
float v36; // xmm0_4
int v37; // xmm0_4
__int16 m_currentLayer; // ax
__int64 v39; // rcx
int v40; // xmm1_4
float v41; // xmm1_4
bool m_previewMode; // al
float v43; // xmm0_4
GJEffectManager *v44; // r15
int v45; // eax
GJSpriteColor *MainColor; // rax
GJEffectManager *v47; // r15
int v48; // eax
GJSpriteColor *SecondaryColor; // rax
int v50; // r12d
int v51; // eax
int v52; // r15d
GJEffectManager *v53; // r12
int GroupID; // eax
GJSpriteColor *m_baseColor; // rcx
float v56; // xmm0_4
int v57; // r15d
GJEffectManager *v58; // r12
int v59; // eax
float v60; // xmm0_4
int v61; // eax
int v62; // r15d
int v63; // eax
int SecondaryColorMode; // eax
__int64 v65; // rcx
int v66; // r15d
GJEffectManager *v67; // r12
int v68; // eax
GJSpriteColor *m_detailColor; // rcx
float v70; // xmm0_4
int v71; // r15d
GJEffectManager *v72; // r12
int v73; // eax
float v74; // xmm0_4
cocos2d::CCArray *m_batchNodes; // rax
cocos2d::ccArray *data; // rax
cocos2d::CCSpriteBatchNode **arr; // r14
unsigned __int64 v78; // r15
unsigned int v79; // r14d
KeyframeGameObject *v80; // rax
int v81; // [rsp+8h] [rbp-58h]
PlaybackMode v82; // [rsp+Ch] [rbp-54h]
int v83; // [rsp+10h] [rbp-50h]
bool GameVariable; // [rsp+1Fh] [rbp-41h]
cocos2d::ccColor3B v86; // [rsp+20h] [rbp-40h] BYREF
__int64 v87; // [rsp+28h] [rbp-38h]
cocos2d::ccColor3B v88[14]; // [rsp+34h] [rbp-2Ch] BYREF
cocos2d::ccHSVValue v89; // 0:xmm0_8.8,8:rdx.8
m_editorUI = a1->m_editorUI;
if ( m_editorUI )
{
v4 = sub_100720070(m_editorUI->m_selectedObjects);
v5 = a1->m_editorUI;
if ( v4 )
{
m_selectedObjects = (__int64)v5->m_selectedObjects;
if ( !m_selectedObjects )
goto LABEL_11;
}
else
{
m_selectedObject = v5->m_selectedObject;
if ( !m_selectedObject )
goto LABEL_11;
m_selectedObjects = sub_10071FA80(m_selectedObject);
if ( !m_selectedObjects )
goto LABEL_11;
}
v8 = *(unsigned int **)(m_selectedObjects + 56);
v9 = *v8;
if ( *v8 )
{
v10 = *((__int64 **)v8 + 2);
v11 = (unsigned __int64)&v10[v9 - 1];
do
{
v12 = *v10;
if ( !*v10 )
break;
*(_BYTE *)(v12 + 651) = *(_BYTE *)(v12 + 650);
*(_BYTE *)(v12 + 650) = 0;
++v10;
}
while ( (unsigned __int64)v10 <= v11 );
}
}
LABEL_11:
GJBaseGameLayer::preUpdateVisibility(a1, a2);
v13 = a1->m_editorUI;
if ( !v13 )
goto LABEL_21;
v14 = sub_100720070(v13->m_selectedObjects);
v15 = a1->m_editorUI;
if ( v14 )
{
v16 = (__int64)v15->m_selectedObjects;
if ( !v16 )
goto LABEL_21;
}
else
{
v17 = v15->m_selectedObject;
if ( !v17 )
goto LABEL_21;
v16 = sub_10071FA80(v17);
if ( !v16 )
goto LABEL_21;
}
v18 = *(unsigned int **)(v16 + 56);
v19 = *v18;
if ( *v18 )
{
v20 = *((_QWORD *)v18 + 2);
v21 = v20 + 8 * v19 - 8;
do
{
if ( !*(_QWORD *)v20 )
break;
*(_BYTE *)(*(_QWORD *)v20 + 650LL) = *(_BYTE *)(*(_QWORD *)v20 + 651LL);
v20 += 8LL;
}
while ( v20 <= v21 );
}
LABEL_21:
m_playbackMode = a1->m_playbackMode;
m_effectManager = a1->m_effectManager;
*(cocos2d::ccColor3B *)&v24 = GJEffectManager::activeColorForIndex(m_effectManager, 1005);
GJEffectManager::calculateLightBGColor(m_effectManager, (cocos2d::ccColor3B)v24);
v25 = (const cocos2d::ccColor3B *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_background->getColor)(a1->m_background);
*(cocos2d::ccColor3B *)&v26 = GameToolbox::transformColor(v25, 0.0, -0.30000001, 0.40000001);
v83 = v26;
v27 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v27, "0121");
if ( a1->m_activeObjectsCount > 0 )
{
v28 = 0;
v82 = m_playbackMode;
do
{
begin = a1->m_activeObjects.__begin_;
v30 = (EffectGameObject *)begin[v28];
if ( a1->m_playbackMode )
{
if ( !v30->m_isActivated )
goto LABEL_34;
}
else
{
GameObject::updateStartPos(begin[v28]);
((void (__fastcall *)(cocos2d::ccColor3B *, EffectGameObject *))v30->getRealPosition)(&v86, v30);
((void (__fastcall *)(EffectGameObject *, cocos2d::ccColor3B *))v30->setPosition)(v30, &v86);
if ( !v30->m_isActivated )
goto LABEL_34;
}
v31 = 1;
if ( !a1->m_updateColorSprites && !v30->m_updateParents )
{
MainColorMode = GameObject::getMainColorMode(v30);
v33 = *(_QWORD *)&a1->m_blendingColors2.__begin_[8 * ((unsigned __int64)MainColorMode >> 6)];
if ( !_bittest64(&v33, MainColorMode) )
{
if ( !GameObject::hasSecondaryColor(v30) )
goto LABEL_34;
SecondaryColorMode = GameObject::getSecondaryColorMode(v30);
v65 = *(_QWORD *)&a1->m_blendingColors2.__begin_[8 * ((unsigned __int64)SecondaryColorMode >> 6)];
if ( !_bittest64(&v65, SecondaryColorMode) )
goto LABEL_34;
}
v31 = 0;
}
v34 = v31;
((void (__fastcall *)(EffectGameObject *, _QWORD))v30->addMainSpriteToParent)(v30, v31);
GameObject::addColorSpriteToParent(v30, v34);
v30->m_updateParents = 0;
LABEL_34:
((void (__fastcall *)(EffectGameObject *))v30->activateObject)(v30);
if ( a1->m_previewAnimations
&& ((unsigned __int8 (__fastcall *)(EffectGameObject *))v30->getHasSyncedAnimation)(v30)
|| a1->m_previewParticles
&& v30->m_objectID == 2065
&& ((unsigned __int8 (__fastcall *)(EffectGameObject *))v30->getHasSyncedAnimation)(v30) )
{
m_totalTime = a1->m_gameState.m_totalTime;
((void (__fastcall *)(EffectGameObject *, __int64, float))v30->updateSyncedAnimation)(
v30,
0xFFFFFFFFLL,
m_totalTime);
}
if ( a1->m_previewAnimations && ((unsigned __int8 (__fastcall *)(EffectGameObject *))v30->getHasRotateAction)(v30) )
EnhancedGameObject::updateRotateAction(v30, a2);
if ( a1->m_playbackMode == Not
&& ((unsigned __int8 (__fastcall *)(EffectGameObject *))v30->getHasSyncedAnimation)(v30)
&& v30->m_animateOnTrigger )
{
EnhancedGameObject::previewAnimateOnTrigger(v30);
}
if ( ((unsigned int (__fastcall *)(EffectGameObject *))v30->getType)(v30) == 30 )
{
v36 = 0.0;
if ( m_playbackMode == Playing )
v36 = *(float *)(((__int64 (__fastcall *)(cocos2d::CCNode *, double))a1->m_hoverNode->getPosition)(
a1->m_hoverNode,
0.0)
+ 4);
EffectGameObject::updateInteractiveHover(v30, v36);
}
*(float *)&v37 = 255.0;
if ( m_playbackMode != Playing )
{
m_currentLayer = a1->m_currentLayer;
v39 = 0;
v40 = 1132396544;
if ( m_currentLayer != v30->m_editorLayer )
{
LOBYTE(v39) = m_currentLayer == (__int16)((unsigned __int16)*(_DWORD *)&v30->m_editorLayer2 == 0
? -1
: v30->m_editorLayer2);
v40 = dword_100816480[v39];
}
*(float *)&v37 = 255.0;
if ( m_currentLayer != -1 )
v37 = v40;
}
if ( !GameVariable || !v30->m_isHide || (v41 = 0.0, v30->m_isSelected) )
{
if ( v30->m_objectID == 3032 && a1->m_playbackMode )
*(float *)&v37 = 50.0;
v41 = *(float *)&v37;
}
if ( !a1->m_previewMode && GameObject::hasSecondaryColor(v30) )
{
v30->m_detailColor->EnhancedGameObject::GameObject::m_opacity = v41 * 0.69999999;
if ( v30->m_unk367 )
AnimatedGameObject::updateChildSpriteColor((AnimatedGameObject *)v30, (cocos2d::ccColor3B)-1);
}
if ( !a1->m_previewMode || v30->m_isSelected )
{
GameObject::getMainColor(v30)->m_opacity = 1.0;
goto LABEL_70;
}
v44 = a1->m_effectManager;
v45 = GameObject::getMainColorMode(v30);
LODWORD(v87) = GJEffectManager::activeOpacityForIndex(v44, v45);
MainColor = GameObject::getMainColor(v30);
LODWORD(MainColor->m_opacity) = v87;
if ( GameObject::hasSecondaryColor(v30) )
{
v47 = a1->m_effectManager;
v48 = GameObject::getSecondaryColorMode(v30);
LODWORD(v87) = GJEffectManager::activeOpacityForIndex(v47, v48);
SecondaryColor = GameObject::getSecondaryColor(v30);
LODWORD(SecondaryColor->m_opacity) = v87;
}
v50 = GameObject::getMainColorMode(v30);
v86.b = -1;
*(_WORD *)&v86.r = -1;
*(cocos2d::ccColor3B *)&v51 = GJEffectManager::activeColorForIndex(a1->m_effectManager, v50);
v86 = (cocos2d::ccColor3B)v51;
if ( v30->m_groupCount > 0 )
{
v81 = v50;
v87 = v28;
v52 = 0;
do
{
v53 = a1->m_effectManager;
GroupID = GameObject::getGroupID(v30, v52);
*(cocos2d::ccColor3B *)&v51 = GJEffectManager::colorForGroupID(v53, GroupID, &v86, !v30->m_customSpriteColor);
v86 = (cocos2d::ccColor3B)v51;
++v52;
}
while ( v52 < v30->m_groupCount );
v28 = v87;
v50 = v81;
}
m_baseColor = v30->m_baseColor;
if ( m_baseColor->m_hsv.h != *(float *)&qword_10099EF98
|| m_baseColor->m_hsv.s != *((float *)&qword_10099EF98 + 1)
|| m_baseColor->m_hsv.v != *(float *)&qword_10099EFA0
|| *(_WORD *)&m_baseColor->m_hsv.absoluteSaturation != WORD2(qword_10099EFA0) )
{
v86 = GJEffectManager::colorForEffect(a1->m_effectManager, (cocos2d::ccColor3B)v51, m_baseColor->m_hsv);
}
((void (__fastcall *)(EffectGameObject *, cocos2d::ccColor3B *))v30->updateMainColor)(v30, &v86);
v56 = 1.0;
if ( v50 > 0 )
v56 = GJEffectManager::activeOpacityForIndex(a1->m_effectManager, v50);
if ( v30->m_groupCount > 0 )
{
v57 = 0;
do
{
*(float *)&v87 = v56;
v58 = a1->m_effectManager;
v59 = GameObject::getGroupID(v30, v57);
v60 = GJEffectManager::opacityModForGroup(v58, v59);
*(float *)&v87 = *(float *)&v87 * v60;
v56 = *(float *)&v87;
++v57;
}
while ( v57 < v30->m_groupCount );
}
v30->m_baseColor->EnhancedGameObject::GameObject::m_opacity = v56;
if ( !GameObject::hasSecondaryColor(v30) )
{
m_playbackMode = v82;
if ( !v30->m_unk367 )
goto LABEL_70;
LABEL_125:
AnimatedGameObject::updateChildSpriteColor((AnimatedGameObject *)v30, (cocos2d::ccColor3B)v83);
goto LABEL_70;
}
v61 = GameObject::getSecondaryColorMode(v30);
v62 = v61;
v88[0].b = -1;
*(_WORD *)&v88[0].r = -1;
if ( v61 == 1012 )
{
*(_QWORD *)&v89.h = 0x3F26666600000000LL;
*(_QWORD *)&v89.v = 0x1003E19999ALL;
*(cocos2d::ccColor3B *)&v63 = GJEffectManager::colorForEffect(
a1->m_effectManager,
(cocos2d::ccColor3B)((v86.b << 16) | *(unsigned __int16 *)&v86.r),
v89);
v88[0] = (cocos2d::ccColor3B)v63;
}
else
{
if ( v61 <= 0 )
{
v63 = 0xFFFFFF;
if ( v30->m_groupCount <= 0 )
goto LABEL_114;
}
else
{
*(cocos2d::ccColor3B *)&v63 = GJEffectManager::activeColorForIndex(a1->m_effectManager, v61);
v88[0] = (cocos2d::ccColor3B)v63;
if ( v30->m_groupCount <= 0 )
goto LABEL_114;
}
LODWORD(v87) = v62;
v66 = 0;
do
{
v67 = a1->m_effectManager;
v68 = GameObject::getGroupID(v30, v66);
*(cocos2d::ccColor3B *)&v63 = GJEffectManager::colorForGroupID(v67, v68, v88, 0);
v88[0] = (cocos2d::ccColor3B)v63;
++v66;
}
while ( v66 < v30->m_groupCount );
v62 = v87;
}
LABEL_114:
m_detailColor = v30->m_detailColor;
if ( m_detailColor->m_hsv.h != *(float *)&qword_10099EF98
|| m_detailColor->m_hsv.s != *((float *)&qword_10099EF98 + 1)
|| m_detailColor->m_hsv.v != *(float *)&qword_10099EFA0
|| *(_WORD *)&m_detailColor->m_hsv.absoluteSaturation != WORD2(qword_10099EFA0) )
{
v88[0] = GJEffectManager::colorForEffect(a1->m_effectManager, (cocos2d::ccColor3B)v63, m_detailColor->m_hsv);
}
((void (__fastcall *)(EffectGameObject *, cocos2d::ccColor3B *))v30->updateSecondaryColor)(v30, v88);
v70 = 1.0;
if ( v62 > 0 )
v70 = GJEffectManager::activeOpacityForIndex(a1->m_effectManager, v62);
if ( v30->m_groupCount > 0 )
{
v71 = 0;
do
{
*(float *)&v87 = v70;
v72 = a1->m_effectManager;
v73 = GameObject::getGroupID(v30, v71);
v74 = GJEffectManager::opacityModForGroup(v72, v73);
*(float *)&v87 = *(float *)&v87 * v74;
v70 = *(float *)&v87;
++v71;
}
while ( v71 < v30->m_groupCount );
}
v30->m_detailColor->EnhancedGameObject::GameObject::m_opacity = v70;
m_playbackMode = v82;
if ( v30->m_unk367 )
goto LABEL_125;
LABEL_70:
m_previewMode = a1->m_previewMode;
if ( !m_previewMode )
{
v43 = v41 * 0.69999999;
if ( !GameObject::isColorObject(v30) )
v43 = v41;
if ( !a1->m_previewMode )
goto LABEL_79;
LABEL_76:
if ( a1->m_updateColorSprites && v30->m_colorSprite )
((void (__fastcall *)(EffectGameObject *, _QWORD))v30->setOpacity)(v30, 0);
goto LABEL_79;
}
v43 = v41;
if ( m_previewMode )
goto LABEL_76;
LABEL_79:
((void (__fastcall *)(EffectGameObject *, _QWORD))v30->setOpacity)(v30, (unsigned __int8)(int)v43);
if ( a1->m_previewMode || !v30->m_updateEditorColor || v30->m_isSelected )
v30->m_updateEditorColor = 0;
else
GameObject::updateObjectEditorColor(v30);
((void (__fastcall *)(cocos2d::ccColor3B *, EffectGameObject *))v30->getRealPosition)(&v86, v30);
((void (__fastcall *)(EffectGameObject *, cocos2d::ccColor3B *))v30->setPosition)(v30, &v86);
++v28;
}
while ( v28 < a1->m_activeObjectsCount );
}
GJBaseGameLayer::updateEnterEffects(a1, a2);
GJBaseGameLayer::processAreaVisualActions(a1, a2);
GJBaseGameLayer::updateParticles(a1, a2);
a1->m_updateColorSprites = 0;
m_batchNodes = a1->m_batchNodes;
if ( m_batchNodes )
{
data = m_batchNodes->data;
if ( data->num )
{
arr = (cocos2d::CCSpriteBatchNode **)data->arr;
v78 = (unsigned __int64)&arr[data->num - 1];
do
{
if ( !*arr )
break;
cocos2d::CCSpriteBatchNode::manualSortAllChildren(*arr++);
}
while ( (unsigned __int64)arr <= v78 );
}
}
if ( a1->m_playbackMode == Not && (unsigned int)sub_100720070(a1->m_keyframeObjects) )
{
v79 = 0;
do
{
v80 = (KeyframeGameObject *)sub_1007200C0(a1->m_keyframeObjects, v79);
if ( v80->m_keyframeActive )
{
v80->m_keyframeActive = 0;
KeyframeGameObject::updateShadowObjects(v80, a1, a1->m_editorUI);
}
++v79;
}
while ( v79 < (unsigned int)sub_100720070(a1->m_keyframeObjects) );
}
((void (__fastcall *)(LevelEditorLayer *))a1->updateDebugDraw)(a1);
}