//
// GJBaseGameLayer::preUpdateVisibility from 0x881a60 to 0x882e38 (5080 bytes)
//
// 3 xrefs:
// > PlayLayer::updateVisibility @ 0x5ce100
// > LevelEditorLayer::updateVisibility @ 0x662c8c
// > ??> @ 0xb7078
//
// 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 GJBaseGameLayer::preUpdateVisibility(GJBaseGameLayer *a1, float a2)
{
cocos2d::CCDirector *v3; // x0
unsigned __int64 v4; // x0
__int64 *v5; // x2
float m_cameraZoom; // s12
float v7; // s1
float v8; // s5
float x; // s0
float v10; // s3
float v11; // s4
float y; // s1
OBB2D *m_cameraObb2; // x21
float v14; // s4
OBB2D *v15; // x21
float v16; // s4
GJGroundLayer *m_groundLayer; // x21
float v18; // s1
int v19; // w0
float m_cameraAngle; // s2
float v21; // s0
int v22; // w1
GJGroundLayer_vtbl *v23; // x2
GJGroundLayer *m_groundLayer2; // x3
float (__fastcall *getScaleX)(cocos2d::CCNode *__hidden); // x2
float v26; // s0
float v27; // s0
GJGroundLayer *v28; // x21
float v29; // s0
float v30; // s0
float v31; // s8
float v32; // s0
float v33; // s9
float v34; // s0
float v35; // s10
float v36; // s0
float v37; // s11
float v38; // s0
float m_sectionXFactor; // s1
float v40; // s0
float v41; // s0
float v42; // s0
float v43; // s0
float m_sectionYFactor; // s1
float v45; // s0
float v46; // s0
float v47; // s0
int v48; // w0
cocos2d::CCDirector *v49; // x0
std::vector *, std::allocator *>> **m_start; // x21
int m_leftSectionIndex; // w20
int m_rightSectionIndex; // w22
int m_bottomSectionIndex; // w10
__int64 v54; // x11
int m_topSectionIndex; // w12
std::vector *, std::allocator *>> *v56; // x5
unsigned __int64 v57; // x7
__int64 v58; // x8
int v59; // w6
std::vector **v60; // x5
int v61; // w2
GameObject **v62; // x4
__int64 v63; // x0
GameObject *v64; // x1
int m_visibleObjects2Count; // w1
GameObject **v66; // x3
__int64 v67; // x0
GameObject *v68; // x4
bool v69; // w1
std::vector *, std::allocator *>> *v70; // x20
int v71; // w24
std::vector *v72; // x23
int v73; // w0
unsigned __int64 v74; // x21
__int64 v75; // x22
GameObject *v76; // x20
cocos2d::CCRect *v77; // x26
float v78; // s0
int v79; // w1
int v80; // w0
GameObject **v81; // x2
int v82; // w1
float v83; // s0
float v84; // s0
float v85; // s0
unsigned __int64 v86; // x21
__int64 v87; // x22
std::vector *p_m_activeObjects; // x26
int m_activeObjectsIndex; // w2
int m_activeObjectsCount; // w0
GameObject **m_finish; // x1
int m_unk35C; // w1
GameObject *v93; // x20
cocos2d::CCRect *v94; // x27
float v95; // s0
int v96; // w1
int v97; // w0
GameObject **v98; // x2
int v99; // w1
float v100; // s0
float v101; // s0
float v102; // s0
int v103; // w0
cocos2d::CCArray *m_uiObjects; // x0
cocos2d::ccArray *data; // x1
GameObject **arr; // x22
__int64 v107; // x0
char *v108; // x21
GameObject *v109; // x20
__int64 *v110; // x26
char *v111; // x0
GameObject **v112; // x22
GameObject **v113; // x21
GameObject *v114; // x20
int v115; // w0
int v116; // w1
GameObject **v117; // x2
int m_visibleObjectsIndex; // w2
int m_visibleObjectsCount; // w0
GameObject **v120; // x1
int v121; // w1
__int64 v122; // x20
int j; // w21
GameObject *v124; // x0
int v125; // w3
__int64 v126; // x21
int v127; // w1
int v128; // w22
GameObject **v129; // x0
int m_visibleObjects2Index; // w2
GameObject *v131; // x4
int v132; // w27
int v133; // w22
__int64 v134; // x26
std::vector *, std::allocator *>> *v135; // x20
int v136; // w23
int v137; // w21
__int64 v138; // x25
__int64 v139; // x24
std::vector *v140; // x22
int v141; // w0
unsigned __int64 v142; // x20
__int64 v143; // x21
cocos2d::CCRect *v144; // x24
float v145; // s8
float v146; // s0
int v147; // w2
int v148; // w1
GameObject **v149; // x0
int v150; // w0
float v151; // s0
float v152; // s8
float v153; // s0
float v154; // s0
cocos2d::CCArray *v155; // x0
cocos2d::ccArray *v156; // x1
char *v157; // x21
__int64 v158; // x0
char *k; // x20
cocos2d::CCDictionary *m_objectsToDeactivate; // x0
cocos2d::CCDictElement *m_pElements; // x1
cocos2d::CCObject *m_pObject; // x0
_QWORD *next; // x20
int m_nLuaID; // w1
int m_nTag; // w1
_QWORD *v166; // x1
cocos2d::CCArray *m_batchNodes; // x0
cocos2d::ccArray *v168; // x1
cocos2d::CCNode **v169; // x21
__int64 v170; // x0
char *v171; // x20
cocos2d::CCParticleSystemQuad *m_glitterParticles; // x20
void (__fastcall *setPosVar)(cocos2d::CCParticleSystem *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCDirector *v174; // x0
float v175; // s0
float v176; // s8
cocos2d::CCDirector *v177; // x0
float v178; // s0
float m_cameraHeightOffset; // s1
float v180; // s2
float v181; // s3
float v182; // s1
_BOOL4 m_cameraRotated; // w0
const cocos2d::CCPoint *v184; // x0
float v185; // s0
float v186; // s1
float v187; // s0
float v188; // s1
__int64 v189; // [xsp+C0h] [xbp+C0h]
int v190; // [xsp+C8h] [xbp+C8h]
int v191; // [xsp+D0h] [xbp+D0h]
int v192; // [xsp+D4h] [xbp+D4h]
int v193; // [xsp+E8h] [xbp+E8h]
_BOOL4 v194; // [xsp+100h] [xbp+100h]
int v195; // [xsp+104h] [xbp+104h]
__int64 v196; // [xsp+108h] [xbp+108h]
unsigned __int64 i; // [xsp+110h] [xbp+110h]
__int64 v198; // [xsp+128h] [xbp+128h]
__int64 v199; // [xsp+130h] [xbp+130h]
unsigned __int64 v200; // [xsp+130h] [xbp+130h]
cocos2d::ccColor3B v201; // [xsp+148h] [xbp+148h] BYREF
float v202; // [xsp+150h] [xbp+150h]
float v203; // [xsp+154h] [xbp+154h]
cocos2d::CCPoint v204[3]; // [xsp+158h] [xbp+158h] BYREF
_QWORD *v205; // [xsp+170h] [xbp+170h] BYREF
_QWORD *v206; // [xsp+178h] [xbp+178h] BYREF
GameObject *v207; // [xsp+180h] [xbp+180h] BYREF
GameObject *v208; // [xsp+188h] [xbp+188h] BYREF
GameObject *v209; // [xsp+190h] [xbp+190h] BYREF
GameObject *v210; // [xsp+198h] [xbp+198h] BYREF
GameObject *v211; // [xsp+1A0h] [xbp+1A0h] BYREF
GameObject *v212; // [xsp+1A8h] [xbp+1A8h] BYREF
cocos2d::CCRect v213; // [xsp+1B0h] [xbp+1B0h] BYREF
GameObject *v214; // [xsp+1C0h] [xbp+1C0h] BYREF
float v215; // [xsp+1C8h] [xbp+1C8h]
float v216; // [xsp+1CCh] [xbp+1CCh]
_QWORD v217[2]; // [xsp+1D0h] [xbp+1D0h] BYREF
__int64 *v218; // [xsp+1E0h] [xbp+1E0h]
__int64 v219; // [xsp+1E8h] [xbp+1E8h]
float v220; // [xsp+1F0h] [xbp+1F0h] BYREF
__int64 v221; // [xsp+1F8h] [xbp+1F8h]
__int64 v222; // [xsp+200h] [xbp+200h] BYREF
cocos2d::ccHSVValue v223; // 0:x1.16
v3 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v3);
v218 = nullptr;
v219 = 0;
v220 = 1.0;
v221 = 0;
v4 = sub_D146DC(&v220, 10);
v217[1] = v4;
if ( v4 == 1 )
{
v222 = 0;
v5 = &v222;
}
else
{
v5 = (__int64 *)sub_8563A4(v4);
}
v217[0] = v5;
cocos2d::CCPoint::CCPoint(v204, &a1->m_gameState.m_cameraPosition2);
m_cameraZoom = a1->m_gameState.m_cameraZoom;
if ( a1->m_isEditor && !a1->m_started )
{
m_cameraZoom = a1->m_objectLayer->getScale(a1->m_objectLayer);
v184 = a1->m_objectLayer->getPosition(a1->m_objectLayer);
cocos2d::CCPoint::operator-(&v213, v184);
cocos2d::CCPoint::operator*(&v213, 1.0 / m_cameraZoom);
cocos2d::CCPoint::operator=(v204, v185, v186);
if ( a1->m_gameState.m_cameraShakeEnabled )
{
cocos2d::CCPoint::operator-(&v214, v204, &a1->m_gameState.m_unkPoint34);
cocos2d::CCPoint::operator=(v204, v187, v188);
}
}
v7 = v202;
a1->m_activeObjectsCount = 0;
v8 = v7 / m_cameraZoom;
x = v204[0].x;
v10 = a1->m_gameState.m_cameraPosition2.x + (float)(v7 * 0.5);
v11 = v203 / m_cameraZoom;
y = v204[0].y;
a1->m_cameraUnzoomedX = v10;
a1->m_cameraWidth = v8;
a1->m_halfCameraWidth = v8 * 0.5;
a1->m_cameraHeight = v11;
cocos2d::CCRect::CCRect(&v213, x, y, v8, v11);
if ( a1->m_gameState.m_cameraAngle == 0.0 )
{
m_groundLayer = a1->m_groundLayer;
LOBYTE(v22) = 0;
a1->m_cameraWidthOffset = 0.0;
a1->m_cameraHeightOffset = 0.0;
m_cameraRotated = m_groundLayer->m_cameraRotated;
a1->m_cameraUnzoomedHeightOffset = 0.0;
a1->m_targetCameraHeightOffset = 0.0;
if ( !m_cameraRotated )
goto LABEL_12;
goto LABEL_9;
}
if ( a1->m_calculateTargetHeightOffset )
{
m_cameraObb2 = a1->m_cameraObb2;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v214, v202 * 0.5, v203 * 0.5);
OBB2D::calculateWithCenter(
m_cameraObb2,
(cocos2d::CCPoint)v213.size,
a1->m_gameState.m_targetCameraAngle * 0.017453,
a1->m_gameState.m_targetCameraAngle,
v14);
OBB2D::getBoundingRect(a1->m_cameraObb2);
a1->m_targetCameraHeightOffset = v216 - v213.size.height;
a1->m_calculateTargetHeightOffset = 0;
}
v15 = a1->m_cameraObb2;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v214, v202 * 0.5, v203 * 0.5);
OBB2D::calculateWithCenter(
v15,
(cocos2d::CCPoint)v213.size,
a1->m_gameState.m_cameraAngle * 0.017453,
a1->m_gameState.m_cameraAngle,
v16);
OBB2D::getBoundingRect(a1->m_cameraObb2);
m_groundLayer = a1->m_groundLayer;
v18 = v216 - v213.size.height;
v19 = m_groundLayer->m_cameraRotated;
m_cameraAngle = a1->m_gameState.m_cameraAngle;
v21 = (float)(v215 - v213.size.width) * m_cameraZoom;
a1->m_cameraUnzoomedHeightOffset = v216 - v213.size.height;
a1->m_cameraHeightOffset = m_cameraZoom * v18;
v22 = m_cameraAngle != 0.0;
a1->m_cameraWidthOffset = v21;
if ( v19 != v22 )
{
LABEL_9:
v23 = m_groundLayer->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
m_groundLayer2 = a1->m_groundLayer2;
m_groundLayer->m_cameraRotated = v22;
getScaleX = v23->getScaleX;
m_groundLayer2->m_cameraRotated = v22;
v26 = getScaleX(m_groundLayer);
v27 = GJGroundLayer::scaleGround(m_groundLayer, v26);
v28 = a1->m_groundLayer2;
v29 = ((float (__fastcall *)(GJGroundLayer *, float))v28->getScaleX)(v28, v27);
GJGroundLayer::scaleGround(v28, v29);
m_cameraAngle = a1->m_gameState.m_cameraAngle;
}
if ( m_cameraAngle != 0.0 && a1->m_cameraWidthOffset != 0.0 )
{
GJBaseGameLayer::updateGroundShadows(a1);
m_cameraHeightOffset = a1->m_cameraHeightOffset;
v180 = a1->m_cameraWidthOffset / m_cameraZoom;
v181 = v213.origin.y;
a1->m_updateGroundShadows = 1;
v182 = m_cameraHeightOffset / m_cameraZoom;
v213.size.width = v213.size.width + v180;
v213.origin.x = v213.origin.x - (float)(v180 * 0.5);
v213.size.height = v213.size.height + v182;
v213.origin.y = v181 - (float)(v182 * 0.5);
goto LABEL_14;
}
LABEL_12:
if ( a1->m_updateGroundShadows )
{
GJGroundLayer::updateShadowXPos(a1->m_groundLayer, 0.0, 0.0);
GJGroundLayer::updateShadows(a1->m_groundLayer);
GJGroundLayer::updateShadowXPos(a1->m_groundLayer2, 0.0, 0.0);
GJGroundLayer::updateShadows(a1->m_groundLayer2);
a1->m_updateGroundShadows = 0;
}
LABEL_14:
cocos2d::CCRect::getMaxX(&v213);
v31 = v30;
cocos2d::CCRect::getMinX(&v213);
v33 = v32;
cocos2d::CCRect::getMaxY(&v213);
v35 = v34;
cocos2d::CCRect::getMinY(&v213);
v37 = v36;
v38 = 10000000.0;
if ( v33 <= 10000000.0 )
v38 = v33;
m_sectionXFactor = a1->m_sectionXFactor;
if ( (float)(floorf(v38 * m_sectionXFactor) - 1.0) <= 0.0 )
{
v191 = 0;
}
else
{
v40 = 10000000.0;
if ( v33 <= 10000000.0 )
v40 = v33;
v191 = (int)(float)(floorf(v40 * m_sectionXFactor) - 1.0);
}
v41 = 10000000.0;
if ( v31 <= 10000000.0 )
v41 = v31;
if ( (float)(ceilf(v41 * m_sectionXFactor) + 1.0) <= 0.0 )
{
v192 = 0;
}
else
{
v42 = 10000000.0;
if ( v31 <= 10000000.0 )
v42 = v31;
v192 = (int)(float)(ceilf(v42 * m_sectionXFactor) + 1.0);
}
v43 = 10000000.0;
if ( v37 <= 10000000.0 )
v43 = v37;
m_sectionYFactor = a1->m_sectionYFactor;
if ( (float)(floorf(v43 * m_sectionYFactor) - 1.0) <= 0.0 )
{
v193 = 0;
}
else
{
v45 = 10000000.0;
if ( v37 <= 10000000.0 )
v45 = v37;
v193 = (int)(float)(floorf(v45 * m_sectionYFactor) - 1.0);
}
v46 = 10000000.0;
if ( v35 <= 10000000.0 )
v46 = v35;
if ( (float)(ceilf(v46 * m_sectionYFactor) + 1.0) <= 0.0 )
{
v195 = 0;
}
else
{
v47 = 10000000.0;
if ( v35 <= 10000000.0 )
v47 = v35;
v195 = (int)(float)(ceilf(v47 * m_sectionYFactor) + 1.0);
}
GJEffectManager::activeColorForIndex(a1->m_effectManager, 1007);
*(cocos2d::ccColor3B *)&v48 = GJEffectManager::activeColorForIndex(a1->m_effectManager, 1000);
*(_QWORD *)&v223.h = v48;
*(_QWORD *)&v223.v = BYTE2(v48);
v201 = (cocos2d::ccColor3B)v48;
a1->m_lightBGColor = GameToolbox::transformColor(&v201, v223);
v49 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenRight(v49);
m_start = a1->m_sections.m_start;
m_leftSectionIndex = a1->m_leftSectionIndex;
m_rightSectionIndex = a1->m_rightSectionIndex;
v189 = a1->m_sections.m_finish - m_start;
if ( m_leftSectionIndex < (int)v189 && m_leftSectionIndex <= m_rightSectionIndex )
{
m_bottomSectionIndex = a1->m_bottomSectionIndex;
v54 = m_leftSectionIndex;
m_topSectionIndex = a1->m_topSectionIndex;
do
{
v56 = m_start[v54];
if ( v56 )
v57 = (unsigned __int64)((char *)v56->m_finish - (char *)v56->m_start) >> 3;
else
LODWORD(v57) = -1;
if ( (int)v57 > m_bottomSectionIndex && m_bottomSectionIndex <= m_topSectionIndex )
{
v58 = m_bottomSectionIndex;
v59 = m_bottomSectionIndex;
v60 = &v56->m_start[m_bottomSectionIndex];
do
{
if ( *v60 )
{
v61 = a1->m_sectionSizes.m_start[v54]->m_start[v58];
if ( v61 > 0 )
{
v62 = (*v60)->m_start;
v63 = 0;
do
{
v64 = v62[v63++];
v64->m_unk3ee = 1;
}
while ( v61 > (int)v63 );
}
}
++v59;
++v60;
++v58;
}
while ( v59 <= m_topSectionIndex && (int)v57 > v59 );
}
++m_leftSectionIndex;
++v54;
}
while ( m_leftSectionIndex <= m_rightSectionIndex && (int)v189 > m_leftSectionIndex );
}
m_visibleObjects2Count = a1->m_visibleObjects2Count;
if ( m_visibleObjects2Count > 0 )
{
v66 = a1->m_visibleObjects2.m_start;
v67 = 0;
do
{
v68 = v66[v67++];
v68->m_unk3ee = 1;
}
while ( m_visibleObjects2Count > (int)v67 );
}
if ( v191 <= v192 && v191 < (int)v189 )
{
v69 = (int)v189 >= v192 - 1;
if ( (int)v189 <= v191 + 1 )
v69 = 1;
v196 = v191;
v194 = v69;
v190 = v191;
v70 = m_start[v196];
if ( !v70 )
goto LABEL_134;
LABEL_62:
for ( i = (unsigned __int64)((char *)v70->m_finish - (char *)v70->m_start) >> 3;
v193 >= (int)i || v193 > v195;
LODWORD(i) = -1 )
{
LABEL_131:
++v196;
v103 = v190 + 1;
v190 = v103;
if ( (int)v189 <= v103 || v192 < v103 )
goto LABEL_135;
v70 = a1->m_sections.m_start[v196];
if ( v70 )
goto LABEL_62;
LABEL_134:
;
}
v71 = v193;
v198 = v193;
v199 = v193;
while ( 1 )
{
if ( v194 || (int)i <= v193 + 1 )
{
v72 = v70->m_start[v199];
if ( !v72 )
goto LABEL_75;
v73 = a1->m_sectionSizes.m_start[v196]->m_start[v198];
}
else
{
v72 = v70->m_start[v199];
if ( !v72 )
goto LABEL_75;
v73 = a1->m_sectionSizes.m_start[v196]->m_start[v198];
if ( (int)i < v195 - 1 )
{
if ( v73 <= 0 )
goto LABEL_75;
v86 = 0;
v87 = 8 * ((unsigned int)(v73 - 1) + 1LL);
p_m_activeObjects = &a1->m_activeObjects;
while ( 2 )
{
v93 = v72->m_start[v86 / 8];
if ( v93->m_isGroupDisabled )
{
LABEL_111:
v93->m_unk3ee = 1;
goto LABEL_109;
}
if ( v93->m_isActivated )
{
m_activeObjectsIndex = a1->m_activeObjectsIndex;
m_activeObjectsCount = a1->m_activeObjectsCount;
v207 = v72->m_start[v86 / 8];
v93->m_unk3ee = 0;
if ( m_activeObjectsIndex > m_activeObjectsCount )
{
a1->m_activeObjects.m_start[m_activeObjectsCount] = v93;
}
else
{
m_finish = a1->m_activeObjects.m_finish;
if ( m_finish == a1->m_activeObjects.m_reserveEnd )
{
std::vector::_M_emplace_back_aux((__int64)p_m_activeObjects, &v207);
m_activeObjectsIndex = a1->m_activeObjectsIndex;
m_activeObjectsCount = a1->m_activeObjectsCount;
}
else
{
if ( m_finish )
{
*m_finish = v93;
m_finish = a1->m_activeObjects.m_finish;
}
a1->m_activeObjects.m_finish = m_finish + 1;
}
a1->m_activeObjectsIndex = m_activeObjectsIndex + 1;
}
m_unk35C = v93->m_unk35C;
a1->m_activeObjectsCount = m_activeObjectsCount + 1;
if ( m_unk35C > 0 )
{
v204[1] = (cocos2d::CCPoint)v217;
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>::_M_insert>>>(
v217,
&v93->m_unk35C);
}
goto LABEL_109;
}
v94 = (cocos2d::CCRect *)v93->getObjectTextureRect(v72->m_start[v86 / 8]);
cocos2d::CCRect::getMinX(v94);
if ( v31 < v95
|| (cocos2d::CCRect::getMaxX(v94), v33 > v100)
|| (cocos2d::CCRect::getMinY(v94), v35 < v101)
|| (cocos2d::CCRect::getMaxY(v94), v37 > v102) )
{
if ( !v93->m_unk370 )
goto LABEL_111;
v96 = a1->m_activeObjectsIndex;
v97 = a1->m_activeObjectsCount;
v208 = v93;
v93->m_unk3ee = 0;
if ( v96 <= v97 )
goto LABEL_115;
LABEL_127:
a1->m_activeObjects.m_start[v97] = v93;
}
else
{
v96 = a1->m_activeObjectsIndex;
v97 = a1->m_activeObjectsCount;
v208 = v93;
v93->m_unk3ee = 0;
if ( v96 > v97 )
goto LABEL_127;
LABEL_115:
v98 = a1->m_activeObjects.m_finish;
if ( v98 == a1->m_activeObjects.m_reserveEnd )
{
std::vector::_M_emplace_back_aux((__int64)p_m_activeObjects, &v208);
v96 = a1->m_activeObjectsIndex;
v97 = a1->m_activeObjectsCount;
}
else
{
if ( v98 )
{
*v98 = v93;
v98 = a1->m_activeObjects.m_finish;
}
a1->m_activeObjects.m_finish = v98 + 1;
}
a1->m_activeObjectsIndex = v96 + 1;
}
v99 = v93->m_unk35C;
a1->m_activeObjectsCount = v97 + 1;
if ( v99 > 0 )
{
v204[2] = (cocos2d::CCPoint)v217;
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>::_M_insert>>>(
v217,
&v93->m_unk35C);
}
LABEL_109:
v86 += 8LL;
if ( v86 == v87 )
goto LABEL_75;
continue;
}
}
}
if ( v73 > 0 )
{
v74 = 0;
v75 = 8 * ((unsigned int)(v73 - 1) + 1LL);
do
{
v76 = v72->m_start[v74 / 8];
if ( !v76->m_isGroupDisabled )
{
v77 = (cocos2d::CCRect *)v76->getObjectTextureRect(v72->m_start[v74 / 8]);
cocos2d::CCRect::getMinX(v77);
if ( v31 >= v78 )
{
cocos2d::CCRect::getMaxX(v77);
if ( v33 <= v83 )
{
cocos2d::CCRect::getMinY(v77);
if ( v35 >= v84 )
{
cocos2d::CCRect::getMaxY(v77);
if ( v37 <= v85 )
{
v79 = a1->m_activeObjectsIndex;
v80 = a1->m_activeObjectsCount;
v209 = v76;
v76->m_unk3ee = 0;
if ( v79 > v80 )
{
LABEL_95:
a1->m_activeObjects.m_start[v80] = v76;
LABEL_89:
v82 = v76->m_unk35C;
a1->m_activeObjectsCount = v80 + 1;
if ( v82 > 0 )
{
v205 = v217;
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>::_M_insert>>>(
v217,
&v76->m_unk35C);
}
goto LABEL_74;
}
LABEL_84:
v81 = a1->m_activeObjects.m_finish;
if ( v81 == a1->m_activeObjects.m_reserveEnd )
{
std::vector::_M_emplace_back_aux(
(__int64)&a1->m_activeObjects,
&v209);
v79 = a1->m_activeObjectsIndex;
v80 = a1->m_activeObjectsCount;
}
else
{
if ( v81 )
{
*v81 = v76;
v81 = a1->m_activeObjects.m_finish;
}
a1->m_activeObjects.m_finish = v81 + 1;
}
a1->m_activeObjectsIndex = v79 + 1;
goto LABEL_89;
}
}
}
}
if ( v76->m_unk370 )
{
v79 = a1->m_activeObjectsIndex;
v80 = a1->m_activeObjectsCount;
v209 = v76;
v76->m_unk3ee = 0;
if ( v79 > v80 )
goto LABEL_95;
goto LABEL_84;
}
}
v76->m_unk3ee = 1;
LABEL_74:
v74 += 8LL;
}
while ( v74 != v75 );
}
LABEL_75:
++v71;
++v199;
++v198;
if ( (int)i <= v71 || v195 < v71 )
goto LABEL_131;
v70 = a1->m_sections.m_start[v196];
}
}
LABEL_135:
m_uiObjects = a1->m_uiObjects;
if ( m_uiObjects )
{
data = m_uiObjects->data;
if ( data->num )
{
arr = (GameObject **)data->arr;
v107 = 8LL * data->num - 8;
v108 = (char *)arr + v107;
if ( arr <= (GameObject **)((char *)arr + v107) )
{
v109 = *arr;
if ( *arr )
{
while ( 1 )
{
if ( !v109->m_isGroupDisabled )
{
v144 = (cocos2d::CCRect *)v109->getObjectTextureRect(v109);
v145 = v202;
cocos2d::CCRect::getMinX(v144);
if ( v145 >= v146 )
{
cocos2d::CCRect::getMaxX(v144);
if ( v151 >= 0.0 )
{
v152 = v203;
cocos2d::CCRect::getMinY(v144);
if ( v152 >= v153 )
{
cocos2d::CCRect::getMaxY(v144);
if ( v154 >= 0.0 )
{
v147 = a1->m_activeObjectsIndex;
v148 = a1->m_activeObjectsCount;
v210 = v109;
v109->m_unk3ee = 0;
if ( v147 > v148 )
{
LABEL_213:
a1->m_activeObjects.m_start[v148] = v109;
LABEL_203:
v150 = v109->m_unk35C;
a1->m_activeObjectsCount = v148 + 1;
if ( v150 > 0 )
{
v206 = v217;
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>::_M_insert>>>(
v217,
&v109->m_unk35C);
}
goto LABEL_141;
}
LABEL_198:
v149 = a1->m_activeObjects.m_finish;
if ( v149 == a1->m_activeObjects.m_reserveEnd )
{
std::vector::_M_emplace_back_aux(
(__int64)&a1->m_activeObjects,
&v210);
v147 = a1->m_activeObjectsIndex;
v148 = a1->m_activeObjectsCount;
}
else
{
if ( v149 )
{
*v149 = v109;
v149 = a1->m_activeObjects.m_finish;
}
a1->m_activeObjects.m_finish = v149 + 1;
}
a1->m_activeObjectsIndex = v147 + 1;
goto LABEL_203;
}
}
}
}
if ( v109->m_unk370 )
{
v147 = a1->m_activeObjectsIndex;
v148 = a1->m_activeObjectsCount;
v210 = v109;
v109->m_unk3ee = 0;
if ( v147 > v148 )
goto LABEL_213;
goto LABEL_198;
}
}
v109->m_unk3ee = 1;
LABEL_141:
if ( v108 >= (char *)++arr )
{
v109 = *arr;
if ( *arr )
continue;
}
break;
}
}
}
}
}
v110 = v218;
for ( a1->m_visibleObjectsCount = 0; v110; v110 = (__int64 *)*v110 )
{
LODWORD(v214) = *((_DWORD *)v110 + 2);
v111 = std::__detail::_Map_base>,std::allocator>>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[](
(__int64)&a1->m_visibilityGroups,
(int *)&v214);
v112 = *((GameObject ***)v111 + 1);
v113 = *(GameObject ***)v111;
if ( *(GameObject ***)v111 != v112 )
{
do
{
while ( 1 )
{
v114 = *v113;
if ( (!(*v113)->m_isActivated || v114->m_unk3ee) && !v114->m_isGroupDisabled )
break;
if ( v112 == ++v113 )
goto LABEL_163;
}
v115 = a1->m_activeObjectsIndex;
v116 = a1->m_activeObjectsCount;
v211 = *v113;
v114->m_unk3ee = 0;
if ( v115 > v116 )
{
a1->m_activeObjects.m_start[v116] = v114;
}
else
{
v117 = a1->m_activeObjects.m_finish;
if ( v117 == a1->m_activeObjects.m_reserveEnd )
{
std::vector::_M_emplace_back_aux((__int64)&a1->m_activeObjects, &v211);
v115 = a1->m_activeObjectsIndex;
v116 = a1->m_activeObjectsCount;
}
else
{
if ( v117 )
{
*v117 = v114;
v117 = a1->m_activeObjects.m_finish;
}
a1->m_activeObjects.m_finish = v117 + 1;
}
a1->m_activeObjectsIndex = v115 + 1;
}
m_visibleObjectsIndex = a1->m_visibleObjectsIndex;
m_visibleObjectsCount = a1->m_visibleObjectsCount;
a1->m_activeObjectsCount = v116 + 1;
v212 = v114;
if ( m_visibleObjectsIndex > m_visibleObjectsCount )
{
a1->m_visibleObjects.m_start[m_visibleObjectsCount] = v114;
}
else
{
v120 = a1->m_visibleObjects.m_finish;
if ( v120 == a1->m_visibleObjects.m_reserveEnd )
{
std::vector::_M_emplace_back_aux((__int64)&a1->m_visibleObjects, &v212);
m_visibleObjectsIndex = a1->m_visibleObjectsIndex;
m_visibleObjectsCount = a1->m_visibleObjectsCount;
}
else
{
if ( v120 )
{
*v120 = v114;
v120 = a1->m_visibleObjects.m_finish;
}
a1->m_visibleObjects.m_finish = v120 + 1;
}
a1->m_visibleObjectsIndex = m_visibleObjectsIndex + 1;
}
++v113;
a1->m_visibleObjectsCount = m_visibleObjectsCount + 1;
}
while ( v112 != v113 );
}
LABEL_163:
;
}
v121 = a1->m_visibleObjects2Count;
v122 = 0;
for ( j = 0; v121 > j; ++v122 )
{
while ( 1 )
{
v124 = a1->m_visibleObjects2.m_start[v122];
if ( v124->m_unk3ee )
break;
++j;
++v122;
if ( v121 <= j )
goto LABEL_169;
}
v124->deactivateObject(v124, 0);
v121 = a1->m_visibleObjects2Count;
++j;
}
LABEL_169:
v125 = a1->m_visibleObjectsCount;
a1->m_visibleObjects2Count = 0;
if ( v125 > 0 )
{
v126 = 0;
v127 = 0;
v128 = 0;
do
{
while ( 1 )
{
m_visibleObjects2Index = a1->m_visibleObjects2Index;
v131 = a1->m_visibleObjects.m_start[v126];
v214 = v131;
if ( m_visibleObjects2Index <= v127 )
break;
++v128;
++v126;
a1->m_visibleObjects2.m_start[v127++] = v131;
a1->m_visibleObjects2Count = v127;
if ( v125 <= v128 )
goto LABEL_178;
}
v129 = a1->m_visibleObjects2.m_finish;
if ( v129 == a1->m_visibleObjects2.m_reserveEnd )
{
std::vector::_M_emplace_back_aux((__int64)&a1->m_visibleObjects2, &v214);
m_visibleObjects2Index = a1->m_visibleObjects2Index;
v127 = a1->m_visibleObjects2Count;
v125 = a1->m_visibleObjectsCount;
}
else
{
if ( v129 )
{
*v129 = v131;
v129 = a1->m_visibleObjects2.m_finish;
}
a1->m_visibleObjects2.m_finish = v129 + 1;
}
++v128;
++v127;
a1->m_visibleObjects2Index = m_visibleObjects2Index + 1;
a1->m_visibleObjects2Count = v127;
++v126;
}
while ( v125 > v128 );
}
LABEL_178:
if ( !a1->m_objectsDeactivated )
{
v132 = a1->m_leftSectionIndex;
if ( v132 < (int)v189 )
{
v133 = a1->m_rightSectionIndex;
if ( v132 <= v133 )
{
v134 = v132;
do
{
v135 = a1->m_sections.m_start[v134];
if ( v135 )
v200 = (unsigned __int64)((char *)v135->m_finish - (char *)v135->m_start) >> 3;
else
LODWORD(v200) = -1;
v136 = a1->m_bottomSectionIndex;
if ( (int)v200 > v136 )
{
v137 = a1->m_topSectionIndex;
if ( v137 >= v136 )
{
v138 = v136;
v139 = v136;
while ( 1 )
{
v140 = v135->m_start[v138];
if ( v140 )
{
v141 = a1->m_sectionSizes.m_start[v134]->m_start[v139];
if ( v141 > 0 )
{
v142 = 0;
v143 = 8 * ((unsigned int)(v141 - 1) + 1LL);
do
{
v140->m_start[v142 / 8]->deactivateObject(v140->m_start[v142 / 8], 0);
v142 += 8LL;
}
while ( v142 != v143 );
v137 = a1->m_topSectionIndex;
}
}
++v136;
++v138;
++v139;
if ( v137 < v136 || (int)v200 <= v136 )
break;
v135 = a1->m_sections.m_start[v134];
}
v133 = a1->m_rightSectionIndex;
}
}
++v132;
++v134;
}
while ( v133 >= v132 && (int)v189 > v132 );
}
}
}
v155 = a1->m_uiObjects;
if ( v155 )
{
v156 = v155->data;
if ( v156->num )
{
v157 = (char *)v156->arr;
v158 = 8LL * v156->num - 8;
for ( k = &v157[v158]; k >= v157; v157 += 8 )
{
if ( !*(_QWORD *)v157 )
break;
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)v157 + 1296LL))(*(_QWORD *)v157, 0);
}
}
}
m_objectsToDeactivate = a1->m_objectsToDeactivate;
if ( m_objectsToDeactivate )
{
m_pElements = m_objectsToDeactivate->m_pElements;
if ( m_pElements )
{
m_pObject = m_pElements->m_pObject;
next = m_pElements->hh.next;
m_nLuaID = m_pObject[11].m_nLuaID;
if ( v192 >= m_nLuaID )
goto LABEL_226;
LABEL_231:
while ( 1 )
{
((void (__fastcall *)(cocos2d::CCObject *, __int64))m_pObject->__vftable[16].~CCObject_0)(m_pObject, 1);
if ( !next )
break;
while ( 1 )
{
v166 = next;
next = (_QWORD *)next[36];
m_pObject = (cocos2d::CCObject *)v166[33];
m_nLuaID = m_pObject[11].m_nLuaID;
if ( v192 < m_nLuaID )
break;
LABEL_226:
if ( v191 > m_nLuaID )
goto LABEL_231;
m_nTag = m_pObject[11].m_nTag;
if ( v195 < m_nTag || v193 > m_nTag )
goto LABEL_231;
if ( !next )
goto LABEL_232;
}
}
LABEL_232:
m_objectsToDeactivate = a1->m_objectsToDeactivate;
}
}
cocos2d::CCDictionary::removeAllObjects(m_objectsToDeactivate);
m_batchNodes = a1->m_batchNodes;
if ( m_batchNodes )
{
v168 = m_batchNodes->data;
if ( v168->num )
{
v169 = (cocos2d::CCNode **)v168->arr;
v170 = 8LL * v168->num - 8;
v171 = (char *)v169 + v170;
if ( v169 <= (cocos2d::CCNode **)((char *)v169 + v170) )
{
do
{
if ( !*v169 )
break;
cocos2d::CCNode::updateChildIndexes(*v169++);
}
while ( v171 >= (char *)v169 );
}
}
}
m_glitterParticles = a1->m_glitterParticles;
if ( m_glitterParticles )
{
setPosVar = m_glitterParticles->setPosVar;
v174 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenScaleFactorW(v174);
v176 = (float)((float)(v175 * 480.0) / 1.8) / m_cameraZoom;
v177 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenScaleFactorH(v177);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v205, v176, (float)(v178 * 320.0) * 0.5);
cocos2d::CCPoint::operator/(&v206, &v205, m_cameraZoom);
setPosVar(m_glitterParticles, (const cocos2d::CCPoint *)&v206);
}
a1->m_objectsDeactivated = 0;
a1->m_leftSectionIndex = v191;
a1->m_rightSectionIndex = v192;
a1->m_bottomSectionIndex = v193;
a1->m_topSectionIndex = v195;
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>::~_Hashtable((__int64)v217);
}