//
// GJBaseGameLayer::preUpdateVisibility from 0x1001fd4e0 to 0x1001fe36c (3724 bytes)
//
// 2 xrefs:
// > PlayLayer::updateVisibility @ 0x10011c4b0
// > LevelEditorLayer::updateVisibility @ 0x10035e8b4
//
// 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 GJBaseGameLayer::preUpdateVisibility(GJBaseGameLayer *a1, float a2)
{
cocos2d::CCDirector *v3; // x0
int32x2_t v4; // d0
float32x2_t *v5; // x0
float v6; // s0
float v7; // s1
float v8; // s2
__n128 v9; // q1
__n128 v10; // q0
OBB2D *m_cameraObb2; // x20
float v12; // s4
OBB2D *v13; // x20
float v14; // s4
GJGroundLayer *m_groundLayer; // x20
float v16; // s0
float v17; // s0
GJGroundLayer *m_groundLayer2; // x20
float v19; // s0
float32x2_t v20; // d0
float32x4_t v21; // q1
float32x4_t v22; // q0
float v23; // s8
float v24; // s9
float v25; // s10
float v26; // s11
float v27; // s0
float v28; // s14
float m_sectionXFactor; // s15
float v30; // s13
float v31; // s1
float m_sectionYFactor; // s12
cocos2d::CCDirector *v33; // x0
float v34; // s1
float v35; // s2
float v36; // s3
float v37; // s4
std::__vector_base *, std::allocator *>> *, std::allocator *, std::allocator *>> *>>::pointer begin; // x8
__int64 v39; // x10
__int64 m_rightSectionIndex; // x9
__int64 m_bottomSectionIndex; // x11
__int64 m_topSectionIndex; // x12
std::vector *, std::allocator *>> *v43; // x15
unsigned __int64 v44; // x16
std::__vector_base *, std::allocator *>>::pointer v45; // x15
__int64 v46; // x17
std::vector *v47; // x1
__int64 v48; // x0
__int64 *v49; // x1
__int64 v50; // t1
float v51; // s3
float v52; // s0
__int64 m_visibleObjects2Count; // x8
std::__vector_base::pointer v54; // x9
__int64 v55; // t1
bool v57; // w9
__int64 v58; // x23
std::vector *, std::allocator *>> *v59; // x8
unsigned __int64 v60; // x8
char v61; // w9
char v62; // w8
__int64 v63; // x28
std::vector *v64; // x27
__int64 v65; // x8
unsigned __int64 v66; // x24
__int64 v67; // x25
GameObject *v68; // x20
float *v69; // x21
int m_activeObjectsCount; // w8
unsigned __int64 v71; // x24
__int64 v72; // x25
GameObject *v73; // x20
int v74; // w8
float *v75; // x21
int v76; // w8
cocos2d::CCArray *m_uiObjects; // x8
cocos2d::ccArray *data; // x9
__int64 num; // x8
GameObject **arr; // x22
unsigned __int64 v81; // x23
GameObject *v82; // x20
float *v83; // x21
float v84; // s8
float v85; // s8
int v86; // w8
__int64 *i; // x22
_QWORD *v88; // x0
GameObject **v89; // x25
GameObject **v90; // x26
GameObject *v91; // x27
int v92; // w8
int m_visibleObjectsCount; // w8
int v94; // w8
bool *p_m_isEditor; // x22
int v96; // w23
__int64 j; // x20
GameObject *v98; // x0
int v99; // w8
int v100; // w9
__int64 v101; // x21
int m_visibleObjects2Index; // w10
GameObject *v103; // x11
int m_leftSectionIndex; // w9
int v105; // w8
__int64 v107; // x20
std::vector *, std::allocator *>> *v108; // x9
unsigned __int64 v109; // x10
int v110; // w11
int v111; // w9
__int64 v113; // x22
__int64 v114; // x23
std::vector *v115; // x24
__int64 v116; // x8
unsigned __int64 v117; // x25
__int64 v118; // x26
cocos2d::CCArray *v119; // x8
cocos2d::ccArray *v120; // x9
__int64 v121; // x8
cocos2d::CCObject **v122; // x20
unsigned __int64 v123; // x21
cocos2d::CCDictionary *m_objectsToDeactivate; // x0
cocos2d::CCDictElement *m_pElements; // x20
cocos2d::CCObject *m_pObject; // x0
int m_nLuaID; // w8
int m_nTag; // w8
cocos2d::CCArray *m_batchNodes; // x8
cocos2d::ccArray *v132; // x9
__int64 v133; // x8
cocos2d::CCNode **v134; // x20
unsigned __int64 v135; // x21
cocos2d::CCParticleSystemQuad *m_glitterParticles; // x20
cocos2d::CCDirector *v137; // x0
float v138; // s8
cocos2d::CCDirector *v139; // x0
__n128 v140; // q1
__n128 v141; // q0
double v142; // d0
__int64 v143; // [xsp+0h] [xbp-1A0h]
unsigned __int64 v144; // [xsp+8h] [xbp-198h]
int32x2_t v145; // [xsp+10h] [xbp-190h]
int v146; // [xsp+30h] [xbp-170h]
char v147; // [xsp+44h] [xbp-15Ch]
int v148; // [xsp+50h] [xbp-150h]
int v149; // [xsp+68h] [xbp-138h]
int v150; // [xsp+70h] [xbp-130h]
char v151; // [xsp+7Ch] [xbp-124h]
float v152; // [xsp+80h] [xbp-120h]
float v153; // [xsp+88h] [xbp-118h]
__int64 v154; // [xsp+88h] [xbp-118h]
float32x2_t v155; // [xsp+94h] [xbp-10Ch] BYREF
cocos2d::ccColor3B v156; // [xsp+9Ch] [xbp-104h] BYREF
float32x2_t *v157; // [xsp+A0h] [xbp-100h] BYREF
float32x2_t v158; // [xsp+A8h] [xbp-F8h]
float32x4_t v159; // [xsp+B0h] [xbp-F0h] BYREF
float32x2_t v160; // [xsp+C8h] [xbp-D8h] BYREF
__int128 v161; // [xsp+D0h] [xbp-D0h] BYREF
__int128 v162; // [xsp+E0h] [xbp-C0h]
int v163; // [xsp+F0h] [xbp-B0h]
float v164; // [xsp+FCh] [xbp-A4h]
float v165; // [xsp+100h] [xbp-A0h]
v3 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v3);
v161 = 0u;
v162 = 0u;
v163 = 1065353216;
sub_1000229B8((__int64 *)&v160, (__int64 *)&a1->m_gameState.m_cameraPosition2);
v4.i32[0] = LODWORD(a1->m_gameState.m_cameraZoom);
v145 = v4;
if ( a1->m_isEditor && !a1->m_started )
{
v145 = COERCE_INT32X2_T(((double (__fastcall *)(cocos2d::CCLayer *))a1->m_objectLayer->getScale)(a1->m_objectLayer));
v5 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCLayer *))a1->m_objectLayer->getPosition)(a1->m_objectLayer);
sub_100022A04(v5, (float32x2_t *)&v157);
sub_100022A14((float32x2_t *)&v157, (float32x2_t *)&v159, 1.0 / *(float *)v145.i32);
sub_1000229D0(&v160, (double *)v159.i64);
if ( a1->m_gameState.m_cameraShakeEnabled )
{
sub_1000229F0(&v160, (float32x2_t *)&a1->m_gameState.m_unkPoint34, (float32x2_t *)&v159);
sub_1000229D0(&v160, (double *)v159.i64);
}
}
v6 = v164;
v7 = v165;
v8 = v164 / *(float *)v145.i32;
a1->m_cameraWidth = v164 / *(float *)v145.i32;
a1->m_cameraHeight = v7 / *(float *)v145.i32;
a1->m_halfCameraWidth = v8 * 0.5;
a1->m_cameraUnzoomedX = (float)(v6 * 0.5) + a1->m_gameState.m_cameraPosition2.x;
a1->m_activeObjectsCount = 0;
sub_100022990(v159.f32, v160.f32[0], v160.f32[1], v8, v7 / *(float *)v145.i32);
v10.n128_u32[0] = LODWORD(a1->m_gameState.m_cameraAngle);
if ( v10.n128_f32[0] == 0.0 )
{
*(_QWORD *)&a1->m_cameraWidthOffset = 0;
*(_QWORD *)&a1->m_cameraUnzoomedHeightOffset = 0;
}
else
{
if ( a1->m_calculateTargetHeightOffset )
{
m_cameraObb2 = a1->m_cameraObb2;
v10.n128_f32[0] = v164 * 0.5;
v9.n128_f32[0] = v165 * 0.5;
sub_100022980(v10, v9, &v157);
OBB2D::calculateWithCenter(
m_cameraObb2,
*(cocos2d::CCPoint *)&v159.u32[2],
a1->m_gameState.m_targetCameraAngle * 0.017453,
0.017453,
v12);
OBB2D::getBoundingRect(a1->m_cameraObb2);
a1->m_targetCameraHeightOffset = v158.f32[1] - v159.f32[3];
a1->m_calculateTargetHeightOffset = 0;
}
v13 = a1->m_cameraObb2;
v10.n128_f32[0] = v164 * 0.5;
v9.n128_f32[0] = v165 * 0.5;
sub_100022980(v10, v9, &v157);
OBB2D::calculateWithCenter(
v13,
*(cocos2d::CCPoint *)&v159.u32[2],
a1->m_gameState.m_cameraAngle * 0.017453,
0.017453,
v14);
OBB2D::getBoundingRect(a1->m_cameraObb2);
v10.n128_u64[0] = (unsigned __int64)vsub_f32(v158, *(float32x2_t *)&v159.u32[2]);
LODWORD(a1->m_cameraUnzoomedHeightOffset) = v10.n128_u32[1];
*(float32x2_t *)&a1->m_cameraWidthOffset = vmul_n_f32((float32x2_t)v10.n128_u64[0], *(float *)v145.i32);
v10.n128_u32[0] = LODWORD(a1->m_gameState.m_cameraAngle);
}
m_groundLayer = a1->m_groundLayer;
if ( (v10.n128_f32[0] != 0.0) != m_groundLayer->m_cameraRotated )
{
m_groundLayer->m_cameraRotated = v10.n128_f32[0] != 0.0;
a1->m_groundLayer2->m_cameraRotated = v10.n128_f32[0] != 0.0;
v16 = ((float (__fastcall *)(GJGroundLayer *))m_groundLayer->getScaleX)(m_groundLayer);
v17 = GJGroundLayer::scaleGround(m_groundLayer, v16);
m_groundLayer2 = a1->m_groundLayer2;
v19 = ((float (__fastcall *)(GJGroundLayer *, float))m_groundLayer2->getScaleX)(m_groundLayer2, v17);
GJGroundLayer::scaleGround(m_groundLayer2, v19);
v10.n128_u32[0] = LODWORD(a1->m_gameState.m_cameraAngle);
}
if ( v10.n128_f32[0] == 0.0 || a1->m_cameraWidthOffset == 0.0 )
{
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;
}
}
else
{
GJBaseGameLayer::updateGroundShadows(a1);
v20 = vdiv_f32(*(float32x2_t *)&a1->m_cameraWidthOffset, (float32x2_t)vdup_lane_s32(v145, 0));
*(float32x2_t *)v21.f32 = vmul_f32(v20, (float32x2_t)0x3F0000003F000000LL);
*(float32x2_t *)&v21.u32[2] = v20;
v22.i64[0] = vsubq_f32(v159, v21).u64[0];
v22.i64[1] = vaddq_f32(v159, v21).i64[1];
v159 = v22;
a1->m_updateGroundShadows = 1;
}
v23 = sub_100022C30(v159.f32);
v24 = sub_100022C40((__int64)&v159);
v25 = sub_100022C48((__int64)&v159);
v26 = sub_100022C58((__int64)&v159);
v27 = 10000000.0;
if ( v24 <= 10000000.0 )
v28 = v24;
else
v28 = 10000000.0;
m_sectionXFactor = a1->m_sectionXFactor;
if ( v23 <= 10000000.0 )
v30 = v23;
else
v30 = 10000000.0;
if ( v26 <= 10000000.0 )
v31 = v26;
else
v31 = 10000000.0;
v153 = v31;
m_sectionYFactor = a1->m_sectionYFactor;
if ( v25 <= 10000000.0 )
v27 = v25;
v152 = v27;
GJEffectManager::activeColorForIndex(a1->m_effectManager, 1007);
v156 = GJEffectManager::activeColorForIndex(a1->m_effectManager, 1000);
a1->m_lightBGColor = GameToolbox::transformColor(&v156, 0.0, -0.2, 0.2);
v33 = cocos2d::CCDirector::sharedDirector();
sub_1001768E0((__int64)v33);
v34 = fmaxf(floorf(v28 * m_sectionXFactor) + -1.0, 0.0);
v35 = fmaxf(ceilf(v30 * m_sectionXFactor) + 1.0, 0.0);
v36 = floorf(v153 * m_sectionYFactor) + -1.0;
v37 = ceilf(v152 * m_sectionYFactor) + 1.0;
begin = a1->m_sections.__begin_;
v143 = (char *)a1->m_sections.__end_ - (char *)begin;
v144 = (unsigned __int64)v143 >> 3;
LODWORD(v39) = a1->m_leftSectionIndex;
m_rightSectionIndex = a1->m_rightSectionIndex;
if ( (int)v39 <= (int)m_rightSectionIndex && (int)v39 < (int)v144 )
{
v39 = (int)v39;
m_bottomSectionIndex = a1->m_bottomSectionIndex;
m_topSectionIndex = a1->m_topSectionIndex;
do
{
v43 = begin[v39];
if ( v43 )
v44 = (unsigned __int64)((char *)v43->__end_ - (char *)v43->__begin_) >> 3;
else
LODWORD(v44) = -1;
if ( (int)m_bottomSectionIndex <= (int)m_topSectionIndex && (int)m_bottomSectionIndex < (int)v44 )
{
v45 = v43->__begin_;
v46 = m_bottomSectionIndex;
do
{
v47 = v45[v46];
if ( v47 )
{
v48 = (unsigned int)a1->m_sectionSizes.__begin_[v39]->__begin_[v46];
if ( (int)v48 >= 1 )
{
v49 = (__int64 *)v47->__begin_;
do
{
v50 = *v49++;
*(_BYTE *)(v50 + 998) = 1;
--v48;
}
while ( v48 );
}
}
if ( v46 >= m_topSectionIndex )
break;
++v46;
}
while ( v46 < (int)v44 );
}
if ( v39 >= m_rightSectionIndex )
break;
++v39;
}
while ( v39 < (int)(v143 >> 3) );
}
v51 = fmaxf(v36, 0.0);
v52 = fmaxf(v37, 0.0);
v148 = (int)v35;
m_visibleObjects2Count = (unsigned int)a1->m_visibleObjects2Count;
if ( (int)m_visibleObjects2Count >= 1 )
{
v54 = a1->m_visibleObjects2.__begin_;
do
{
v55 = (__int64)*v54++;
*(_BYTE *)(v55 + 998) = 1;
--m_visibleObjects2Count;
}
while ( m_visibleObjects2Count );
}
v150 = (int)v51;
v149 = (int)v52;
v146 = (int)v34;
if ( (int)v34 <= v148 && v146 < (int)v144 )
{
v57 = v146 + 1 >= (int)v144 || v148 - 1 <= (int)v144;
v147 = v57;
v58 = v146;
while ( 1 )
{
v59 = a1->m_sections.__begin_[v58];
if ( v59 )
v60 = (unsigned __int64)((char *)v59->__end_ - (char *)v59->__begin_) >> 3;
else
LODWORD(v60) = -1;
if ( v150 <= v149 && (int)v60 > v150 )
break;
LABEL_109:
if ( v58 < v148 && ++v58 < (int)(v143 >> 3) )
continue;
goto LABEL_111;
}
v61 = v147;
if ( (int)v60 <= v150 + 1 )
v61 = 1;
v154 = (int)v60;
if ( (int)v60 >= v149 - 1 )
v62 = 1;
else
v62 = v61;
v151 = v62;
v63 = v150;
while ( 1 )
{
v64 = a1->m_sections.__begin_[v58]->__begin_[v63];
if ( v64 )
{
v65 = (unsigned int)a1->m_sectionSizes.__begin_[v58]->__begin_[v63];
if ( (v151 & 1) != 0 )
{
if ( (int)v65 >= 1 )
{
v66 = 0;
v67 = 8 * v65;
do
{
v68 = v64->__begin_[v66 / 8];
if ( v68->m_isGroupDisabled
|| ((v69 = (float *)((__int64 (__fastcall *)(GameObject *))v68->getObjectTextureRect)(v64->__begin_[v66 / 8]),
v23 < sub_100022C40((__int64)v69))
|| sub_100022C30(v69) < v24
|| v25 < sub_100022C58((__int64)v69)
|| sub_100022C48((__int64)v69) < v26)
&& !v68->m_unk370 )
{
v68->m_unk3ee = 1;
}
else
{
v68->m_unk3ee = 0;
v157 = (float32x2_t *)v68;
m_activeObjectsCount = a1->m_activeObjectsCount;
if ( a1->m_activeObjectsIndex <= m_activeObjectsCount )
{
sub_1000115B8((__int64)&a1->m_activeObjects, &v157);
++a1->m_activeObjectsIndex;
m_activeObjectsCount = a1->m_activeObjectsCount;
}
else
{
a1->m_activeObjects.__begin_[m_activeObjectsCount] = v68;
}
a1->m_activeObjectsCount = m_activeObjectsCount + 1;
if ( v68->m_unk35C >= 1 )
sub_10001C1B0((unsigned __int64)&v161, &v68->m_unk35C, &v68->m_unk35C);
}
v66 += 8LL;
}
while ( v67 != v66 );
}
goto LABEL_107;
}
if ( (int)v65 >= 1 )
break;
}
LABEL_107:
if ( v63 < v149 && ++v63 < v154 )
continue;
goto LABEL_109;
}
v71 = 0;
v72 = 8 * v65;
while ( 1 )
{
v73 = v64->__begin_[v71 / 8];
if ( !v73->m_isGroupDisabled )
{
if ( v73->m_isActivated )
{
v73->m_unk3ee = 0;
v157 = (float32x2_t *)v73;
v74 = a1->m_activeObjectsCount;
if ( a1->m_activeObjectsIndex <= v74 )
{
sub_1000115B8((__int64)&a1->m_activeObjects, &v157);
++a1->m_activeObjectsIndex;
v74 = a1->m_activeObjectsCount;
}
else
{
a1->m_activeObjects.__begin_[v74] = v73;
}
a1->m_activeObjectsCount = v74 + 1;
if ( v73->m_unk35C < 1 )
goto LABEL_106;
goto LABEL_105;
}
v75 = (float *)((__int64 (__fastcall *)(GameObject *))v73->getObjectTextureRect)(v64->__begin_[v71 / 8]);
if ( v23 >= sub_100022C40((__int64)v75)
&& sub_100022C30(v75) >= v24
&& v25 >= sub_100022C58((__int64)v75)
&& sub_100022C48((__int64)v75) >= v26
|| v73->m_unk370 )
{
v73->m_unk3ee = 0;
v157 = (float32x2_t *)v73;
v76 = a1->m_activeObjectsCount;
if ( a1->m_activeObjectsIndex <= v76 )
{
sub_1000115B8((__int64)&a1->m_activeObjects, &v157);
++a1->m_activeObjectsIndex;
v76 = a1->m_activeObjectsCount;
}
else
{
a1->m_activeObjects.__begin_[v76] = v73;
}
a1->m_activeObjectsCount = v76 + 1;
if ( v73->m_unk35C < 1 )
goto LABEL_106;
LABEL_105:
sub_10001C1B0((unsigned __int64)&v161, &v73->m_unk35C, &v73->m_unk35C);
goto LABEL_106;
}
}
v73->m_unk3ee = 1;
LABEL_106:
v71 += 8LL;
if ( v72 == v71 )
goto LABEL_107;
}
}
LABEL_111:
m_uiObjects = a1->m_uiObjects;
if ( m_uiObjects )
{
data = m_uiObjects->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (GameObject **)data->arr;
v81 = (unsigned __int64)&arr[num - 1];
do
{
v82 = *arr;
if ( !*arr )
break;
if ( v82->m_isGroupDisabled
|| ((v83 = (float *)((__int64 (__fastcall *)(GameObject *))v82->getObjectTextureRect)(*arr),
v84 = v164,
v84 < sub_100022C40((__int64)v83))
|| sub_100022C30(v83) < 0.0
|| (v85 = v165, v85 < sub_100022C58((__int64)v83))
|| sub_100022C48((__int64)v83) < 0.0)
&& !v82->m_unk370 )
{
v82->m_unk3ee = 1;
}
else
{
v82->m_unk3ee = 0;
v157 = (float32x2_t *)v82;
v86 = a1->m_activeObjectsCount;
if ( a1->m_activeObjectsIndex <= v86 )
{
sub_1000115B8((__int64)&a1->m_activeObjects, &v157);
++a1->m_activeObjectsIndex;
v86 = a1->m_activeObjectsCount;
}
else
{
a1->m_activeObjects.__begin_[v86] = v82;
}
a1->m_activeObjectsCount = v86 + 1;
if ( v82->m_unk35C >= 1 )
sub_10001C1B0((unsigned __int64)&v161, &v82->m_unk35C, &v82->m_unk35C);
}
++arr;
}
while ( (unsigned __int64)arr <= v81 );
}
}
a1->m_visibleObjectsCount = 0;
for ( i = (__int64 *)v162; i; i = (__int64 *)*i )
{
v155.i32[0] = *((_DWORD *)i + 4);
v157 = &v155;
v88 = sub_10001A284(
(unsigned __int64)&a1->m_visibilityGroups,
(int *)&v155,
(__int64)&unk_10063A31C,
(_DWORD **)&v157);
v89 = (GameObject **)v88[3];
v90 = (GameObject **)v88[4];
while ( v89 != v90 )
{
v91 = *v89;
if ( (!(*v89)->m_isActivated || v91->m_unk3ee) && !v91->m_isGroupDisabled )
{
v91->m_unk3ee = 0;
v157 = (float32x2_t *)v91;
v92 = a1->m_activeObjectsCount;
if ( a1->m_activeObjectsIndex <= v92 )
{
sub_1000115B8((__int64)&a1->m_activeObjects, &v157);
++a1->m_activeObjectsIndex;
v92 = a1->m_activeObjectsCount;
}
else
{
a1->m_activeObjects.__begin_[v92] = v91;
}
a1->m_activeObjectsCount = v92 + 1;
v157 = (float32x2_t *)v91;
m_visibleObjectsCount = a1->m_visibleObjectsCount;
if ( a1->m_visibleObjectsIndex <= m_visibleObjectsCount )
{
sub_1000115B8((__int64)&a1->m_visibleObjects, &v157);
++a1->m_visibleObjectsIndex;
m_visibleObjectsCount = a1->m_visibleObjectsCount;
}
else
{
a1->m_visibleObjects.__begin_[m_visibleObjectsCount] = v91;
}
a1->m_visibleObjectsCount = m_visibleObjectsCount + 1;
}
++v89;
}
}
v94 = a1->m_visibleObjects2Count;
p_m_isEditor = &a1->m_isEditor;
v96 = v146;
if ( v94 >= 1 )
{
for ( j = 0; j < v94; ++j )
{
v98 = a1->m_visibleObjects2.__begin_[j];
if ( v98->m_unk3ee )
{
((void (__fastcall *)(GameObject *, _QWORD))v98->deactivateObject)(v98, 0);
v94 = a1->m_visibleObjects2Count;
}
}
}
a1->m_visibleObjects2Count = 0;
v99 = a1->m_visibleObjectsCount;
if ( v99 >= 1 )
{
v100 = 0;
v101 = 0;
m_visibleObjects2Index = a1->m_visibleObjects2Index;
do
{
v103 = a1->m_visibleObjects.__begin_[v101];
v157 = (float32x2_t *)v103;
if ( m_visibleObjects2Index <= v100 )
{
sub_1000115B8((__int64)&a1->m_visibleObjects2, &v157);
m_visibleObjects2Index = a1->m_visibleObjects2Index + 1;
a1->m_visibleObjects2Index = m_visibleObjects2Index;
v100 = a1->m_visibleObjects2Count;
v99 = a1->m_visibleObjectsCount;
}
else
{
a1->m_visibleObjects2.__begin_[v100] = v103;
}
a1->m_visibleObjects2Count = ++v100;
++v101;
}
while ( v101 < v99 );
}
if ( !a1->m_objectsDeactivated )
{
m_leftSectionIndex = a1->m_leftSectionIndex;
v105 = a1->m_rightSectionIndex;
if ( m_leftSectionIndex <= v105 && m_leftSectionIndex < (int)v144 )
{
v107 = m_leftSectionIndex;
do
{
v108 = a1->m_sections.__begin_[v107];
if ( v108 )
v109 = (unsigned __int64)((char *)v108->__end_ - (char *)v108->__begin_) >> 3;
else
LODWORD(v109) = -1;
v110 = a1->m_bottomSectionIndex;
v111 = a1->m_topSectionIndex;
if ( v110 <= v111 && v110 < (int)v109 )
{
v113 = v110;
v114 = (int)v109;
do
{
v115 = a1->m_sections.__begin_[v107]->__begin_[v113];
if ( v115 )
{
v116 = (unsigned int)a1->m_sectionSizes.__begin_[v107]->__begin_[v113];
if ( (int)v116 >= 1 )
{
v117 = 0;
v118 = 8 * v116;
do
{
((void (__fastcall *)(GameObject *, _QWORD))v115->__begin_[v117 / 8]->deactivateObject)(
v115->__begin_[v117 / 8],
0);
v117 += 8LL;
}
while ( v118 != v117 );
v111 = a1->m_topSectionIndex;
}
}
if ( v113 >= v111 )
break;
++v113;
}
while ( v113 < v114 );
v105 = a1->m_rightSectionIndex;
p_m_isEditor = &a1->m_isEditor;
v96 = v146;
}
if ( v107 >= v105 )
break;
++v107;
}
while ( v107 < (int)(v143 >> 3) );
}
}
v119 = a1->m_uiObjects;
if ( v119 )
{
v120 = v119->data;
v121 = v120->num;
if ( (_DWORD)v121 )
{
v122 = v120->arr;
v123 = (unsigned __int64)&v122[v121 - 1];
do
{
if ( !*v122 )
break;
((void (__fastcall *)(cocos2d::CCObject *, _QWORD))(*v122)->__vftable[16].~CCObject_0)(*v122, 0);
++v122;
}
while ( (unsigned __int64)v122 <= v123 );
}
}
m_objectsToDeactivate = a1->m_objectsToDeactivate;
if ( m_objectsToDeactivate )
{
m_pElements = m_objectsToDeactivate->m_pElements;
if ( m_pElements )
{
do
{
m_pObject = m_pElements->m_pObject;
m_pElements = (cocos2d::CCDictElement *)m_pElements->hh.next;
m_nLuaID = m_pObject[11].m_nLuaID;
if ( m_nLuaID >= v96 && m_nLuaID <= v148 )
{
m_nTag = m_pObject[11].m_nTag;
if ( m_nTag >= v150 && m_nTag <= v149 )
continue;
}
((void (__fastcall *)(cocos2d::CCObject *, __int64))m_pObject->__vftable[16].~CCObject_0)(m_pObject, 1);
}
while ( m_pElements );
m_objectsToDeactivate = a1->m_objectsToDeactivate;
}
}
cocos2d::CCDictionary::removeAllObjects(m_objectsToDeactivate);
m_batchNodes = a1->m_batchNodes;
if ( m_batchNodes )
{
v132 = m_batchNodes->data;
v133 = v132->num;
if ( (_DWORD)v133 )
{
v134 = (cocos2d::CCNode **)v132->arr;
v135 = (unsigned __int64)&v134[v133 - 1];
do
{
if ( !*v134 )
break;
cocos2d::CCNode::updateChildIndexes(*v134++);
}
while ( (unsigned __int64)v134 <= v135 );
}
}
m_glitterParticles = a1->m_glitterParticles;
if ( m_glitterParticles )
{
v137 = cocos2d::CCDirector::sharedDirector();
v138 = sub_1001768C0((__int64)v137);
v139 = cocos2d::CCDirector::sharedDirector();
v140.n128_f32[0] = (float)(sub_1001768B8((__int64)v139) * 320.0) * 0.5;
v141.n128_f32[0] = (float)((float)(v138 * 480.0) / 1.8) / *(float *)v145.i32;
sub_100022980(v141, v140, &v155);
*(float32x2_t *)&v142 = sub_100022A24(&v155, (float32x2_t *)&v157, v145);
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *, float32x2_t **, double))m_glitterParticles->setPosVar)(
m_glitterParticles,
&v157,
v142);
}
p_m_isEditor[180] = 0;
a1->m_leftSectionIndex = v96;
a1->m_rightSectionIndex = v148;
a1->m_bottomSectionIndex = v150;
a1->m_topSectionIndex = v149;
sub_100017A98((__int64)&v161);
}