//
// PlayLayer::updateVisibility from 0x10011c45c to 0x10011cde8 (2444 bytes)
//
// 1 xrefs:
// > ??> @ 0x10078fd20
//
// 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 PlayLayer::updateVisibility(PlayLayer *a1, float a2)
{
int *p_m_activeGradients; // x21
GJEffectManager *m_effectManager; // x20
cocos2d::CCDirector *v6; // x0
const cocos2d::ccColor3B *v7; // x0
unsigned __int64 v8; // x0
unsigned __int64 v9; // x22
float v10; // s10
cocos2d::CCDirector *v11; // x0
float v12; // s12
cocos2d::ccColor3B *v13; // x8
__n128 v14; // q0
FMODAudioEngine *v15; // x0
float MeteringValue; // s9
float v17; // s0
__int64 v18; // x28
float v19; // s10
float v20; // s12
unsigned __int64 value; // x27
AnimatedGameObject *v22; // x23
unsigned __int64 m_mainColorKeyIndex; // x8
const cocos2d::ccColor3B *v24; // x0
cocos2d::_ccColor3B *v25; // x8
__int16 v26; // w9
unsigned __int64 m_detailColorKeyIndex; // x8
const cocos2d::ccColor3B *v28; // x0
cocos2d::_ccColor3B *v29; // x8
__int16 v30; // w9
float v31; // s0
__int64 *v33; // x24
_BOOL4 v34; // w8
__n128 v35; // q0
unsigned int m_enterType; // w21
_BOOL4 v37; // w24
std::vector *p_m_exitChannelMap; // x9
bool m_isUIObject; // w26
int v40; // w25
float m_totalTime; // s0
__int64 v42; // x0
cocos2d::ccColor3B *p_m_lightBGColor; // x1
float m_fadeMargin; // s0
float v45; // s0
__int64 v46; // x1
__int64 v47; // x0
_BOOL4 m_isDead; // [xsp+4h] [xbp-ECh]
int *v49; // [xsp+8h] [xbp-E8h]
__int64 v50; // [xsp+18h] [xbp-D8h]
_BOOL4 isFlipping; // [xsp+24h] [xbp-CCh]
__int64 v52; // [xsp+34h] [xbp-BCh] BYREF
__int64 v53; // [xsp+3Ch] [xbp-B4h] BYREF
cocos2d::ccColor3B v54; // [xsp+44h] [xbp-ACh] BYREF
cocos2d::ccColor3B v55; // [xsp+48h] [xbp-A8h] BYREF
cocos2d::ccColor3B v56; // [xsp+4Ch] [xbp-A4h] BYREF
float v57; // [xsp+50h] [xbp-A0h]
cocos2d::ccColor3B v58; // 0:w0.3
cocos2d::CCSize WinSize; // 0:kr00_8.8
p_m_activeGradients = &a1->m_activeGradients;
*(float *)&dword_100885CF4 = a1->m_gameState.m_cameraPosition2.x + a1->m_cameraWidth;
GJBaseGameLayer::preUpdateVisibility(a1, a2);
GJEffectManager::processColors(a1->m_effectManager);
m_effectManager = a1->m_effectManager;
v58 = GJEffectManager::activeColorForIndex(m_effectManager, 1005);
GJEffectManager::calculateLightBGColor(m_effectManager, (cocos2d::ccColor3B)(*(_DWORD *)&v58.r & 0xFFFFFF));
v6 = cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize(v6);
v7 = (const cocos2d::ccColor3B *)((__int64 (__fastcall *)(cocos2d::CCSprite *, float, float))a1->m_background->getColor)(
a1->m_background,
WinSize.width,
WinSize.height);
*(cocos2d::ccColor3B *)&v8 = GameToolbox::transformColor(v7, 0.0, -0.3, 0.4);
v9 = v8;
v56 = GJEffectManager::activeColorForIndex(a1->m_effectManager, 1007);
v55 = GJEffectManager::activeColorForIndex(a1->m_effectManager, 1000);
a1->m_lightBGColor = GameToolbox::transformColor(&v55, 0.0, -0.2, 0.2);
sub_10011CDE8(&a1->m_keyPulses);
v10 = v57;
v11 = cocos2d::CCDirector::sharedDirector();
v12 = sub_1001768E0(v11);
v13 = &v56;
if ( v55.g + v55.r + (unsigned int)v55.b >= 0x96 )
v13 = (cocos2d::ccColor3B *)&unk_100636FE0;
v54 = *v13;
m_isDead = a1->m_player1->m_isDead;
isFlipping = GJBaseGameLayer::isFlipping(a1);
if ( *((_BYTE *)p_m_activeGradients + 1832) == 1 )
{
v15 = FMODAudioEngine::sharedEngine();
MeteringValue = FMODAudioEngine::getMeteringValue(v15);
}
else
{
MeteringValue = a1->m_audioEffectsLayer->m_audioScale;
}
if ( *((_BYTE *)p_m_activeGradients + 128) == 1 && *((_BYTE *)p_m_activeGradients + 129) != 1
|| *((_BYTE *)p_m_activeGradients + 1712) == 1 )
{
MeteringValue = 0.5;
}
if ( !*((_BYTE *)p_m_activeGradients + 128) || (v17 = 0.5, *((_BYTE *)p_m_activeGradients + 129) == 1) )
v17 = MeteringValue;
v49 = p_m_activeGradients;
a1->m_player1->m_audioScale = v17;
a1->m_player2->m_audioScale = v17;
if ( a1->m_activeObjectsCount >= 1 )
{
v18 = 0;
v19 = (float)(v10 * 0.5) + -75.0;
v20 = (float)(v12 - (float)(v19 + 110.0)) + -90.0;
value = a1->m_blendingColors.__table_.__p2_.__value_;
v50 = v9 & 0xFFFFFF;
v14.n128_u32[0] = -1110651699;
do
{
v22 = (AnimatedGameObject *)a1->m_activeObjects.__begin_[v18];
m_mainColorKeyIndex = (unsigned int)v22->m_mainColorKeyIndex;
if ( (int)m_mainColorKeyIndex < 1 )
{
GameObject::updateMainColor(a1->m_activeObjects.__begin_[v18]);
GameObject::updateSecondaryColor(v22);
}
else
{
if ( ((*(_QWORD *)((char *)a1->m_keyPulses.m_bits.__begin_ + ((m_mainColorKeyIndex >> 2) & 0x3FFFFFF8)) >> (m_mainColorKeyIndex & 0x1F))
& 1) == 0 )
{
v24 = GameObject::colorForMode(a1->m_activeObjects.__begin_[v18], v22->m_activeMainColorID, 1);
v25 = &a1->m_keyColors.__begin_[v22->m_mainColorKeyIndex];
v26 = *(_WORD *)&v24->r;
v25->b = v24->b;
*(_WORD *)&v25->r = v26;
v14.n128_f32[0] = GameObject::opacityModForMode(v22, v22->m_activeMainColorID, 1);
m_mainColorKeyIndex = v22->m_mainColorKeyIndex;
LODWORD(a1->m_keyOpacities.__begin_[m_mainColorKeyIndex]) = v14.n128_u32[0];
*(_QWORD *)((char *)a1->m_keyPulses.m_bits.__begin_ + ((m_mainColorKeyIndex >> 2) & 0x3FFFFFFFFFFFFFF8LL)) |= 1LL << (m_mainColorKeyIndex & 0x1F);
}
((void (__fastcall *)(AnimatedGameObject *, cocos2d::_ccColor3B *, __n128))v22->updateMainColor)(
v22,
&a1->m_keyColors.__begin_[m_mainColorKeyIndex],
v14);
v22->m_baseColor->m_opacity = a1->m_keyOpacities.__begin_[v22->m_mainColorKeyIndex];
if ( GameObject::hasSecondaryColor(v22) )
{
m_detailColorKeyIndex = v22->m_detailColorKeyIndex;
if ( ((*(_QWORD *)((char *)a1->m_keyPulses.m_bits.__begin_
+ ((m_detailColorKeyIndex >> 2) & 0x3FFFFFFFFFFFFFF8LL)) >> (m_detailColorKeyIndex & 0x1F))
& 1) == 0 )
{
v28 = GameObject::colorForMode(v22, v22->m_activeDetailColorID, 0);
v29 = &a1->m_keyColors.__begin_[v22->m_detailColorKeyIndex];
v30 = *(_WORD *)&v28->r;
v29->b = v28->b;
*(_WORD *)&v29->r = v30;
v31 = GameObject::opacityModForMode(v22, v22->m_activeDetailColorID, 0);
m_detailColorKeyIndex = v22->m_detailColorKeyIndex;
a1->m_keyOpacities.__begin_[m_detailColorKeyIndex] = v31;
*(_QWORD *)((char *)a1->m_keyPulses.m_bits.__begin_ + ((m_detailColorKeyIndex >> 2) & 0x3FFFFFFFFFFFFFF8LL)) |= 1LL << (m_detailColorKeyIndex & 0x1F);
}
((void (__fastcall *)(AnimatedGameObject *, cocos2d::_ccColor3B *))v22->updateSecondaryColor)(
v22,
&a1->m_keyColors.__begin_[m_detailColorKeyIndex]);
v22->m_detailColor->m_opacity = a1->m_keyOpacities.__begin_[v22->m_detailColorKeyIndex];
}
}
if ( v22->m_isActivated && value != 0 )
{
LODWORD(v53) = v22->m_activeMainColorID;
v33 = sub_100018814(&a1->m_blendingColors.__table_.__bucket_list_.__ptr_.__value_, (int *)&v53);
if ( GameObject::hasSecondaryColor(v22) )
{
LODWORD(v53) = v22->m_activeDetailColorID;
v34 = sub_100018814(&a1->m_blendingColors.__table_.__bucket_list_.__ptr_.__value_, (int *)&v53) != nullptr;
if ( v33 )
goto LABEL_32;
}
else
{
v34 = 0;
if ( v33 )
goto LABEL_32;
}
if ( v34 )
{
LABEL_32:
((void (__fastcall *)(AnimatedGameObject *, _QWORD))v22->addMainSpriteToParent)(v22, 0);
GameObject::addColorSpriteToParent(v22, 0);
}
}
((void (__fastcall *)(AnimatedGameObject *))v22->activateObject)(v22);
((void (__fastcall *)(__int64 *__return_ptr, AnimatedGameObject *))v22->getRealPosition)(&v53, v22);
v35.n128_f64[0] = sub_1000229D0(&a1->m_enterEffectPosition, (double *)&v53);
m_enterType = (unsigned __int16)v22->m_enterType;
if ( m_enterType == 0xFFFF
&& ((unsigned __int16)v22->m_exitType != 0xFFFF
|| (v35.n128_u32[0] = LODWORD(a1->m_enterEffectPosition.x),
v35.n128_f32[0] <= (float)(a1->m_gameState.m_cameraPosition2.x + a1->m_halfCameraWidth))) )
{
v37 = 0;
p_m_exitChannelMap = &a1->m_gameState.m_exitChannelMap;
m_enterType = (unsigned __int16)v22->m_exitType;
}
else
{
v37 = 1;
p_m_exitChannelMap = &a1->m_gameState.m_enterChannelMap;
}
m_isUIObject = v22->m_isUIObject;
if ( m_isUIObject )
v40 = -14;
else
v40 = p_m_exitChannelMap->__begin_[v22->m_enterChannel];
if ( ((unsigned int (__fastcall *)(AnimatedGameObject *, __n128))v22->getHasSyncedAnimation)(v22, v35) )
{
m_totalTime = a1->m_gameState.m_totalTime;
((void (__fastcall *)(AnimatedGameObject *, __int64, float))v22->updateSyncedAnimation)(
v22,
0xFFFFFFFFLL,
m_totalTime);
}
if ( ((unsigned int (__fastcall *)(AnimatedGameObject *))v22->getHasRotateAction)(v22) )
EnhancedGameObject::updateRotateAction(v22, a2);
if ( v22->m_unk367 )
{
v9 = v9 & 0xFFFFFFFFFF000000LL | v50;
AnimatedGameObject::updateChildSpriteColor(v22, (cocos2d::ccColor3B)v9);
}
if ( ((unsigned int (__fastcall *)(AnimatedGameObject *))v22->getType)(v22) == 30 )
{
v42 = ((__int64 (__fastcall *)(cocos2d::CCNode *))a1->m_hoverNode->getPosition)(a1->m_hoverNode);
EffectGameObject::updateInteractiveHover((EffectGameObject *)v22, *(float *)(v42 + 4));
}
if ( v22->m_objectID == 143 )
((void (__fastcall *)(AnimatedGameObject *, cocos2d::ccColor3B *))v22->setGlowColor)(v22, &a1->m_lightBGColor);
if ( v22->m_unk3F8 )
goto LABEL_90;
if ( v22->m_usesAudioScale && !v22->m_hasNoAudioScale )
{
v14.n128_f32[0] = MeteringValue;
if ( v22->m_customAudioScale )
v14.n128_f32[0] = v22->m_minAudioScale
+ (float)((float)(MeteringValue + -0.1) * (float)(v22->m_maxAudioScale - v22->m_minAudioScale));
((void (__fastcall *)(AnimatedGameObject *, __n128))v22->setRScale)(v22, v14);
}
if ( v22->m_customGlowColor )
{
if ( v22->m_glowColorIsLBG )
p_m_lightBGColor = &v56;
else
p_m_lightBGColor = &a1->m_lightBGColor;
((void (__fastcall *)(AnimatedGameObject *, cocos2d::ccColor3B *))v22->setGlowColor)(v22, p_m_lightBGColor);
}
if ( v22->m_isInvisibleBlock )
{
if ( m_isDead )
{
((void (__fastcall *)(AnimatedGameObject *, cocos2d::ccColor3B *))v22->setGlowColor)(v22, &a1->m_lightBGColor);
((void (__fastcall *)(AnimatedGameObject *, __int64))v22->setOpacity)(v22, 255);
GameObject::setGlowOpacity(v22, 0xFFu);
}
else
{
PlayLayer::updateInvisibleBlock(a1, v22, v19 + 110.0, v19, v20, v19 + -30.0, &v54);
}
LABEL_76:
if ( v40 != -15 )
goto LABEL_85;
goto LABEL_79;
}
if ( GameObject::ignoreFade(v22) || v40 == -14 )
{
((void (__fastcall *)(AnimatedGameObject *, __int64))v22->setOpacity)(v22, 255);
goto LABEL_76;
}
if ( v22->m_intrinsicDontFade
&& (!v22->m_isSolidColorBlock || !v22->m_baseOrDetailBlending)
&& m_enterType >= 0xFFFE
&& !m_isUIObject
&& v40 == -2 )
{
((void (__fastcall *)(AnimatedGameObject *, __int64))v22->setOpacity)(v22, 255);
goto LABEL_85;
}
if ( v40 != -15 )
{
sub_1000229B8(&v53, (__int64 *)&a1->m_enterEffectPosition);
m_fadeMargin = v22->m_fadeMargin;
if ( v37 )
{
*(float *)&v53 = *(float *)&v53 - m_fadeMargin;
sub_1000229B8(&v52, &v53);
v45 = (float)((float)(a1->m_gameState.m_cameraPosition2.x + a1->m_cameraWidth) - *(float *)&v52) + 0.0;
}
else
{
*(float *)&v53 = m_fadeMargin + *(float *)&v53;
sub_1000229B8(&v52, &v53);
v45 = *(float *)&v52 - a1->m_gameState.m_cameraPosition2.x;
}
v46 = (unsigned int)(int)(float)(cocos2d::clampf(v45 / 70.0, 0.0, 1.0) * 255.0);
((void (__fastcall *)(AnimatedGameObject *, __int64))v22->setOpacity)(v22, v46);
goto LABEL_85;
}
LABEL_79:
if ( !GameObject::ignoreEnter(v22) )
{
PlayLayer::applyCustomEnterEffect(a1, v22, v37);
goto LABEL_86;
}
LABEL_85:
PlayLayer::applyEnterEffect(a1, v22, v40, v37);
LABEL_86:
if ( isFlipping )
{
PlayLayer::screenFlipObject(a1, v22);
}
else if ( *((_BYTE *)v49 + 180) == 1 )
{
((void (__fastcall *)(AnimatedGameObject *, bool))v22->setFlipX)(v22, v22->m_startFlipX);
((void (__fastcall *)(AnimatedGameObject *, bool))v22->setFlipY)(v22, v22->m_startFlipY);
((void (__fastcall *)(AnimatedGameObject *, float))v22->setRotation)(v22, v22->m_startRotationX);
v47 = ((__int64 (__fastcall *)(AnimatedGameObject *))v22->getPosition)(v22);
((void (__fastcall *)(AnimatedGameObject *, __int64))v22->setPosition)(v22, v47);
}
LABEL_90:
++v18;
}
while ( v18 < a1->m_activeObjectsCount );
}
GJBaseGameLayer::updateEnterEffects(a1, a2);
GJBaseGameLayer::processAreaVisualActions(a1, a2);
GJBaseGameLayer::updateParticles(a1, a2);
*((_BYTE *)v49 + 180) = 0;
sub_100018054(&a1->m_blendingColors.__table_.__bucket_list_.__ptr_.__value_);
if ( *((_BYTE *)v49 + 1408) == 1 && (v49[32] & 1) != 0
|| *((_BYTE *)v49 + 1410) == 1 && (*((_BYTE *)v49 + 218) & 1) != 0 )
{
((void (__fastcall *)(PlayLayer *))a1->updateDebugDraw)(a1);
}
}