//
// PlayLayer::updateVisibility from 0x3156d8 to 0x315e88 (1968 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 PlayLayer::updateVisibility(PlayLayer *a1, float a2)
{
cocos2d::ccColor3B *p_m_lightBGColor; // r7
GJEffectManager *m_effectManager; // r6
int v5; // r0
cocos2d::CCDirector *v6; // r0
const cocos2d::ccColor3B *v7; // r0
int v8; // r0
int v9; // r0
char v10; // r3
char v11; // r9
GJEffectManager *v12; // r0
int v13; // r0
unsigned int *m_finish; // r2
unsigned int *i; // r3
float v16; // s16
cocos2d::CCDirector *v17; // r0
float v18; // s19
__int16 *v19; // r3
__int16 v20; // r2
GLubyte v21; // r3
const cocos2d::ccColor3B *v22; // r1
FMODAudioEngine *v23; // r0
float MeteringValue; // s15
float v25; // s17
DynamicBitset *p_m_keyPulses; // r7
GameObject *v27; // r4
int m_mainColorKeyIndex; // r3
std::vector *p_m_keyColors; // r9
std::vector *p_m_keyOpacities; // r8
cocos2d::_ccColor3B *m_start; // r11
int v32; // r10
const cocos2d::ccColor3B *v33; // r0
float *v34; // r10
float v35; // r0
unsigned int v36; // r1
unsigned int *v37; // r3
int v38; // r6
unsigned int m_detailColorKeyIndex; // r6
int v40; // r6
const cocos2d::ccColor3B *v41; // r0
float *v42; // r6
float v43; // r0
unsigned int v44; // r3
const cocos2d::ccColor3B *v45; // r1
_DWORD *v46; // r6
int m_enterType; // r6
__int16 m_enterChannel; // r3
cocos2d::CCPoint *p_m_cameraPosition2; // r1
_BOOL4 v50; // r9
int v51; // r8
float m_totalTime; // s15
const cocos2d::CCPoint *v53; // r0
GameObject_vtbl *v54; // r3
cocos2d::ccColor3B *v55; // r1
void (__fastcall *setPosition)(GameObject *__hidden, const cocos2d::CCPoint *); // r6
int v57; // r0
float m_fadeMargin; // s14
float v59; // s15
GameObject_vtbl *v60; // r3
void (__fastcall *setOpacity)(GameObject *__hidden, unsigned __int8); // r6
cocos2d::CCPoint v62; // r1
bool v63; // [sp+0h] [bp-6Ch]
bool v64; // [sp+1h] [bp-6Bh]
__int16 v65; // [sp+2h] [bp-6Ah]
bool v66; // [sp+8h] [bp-64h]
int j; // [sp+14h] [bp-58h]
_BOOL4 m_isDead; // [sp+20h] [bp-4Ch]
_BOOL4 isFlipping; // [sp+24h] [bp-48h]
std::_Hashtable, std::__detail::_Identity, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::_Hashtable_traits>::size_type M_element_count; // [sp+28h] [bp-44h]
int v72; // [sp+30h] [bp-3Ch]
cocos2d::_ccColor3B *v73; // [sp+30h] [bp-3Ch]
unsigned int v74; // [sp+30h] [bp-3Ch]
cocos2d::_ccColor3B *v75; // [sp+34h] [bp-38h]
cocos2d::ccColor3B v76; // [sp+38h] [bp-34h]
_BYTE v77[4]; // [sp+3Ch] [bp-30h] BYREF
cocos2d::ccColor3B v78; // [sp+40h] [bp-2Ch] BYREF
cocos2d::ccColor3B v79; // [sp+44h] [bp-28h] BYREF
int v80; // [sp+48h] [bp-24h]
cocos2d::CCSize v81; // [sp+4Ch] [bp-20h] BYREF
cocos2d::CCPoint v82; // [sp+54h] [bp-18h] BYREF
cocos2d::CCPoint v83; // [sp+5Ch] [bp-10h] BYREF
cocos2d::ccHSVValue v84; // 0:kr00_16.16
cocos2d::ccHSVValue v85; // 0:r1.12,12:^0.4
p_m_lightBGColor = &a1->m_lightBGColor;
cameraRight = a1->m_gameState.m_cameraPosition2.x + a1->m_cameraWidth;
GJBaseGameLayer::preUpdateVisibility(a1, a2);
GJEffectManager::processColors(a1->m_effectManager);
m_effectManager = a1->m_effectManager;
*(cocos2d::ccColor3B *)&v5 = GJEffectManager::activeColorForIndex(m_effectManager, 1005);
LOWORD(v80) = v5;
BYTE2(v80) = BYTE2(v5);
GJEffectManager::calculateLightBGColor(m_effectManager, (cocos2d::ccColor3B)v80);
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v81, v6);
v7 = a1->m_background->getColor(a1->m_background);
v84.h = 0.0;
v84.s = -0.3;
v84.v = 0.4;
v84.absoluteSaturation = v63;
v84.absoluteBrightness = v64;
*(_WORD *)v84.__pad = v65;
*(cocos2d::ccColor3B *)&v8 = GameToolbox::transformColor(v7, v84);
*(_WORD *)&v76.r = v8;
v76.b = BYTE2(v8);
*(cocos2d::ccColor3B *)&v9 = GJEffectManager::activeColorForIndex(a1->m_effectManager, 1007);
v10 = BYTE1(v9);
v77[0] = v9;
v11 = BYTE2(v9);
v12 = a1->m_effectManager;
v77[1] = v10;
v77[2] = v11;
*(cocos2d::ccColor3B *)&v13 = GJEffectManager::activeColorForIndex(v12, 1000);
v85.h = 0.0;
*(_QWORD *)&v85.s = 0x3E4CCCCDBE4CCCCDLL;
v78 = (cocos2d::ccColor3B)v13;
*p_m_lightBGColor = GameToolbox::transformColor(&v78, v85);
m_finish = a1->m_keyPulses.m_bits.m_finish;
for ( i = a1->m_keyPulses.m_bits.m_start; i != m_finish; ++i )
*i = 0;
v16 = (float)(v81.width * 0.5) - 75.0;
v17 = cocos2d::CCDirector::sharedDirector();
v18 = (float)(COERCE_FLOAT(cocos2d::CCDirector::getScreenRight(v17)) - (float)(v16 + 110.0)) - 90.0;
if ( (float)(v78.r + v78.g + v78.b) < 150.0 )
v19 = (__int16 *)v77;
else
v19 = &word_9AA0F0;
v20 = *v19;
v21 = *((_BYTE *)v19 + 2);
*(_WORD *)&v79.r = v20;
v79.b = v21;
m_isDead = a1->m_player1->m_isDead;
isFlipping = GJBaseGameLayer::isFlipping(a1);
if ( a1->m_skipAudioStep )
{
v23 = FMODAudioEngine::sharedEngine();
MeteringValue = FMODAudioEngine::getMeteringValue(v23);
}
else
{
MeteringValue = a1->m_audioEffectsLayer->m_audioScale;
}
if ( a1->m_isPracticeMode && !a1->m_practiceMusicSync )
{
v25 = 0.5;
}
else
{
if ( a1->m_isSilent )
MeteringValue = 0.5;
v25 = MeteringValue;
if ( !a1->m_isPracticeMode )
goto LABEL_19;
}
MeteringValue = 0.5;
if ( a1->m_practiceMusicSync )
MeteringValue = v25;
LABEL_19:
p_m_keyPulses = &a1->m_keyPulses;
a1->m_player1->m_audioScale = MeteringValue;
a1->m_player2->m_audioScale = MeteringValue;
M_element_count = a1->m_blendingColors._M_h._M_element_count;
for ( j = 0; j < a1->m_activeObjectsCount; ++j )
{
v27 = a1->m_activeObjects.m_start[j];
m_mainColorKeyIndex = v27->m_mainColorKeyIndex;
if ( m_mainColorKeyIndex <= 0 )
{
GameObject::updateMainColor(a1->m_activeObjects.m_start[j], v22);
GameObject::updateSecondaryColor(v27, v45);
}
else
{
p_m_keyColors = &a1->m_keyColors;
p_m_keyOpacities = &a1->m_keyOpacities;
if ( ((1 << (m_mainColorKeyIndex & 0x1F)) & p_m_keyPulses->m_bits.m_start[(unsigned int)m_mainColorKeyIndex >> 5]) == 0 )
{
m_start = p_m_keyColors->m_start;
v32 = m_mainColorKeyIndex;
v72 = (int)&p_m_keyColors->m_start[m_mainColorKeyIndex];
v33 = GameObject::colorForMode(a1->m_activeObjects.m_start[j], v27->m_activeMainColorID, 1);
*(_WORD *)&m_start[v32].r = *(_WORD *)&v33->r;
*(_BYTE *)(v72 + 2) = v33->b;
v34 = &p_m_keyOpacities->m_start[v27->m_mainColorKeyIndex];
v35 = GameObject::opacityModForMode(v27, v27->m_activeMainColorID, 1);
v36 = v27->m_mainColorKeyIndex;
v37 = p_m_keyPulses->m_bits.m_start;
v38 = (1 << (v36 & 0x1F)) | p_m_keyPulses->m_bits.m_start[v36 >> 5];
*v34 = v35;
v37[v36 >> 5] = v38;
}
v27->updateMainColor(v27, &p_m_keyColors->m_start[v27->m_mainColorKeyIndex]);
v27->m_baseColor->m_opacity = p_m_keyOpacities->m_start[v27->m_mainColorKeyIndex];
if ( GameObject::hasSecondaryColor(v27) )
{
m_detailColorKeyIndex = v27->m_detailColorKeyIndex;
if ( ((1 << (m_detailColorKeyIndex & 0x1F)) & p_m_keyPulses->m_bits.m_start[m_detailColorKeyIndex >> 5]) == 0 )
{
v40 = m_detailColorKeyIndex;
v75 = p_m_keyColors->m_start;
v73 = &p_m_keyColors->m_start[v40];
v41 = GameObject::colorForMode(v27, v27->m_activeDetailColorID, 0);
*(_WORD *)&v75[v40].r = *(_WORD *)&v41->r;
v73->b = v41->b;
v42 = &p_m_keyOpacities->m_start[v27->m_detailColorKeyIndex];
v43 = GameObject::opacityModForMode(v27, v27->m_activeDetailColorID, 0);
v44 = v27->m_detailColorKeyIndex;
*v42 = v43;
p_m_keyPulses->m_bits.m_start[v44 >> 5] |= 1 << (v44 & 0x1F);
}
v27->updateSecondaryColor(v27, &p_m_keyColors->m_start[v27->m_detailColorKeyIndex]);
v27->m_detailColor->m_opacity = p_m_keyOpacities->m_start[v27->m_detailColorKeyIndex];
}
}
if ( v27->m_isActivated && M_element_count )
{
if ( (v46 = sub_30F05C(&a1->m_blendingColors._M_h._M_buckets, v27->m_activeMainColorID),
GameObject::hasSecondaryColor(v27))
&& sub_30F05C(&a1->m_blendingColors._M_h._M_buckets, v27->m_activeDetailColorID)
|| v46 )
{
v27->addMainSpriteToParent(v27, 0);
GameObject::addColorSpriteToParent(v27, 0);
}
}
v27->activateObject(v27);
v27->getRealPosition(&v83, v27);
cocos2d::CCPoint::operator=(&a1->m_enterEffectPosition, &v83);
m_enterType = v27->m_enterType;
m_enterChannel = v27->m_enterChannel;
p_m_cameraPosition2 = (cocos2d::CCPoint *)(m_enterType + 1);
if ( m_enterType == -1
&& (v27->m_exitType != -1
|| (p_m_cameraPosition2 = &a1->m_gameState.m_cameraPosition2,
a1->m_enterEffectPosition.x <= (float)(a1->m_gameState.m_cameraPosition2.x + a1->m_halfCameraWidth))) )
{
m_enterType = v27->m_exitType;
v50 = 0;
v51 = a1->m_gameState.m_exitChannelMap.m_start[m_enterChannel];
}
else
{
v50 = 1;
v51 = a1->m_gameState.m_enterChannelMap.m_start[m_enterChannel];
}
if ( v27->m_isUIObject )
{
m_enterType = -14;
v51 = -14;
}
if ( ((int (__fastcall *)(GameObject *, cocos2d::CCPoint *))v27->getHasSyncedAnimation)(v27, p_m_cameraPosition2) )
{
m_totalTime = a1->m_gameState.m_totalTime;
((void (__fastcall *)(GameObject *, _DWORD, int))v27->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable[1].isEqual)(
v27,
LODWORD(m_totalTime),
-1);
}
if ( ((int (__fastcall *)(GameObject *))v27->getHasRotateAction)(v27) )
EnhancedGameObject::updateRotateAction((EnhancedGameObject *)v27, a2);
if ( v27->m_unk367 )
AnimatedGameObject::updateChildSpriteColor((AnimatedGameObject *)v27, v76);
if ( v27->getType(v27) == Collectible )
{
v53 = a1->m_hoverNode->getPosition(a1->m_hoverNode);
EffectGameObject::updateInteractiveHover((EffectGameObject *)v27, v53->y);
}
if ( v27->m_objectID == 143 )
v27->setGlowColor(v27, &a1->m_lightBGColor);
if ( !v27->m_unk3F8 )
{
if ( v27->m_usesAudioScale && !v27->m_hasNoAudioScale )
{
v54 = v27->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v27->m_customAudioScale )
((void (__fastcall *)(GameObject *, _DWORD))v54->setRScale)(
v27,
v27->m_minAudioScale + (float)((float)(v25 - 0.1) * (float)(v27->m_maxAudioScale - v27->m_minAudioScale)));
else
v54->setRScale(v27, COERCE_FLOAT(LODWORD(v25)));
}
if ( v27->m_customGlowColor )
{
if ( v27->m_glowColorIsLBG )
v55 = (cocos2d::ccColor3B *)v77;
else
v55 = &a1->m_lightBGColor;
v27->setGlowColor(v27, v55);
}
if ( v27->m_isInvisibleBlock )
{
if ( m_isDead )
{
v27->setGlowColor(v27, &a1->m_lightBGColor);
v27->setOpacity(v27, 255u);
GameObject::setGlowOpacity(v27, 0xFFu);
}
else
{
PlayLayer::updateInvisibleBlock(a1, v27, v16 + 110.0, v16, v18, v16 - 30.0, &v79);
}
LABEL_68:
if ( v51 == -15 )
goto LABEL_69;
LABEL_93:
PlayLayer::applyEnterEffect(a1, v27, v51, v50);
}
else
{
if ( GameObject::ignoreFade(v27) || v51 == -14 )
{
v27->setOpacity(v27, 255u);
goto LABEL_68;
}
if ( v27->m_intrinsicDontFade
&& (!v27->m_isSolidColorBlock || !v27->m_baseOrDetailBlending)
&& (unsigned int)(m_enterType + 2) <= 1
&& v51 == -2 )
{
v27->setOpacity(v27, 255u);
goto LABEL_93;
}
if ( v51 != -15 )
{
cocos2d::CCPoint::CCPoint(&v82, &a1->m_enterEffectPosition);
m_fadeMargin = v27->m_fadeMargin;
if ( v50 )
v59 = v82.x - m_fadeMargin;
else
v59 = v82.x + m_fadeMargin;
v60 = v27->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v82.x = v59;
setOpacity = v60->setOpacity;
cocos2d::CCPoint::CCPoint(&v83, &v82);
LODWORD(v62.x) = &v83;
v62.y = 70.0;
v74 = (unsigned int)(float)(PlayLayer::getRelativeModNew(a1, v62, 0.0, 0.0, v50, v66) * 255.0);
setOpacity(v27, v74);
goto LABEL_93;
}
LABEL_69:
if ( GameObject::ignoreEnter(v27) )
goto LABEL_93;
PlayLayer::applyCustomEnterEffect(a1, v27, v50);
}
if ( isFlipping )
{
PlayLayer::screenFlipObject(a1, v27);
}
else if ( a1->m_resetActiveObjects )
{
v27->setFlipX(v27, v27->m_startFlipX);
v27->setFlipY(v27, v27->m_startFlipY);
((void (__fastcall *)(GameObject *, _DWORD))v27->setRotation)(v27, LODWORD(v27->m_startRotationX));
setPosition = v27->setPosition;
v57 = (int)v27->getPosition(v27);
setPosition(v27, (const cocos2d::CCPoint *)v57);
}
continue;
}
}
GJBaseGameLayer::updateEnterEffects(a1, a2);
GJBaseGameLayer::processAreaVisualActions(a1, a2);
GJBaseGameLayer::updateParticles(a1, a2);
a1->m_resetActiveObjects = 0;
std::_Hashtable,std::__detail::_Identity,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::clear((int)&a1->m_blendingColors);
if ( PlayLayer::shouldDebugDraw(a1) )
a1->updateDebugDraw(a1);
}