//
// LevelEditorLayer::updateVisibility from 0x369518 to 0x369c5c (1860 bytes)
//
// 0 xrefs:
//
// 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 LevelEditorLayer::updateVisibility(LevelEditorLayer *a1, float a2)
{
int v4; // r9
GJEffectManager *m_effectManager; // r6
const cocos2d::ccColor3B *v6; // r0
int v7; // r0
GameManager *v8; // r0
EffectGameObject *v9; // r4
void (__fastcall *setPosition)(GameObject *__hidden, const cocos2d::CCPoint *); // r8
unsigned int MainColorMode; // r0
float y; // r1
float v13; // s16
bool *p_m_previewMode; // r6
unsigned int SecondaryColorMode; // r0
_BOOL4 v16; // r6
float m_totalTime; // s15
GJSpriteColor *MainColor; // r0
GJEffectManager *v19; // r11
GJSpriteColor *v20; // r8
int v21; // r0
GJSpriteColor *SecondaryColor; // r0
GJEffectManager *v24; // r11
GJSpriteColor *v25; // r8
int v26; // r0
int v27; // r0
int v28; // r11
int v29; // r0
cocos2d::ccHSVValue *m_baseColor; // r8
int v31; // r0
int v32; // r12
int GroupID; // r0
int v34; // r0
float v35; // s17
int i; // r8
GJEffectManager *v37; // r11
int v38; // r0
int v39; // r0
int v40; // r8
int v41; // r0
int v42; // r0
cocos2d::ccHSVValue *m_detailColor; // r11
int v44; // r0
float v45; // s17
int j; // r8
GJEffectManager *v47; // r11
int v48; // r0
void (__fastcall *v49)(GameObject *__hidden, const cocos2d::CCPoint *); // r8
int v50; // r12
int v51; // r0
int v52; // r0
bool v53; // [sp+0h] [bp-5Ch]
bool v54; // [sp+1h] [bp-5Bh]
__int16 v55; // [sp+2h] [bp-5Ah]
_BOOL4 v56; // [sp+Ch] [bp-50h]
_BOOL4 GameVariable; // [sp+18h] [bp-44h]
int v58; // [sp+20h] [bp-3Ch]
int v59; // [sp+20h] [bp-3Ch]
GJEffectManager *v60; // [sp+24h] [bp-38h]
GJEffectManager *v61; // [sp+24h] [bp-38h]
cocos2d::ccColor3B v62; // [sp+2Ch] [bp-30h]
_DWORD v63[2]; // [sp+34h] [bp-28h] BYREF
_DWORD v64[5]; // [sp+3Ch] [bp-20h] BYREF
unsigned int v65; // [sp+50h] [bp-Ch]
cocos2d::ccColor3B v66; // 0:^30.3
cocos2d::ccHSVValue v67; // 0:kr00_16.16
cocos2d::ccHSVValue v68; // 0:r2.8,8:^0.8
v4 = 0;
LevelEditorLayer::forceShowSelectedObjects(a1, 1);
GJBaseGameLayer::preUpdateVisibility(a1, a2);
LevelEditorLayer::forceShowSelectedObjects(a1, 0);
m_effectManager = a1->m_effectManager;
v56 = a1->m_playbackMode == Playing;
v66 = GJEffectManager::activeColorForIndex(m_effectManager, 1005);
GJEffectManager::calculateLightBGColor(m_effectManager, v66);
v6 = a1->m_background->getColor(a1->m_background);
v67.h = 0.0;
v67.s = -0.3;
v67.v = 0.4;
v67.absoluteSaturation = v53;
v67.absoluteBrightness = v54;
*(_WORD *)v67.__pad = v55;
*(cocos2d::ccColor3B *)&v7 = GameToolbox::transformColor(v6, v67);
*(_WORD *)&v62.r = v7;
v62.b = BYTE2(v7);
v8 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v8, "0121");
while ( v4 < a1->m_activeObjectsCount )
{
v9 = (EffectGameObject *)a1->m_activeObjects.m_start[v4];
if ( a1->m_playbackMode == Not )
{
GameObject::updateStartPos(a1->m_activeObjects.m_start[v4]);
setPosition = v9->setPosition;
v9->getRealPosition((cocos2d::CCPoint *)v64, v9);
setPosition(v9, (const cocos2d::CCPoint *)v64);
}
if ( v9->m_isActivated )
{
if ( a1->m_updateColorSprites || v9->m_updateParents )
{
v16 = 1;
}
else
{
MainColorMode = GameObject::getMainColorMode(v9);
sub_365110(v63, (int)a1->m_blendingColors2.m_start.m_bitptr, MainColorMode);
if ( !std::_Bit_reference::operator bool((int)v63) )
{
if ( !GameObject::hasSecondaryColor(v9) )
goto LABEL_10;
SecondaryColorMode = GameObject::getSecondaryColorMode(v9);
sub_365110(v64, (int)a1->m_blendingColors2.m_start.m_bitptr, SecondaryColorMode);
if ( !std::_Bit_reference::operator bool((int)v64) )
goto LABEL_10;
}
v16 = 0;
}
v9->addMainSpriteToParent(v9, v16);
GameObject::addColorSpriteToParent(v9, v16);
v9->m_updateParents = 0;
}
LABEL_10:
v9->activateObject(v9);
if ( a1->m_previewAnimations && ((int (__fastcall *)(EffectGameObject *))v9->getHasSyncedAnimation)(v9)
|| a1->m_previewParticles
&& v9->m_objectID == 2065
&& ((int (__fastcall *)(EffectGameObject *))v9->getHasSyncedAnimation)(v9) )
{
m_totalTime = a1->m_gameState.m_totalTime;
((void (__fastcall *)(EffectGameObject *, _DWORD, int))v9->updateSyncedAnimation)(v9, LODWORD(m_totalTime), -1);
}
if ( a1->m_previewAnimations && ((int (__fastcall *)(EffectGameObject *))v9->getHasRotateAction)(v9) )
EnhancedGameObject::updateRotateAction(v9, a2);
if ( a1->m_playbackMode == Not
&& ((int (__fastcall *)(EffectGameObject *))v9->getHasSyncedAnimation)(v9)
&& v9->m_animateOnTrigger )
{
EnhancedGameObject::previewAnimateOnTrigger(v9);
}
if ( v9->getType(v9) == Collectible )
{
if ( v56 )
y = a1->m_hoverNode->getPosition(a1->m_hoverNode)->y;
else
y = 0.0;
EffectGameObject::updateInteractiveHover(v9, y);
}
if ( v56 || LevelEditorLayer::validGroup(a1, v9, 0) )
v13 = 255.0;
else
v13 = 50.0;
if ( GameVariable && v9->m_isHide && !v9->m_isSelected )
{
v13 = 0.0;
}
else if ( v9->m_objectID == 3032 && a1->m_playbackMode )
{
v13 = 50.0;
}
p_m_previewMode = &a1->m_previewMode;
if ( !a1->m_previewMode && GameObject::hasSecondaryColor(v9) )
{
v9->m_detailColor->EnhancedGameObject::GameObject::m_opacity = v13 * 0.7;
if ( v9->m_unk367 )
AnimatedGameObject::updateChildSpriteColor((AnimatedGameObject *)v9, (cocos2d::ccColor3B)-1);
}
if ( !*p_m_previewMode || v9->m_isSelected )
{
GameObject::getMainColor(v9)->m_opacity = 1.0;
}
else
{
MainColor = GameObject::getMainColor(v9);
v19 = a1->m_effectManager;
v20 = MainColor;
v21 = GameObject::getMainColorMode(v9);
v20->m_opacity = GJEffectManager::activeOpacityForIndex(v19, v21);
if ( GameObject::hasSecondaryColor(v9) )
{
SecondaryColor = GameObject::getSecondaryColor(v9);
v24 = a1->m_effectManager;
v25 = SecondaryColor;
v26 = GameObject::getSecondaryColorMode(v9);
v25->m_opacity = GJEffectManager::activeOpacityForIndex(v24, v26);
}
v27 = GameObject::getMainColorMode(v9);
LOWORD(v63[0]) = -1;
BYTE2(v63[0]) = -1;
v28 = v27;
*(cocos2d::ccColor3B *)&v29 = GJEffectManager::activeColorForIndex(a1->m_effectManager, v27);
LOWORD(v63[0]) = v29;
BYTE2(v63[0]) = BYTE2(v29);
if ( v9->m_groupCount > 0 )
{
v32 = 0;
while ( v32 < v9->m_groupCount )
{
v58 = v32;
v60 = a1->m_effectManager;
GroupID = GameObject::getGroupID(v9, v32);
*(cocos2d::ccColor3B *)&v34 = GJEffectManager::colorForGroupID(
v60,
GroupID,
(const cocos2d::ccColor3B *)v63,
!v9->m_customSpriteColor);
v32 = v58 + 1;
LOWORD(v63[0]) = v34;
BYTE2(v63[0]) = BYTE2(v34);
}
}
m_baseColor = (cocos2d::ccHSVValue *)v9->m_baseColor;
if ( !sub_365588((int)&m_baseColor[1]) )
{
*(cocos2d::ccColor3B *)&v31 = GJEffectManager::colorForEffect(
a1->m_effectManager,
*(cocos2d::ccColor3B *)v63,
m_baseColor[1]);
LOWORD(v63[0]) = v31;
BYTE2(v63[0]) = BYTE2(v31);
}
v9->updateMainColor(v9, (const cocos2d::ccColor3B *)v63);
if ( v28 <= 0 )
v35 = 1.0;
else
v35 = GJEffectManager::activeOpacityForIndex(a1->m_effectManager, v28);
if ( v9->m_groupCount > 0 )
{
for ( i = 0; i < v9->m_groupCount; ++i )
{
v37 = a1->m_effectManager;
v38 = GameObject::getGroupID(v9, i);
v35 = v35 * GJEffectManager::opacityModForGroup(v37, v38);
}
}
v9->m_baseColor->EnhancedGameObject::GameObject::m_opacity = v35;
if ( GameObject::hasSecondaryColor(v9) )
{
v39 = GameObject::getSecondaryColorMode(v9);
LOWORD(v64[0]) = -1;
BYTE2(v64[0]) = -1;
v40 = v39;
if ( v39 == 1012 )
{
v64[2] = 0;
v64[3] = 1059481190;
v64[4] = 1041865114;
LOWORD(v65) = 256;
*(_QWORD *)&v68.v = __PAIR64__(v65, 1041865114);
*(_QWORD *)&v68.h = 0x3F26666600000000LL;
*(cocos2d::ccColor3B *)&v41 = GJEffectManager::colorForEffect(
a1->m_effectManager,
*(cocos2d::ccColor3B *)v63,
v68);
LOWORD(v64[0]) = v41;
BYTE2(v64[0]) = BYTE2(v41);
}
else
{
if ( v39 > 0 )
{
*(cocos2d::ccColor3B *)&v42 = GJEffectManager::activeColorForIndex(a1->m_effectManager, v39);
LOWORD(v64[0]) = v42;
BYTE2(v64[0]) = BYTE2(v42);
}
if ( v9->m_groupCount > 0 )
{
v50 = 0;
while ( v50 < v9->m_groupCount )
{
v59 = v50;
v61 = a1->m_effectManager;
v51 = GameObject::getGroupID(v9, v50);
*(cocos2d::ccColor3B *)&v52 = GJEffectManager::colorForGroupID(
v61,
v51,
(const cocos2d::ccColor3B *)v64,
0);
v50 = v59 + 1;
LOWORD(v64[0]) = v52;
BYTE2(v64[0]) = BYTE2(v52);
}
}
}
m_detailColor = (cocos2d::ccHSVValue *)v9->m_detailColor;
if ( !sub_365588((int)&m_detailColor[1]) )
{
*(cocos2d::ccColor3B *)&v44 = GJEffectManager::colorForEffect(
a1->m_effectManager,
*(cocos2d::ccColor3B *)v64,
m_detailColor[1]);
LOWORD(v64[0]) = v44;
BYTE2(v64[0]) = BYTE2(v44);
}
v9->updateSecondaryColor(v9, (const cocos2d::ccColor3B *)v64);
if ( v40 <= 0 )
v45 = 1.0;
else
v45 = GJEffectManager::activeOpacityForIndex(a1->m_effectManager, v40);
if ( v9->m_groupCount > 0 )
{
for ( j = 0; j < v9->m_groupCount; ++j )
{
v47 = a1->m_effectManager;
v48 = GameObject::getGroupID(v9, j);
v45 = v45 * GJEffectManager::opacityModForGroup(v47, v48);
}
}
v9->m_detailColor->EnhancedGameObject::GameObject::m_opacity = v45;
}
if ( v9->m_unk367 )
AnimatedGameObject::updateChildSpriteColor((AnimatedGameObject *)v9, v62);
}
if ( !*p_m_previewMode && GameObject::isColorObject(v9) )
v13 = v13 * 0.7;
if ( *p_m_previewMode && a1->m_updateColorSprites && v9->m_colorSprite )
v9->setOpacity(v9, 0);
v9->setOpacity(v9, (unsigned int)v13);
if ( *p_m_previewMode || !v9->m_updateEditorColor || v9->m_isSelected )
v9->m_updateEditorColor = 0;
else
GameObject::updateObjectEditorColor(v9);
++v4;
v49 = v9->setPosition;
v9->getRealPosition((cocos2d::CCPoint *)v64, v9);
v49(v9, (const cocos2d::CCPoint *)v64);
}
GJBaseGameLayer::updateEnterEffects(a1, a2);
GJBaseGameLayer::processAreaVisualActions(a1, a2);
GJBaseGameLayer::updateParticles(a1, a2);
a1->m_updateColorSprites = 0;
LevelEditorLayer::sortBatchnodeChildren(a1, 0.0);
LevelEditorLayer::updateKeyframeObjects(a1);
a1->updateDebugDraw(a1);
}