//
// GJBigSprite::updateSpriteVisibility from 0x100268700 to 0x100268c1e (1310 bytes)
//
// 4 xrefs:
// > MapSelectLayer::init @ 0x1002680c5
// > MapSelectLayer::update @ 0x100268f31
// > MapSelectLayer::update @ 0x100268fef
// > MapSelectLayer::ccTouchMoved @ 0x1002699d3
//
// 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 GJBigSprite::updateSpriteVisibility(GJBigSprite *a1)
{
cocos2d::CCTexture2DPixelFormat v2; // r13d
float v3; // xmm0_4
bool v4; // zf
cocos2d::CCDirector *v5; // rsi
__m128 v6; // xmm0
double v7; // xmm1_8
unsigned __int64 i; // r15
__int64 v9; // r14
float *v10; // rax
__int64 v11; // rax
double v12; // xmm0_8
__int64 v13; // rdi
__int64 v14; // r14
cocos2d::CCTextureCache *v15; // rax
const char *v16; // rsi
const char *v17; // rdi
std::__vector_base::pointer begin; // rax
__int64 v19; // rsi
cocos2d::CCTextureCache *v20; // rax
const char *v21; // rsi
cocos2d::CCSprite *v22; // rax
cocos2d::CCSprite *v23; // r13
__int64 v24; // rax
__int64 v25; // rax
_BYTE v26[16]; // [rsp+10h] [rbp-B0h] BYREF
__m128 v27; // [rsp+20h] [rbp-A0h]
float v28[2]; // [rsp+30h] [rbp-90h] BYREF
float v29[4]; // [rsp+38h] [rbp-88h] BYREF
void **v30; // [rsp+48h] [rbp-78h]
__int128 v31; // [rsp+50h] [rbp-70h] BYREF
void *v32; // [rsp+60h] [rbp-60h] BYREF
__int128 v33; // [rsp+70h] [rbp-50h] BYREF
void *__p; // [rsp+80h] [rbp-40h]
float v35; // [rsp+88h] [rbp-38h]
cocos2d::CCTexture2DPixelFormat v36; // [rsp+8Ch] [rbp-34h]
float v37; // [rsp+90h] [rbp-30h]
float v38; // [rsp+94h] [rbp-2Ch]
double v39; // 0:xmm0_8.8
if ( !a1->m_unloadingAll )
{
v2 = cocos2d::CCTexture2D::defaultAlphaPixelFormat();
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGB888);
v3 = ((float (__fastcall *)(GJBigSprite *))a1->getScale)(a1);
v4 = !a1->m_loadSprites;
v37 = v3;
if ( v4 )
v38 = 0.0;
else
v38 = 10.0 / v3;
v5 = cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v39 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v28);
v6 = _mm_xor_ps(
(__m128)*(unsigned int *)((__int64 (__fastcall *)(GJBigSprite *, cocos2d::CCDirector *, double))a1->getPosition)(
a1,
v5,
v39),
(__m128)xmmword_1008150B0);
v6.f32[0] = (float)(v6.f32[0] / v37) - v38;
v27 = v6;
*(_QWORD *)&v7 = *(unsigned int *)(((__int64 (__fastcall *)(GJBigSprite *))a1->getPosition)(a1) + 4)
^ 0x8000000080000000LL;
*(float *)&v7 = (float)(*(float *)&v7 / v37) - v38;
sub_10028CC00(
v26,
*(double *)v6.i64,
v7,
(float)(v28[0] / v37) + (float)(v38 + v38),
(float)(v28[1] / v37) + (float)(v38 + v38));
*(double *)v6.i64 = sub_10028D230();
v38 = v6.f32[0];
*(double *)v6.i64 = sub_10028D270();
v37 = v6.f32[0];
*(double *)v6.i64 = sub_10028D280();
v27.i32[0] = v6.i32[0];
*(double *)v6.i64 = sub_10028D2C0();
v35 = v6.f32[0];
sub_10028CC00(v29, 0.0, 0.0, 120.0, 50.0);
if ( (unsigned int)sub_100720070(a1->m_spriteNodes) )
{
v30 = &v32;
for ( i = 0; i < (unsigned int)sub_100720070(a1->m_spriteNodes); ++i )
{
v9 = sub_1007200C0(a1->m_spriteNodes, (unsigned int)i);
v10 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 192LL))(v9);
v29[0] = *v10 - (float)(v29[2] * 0.5);
v11 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 192LL))(v9);
v29[1] = *(float *)(v11 + 4) - (float)(v29[3] * 0.5);
v12 = sub_10028D270();
if ( *(float *)&v12 <= v38
&& (v12 = sub_10028D230(), v37 <= *(float *)&v12)
&& (v12 = sub_10028D2C0(), *(float *)&v12 <= v27.f32[0])
&& (v12 = sub_10028D280(), v35 <= *(float *)&v12) )
{
*(_BYTE *)(v9 + 368) = 1;
if ( !*(_QWORD *)(v9 + 344) )
{
if ( a1->m_loadSprites )
{
if ( (*(_BYTE *)(v9 + 320) & 1) != 0 )
{
sub_100006B70(&v31, *(const void **)(v9 + 336), *(_QWORD *)(v9 + 328), v12);
}
else
{
v32 = *(void **)(v9 + 336);
v31 = *(_OWORD *)(v9 + 320);
}
begin = a1->m_spritesLoaded.__begin_;
v19 = *(_QWORD *)&begin[8 * (i >> 6)];
if ( !_bittest64(&v19, i) )
{
*(_QWORD *)&begin[8 * (i >> 6)] = (1LL << i) | v19;
v20 = cocos2d::CCTextureCache::sharedTextureCache();
v21 = (char *)&v31 + 1;
if ( (v31 & 1) != 0 )
v21 = (const char *)v32;
cocos2d::CCTextureCache::addImageAsync(
v20,
v21,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)GJBigSprite::finishedLoadingSpriteAsync,
i,
kCCTexture2DPixelFormat_RGB888);
}
if ( (v31 & 1) != 0 )
operator delete(v32);
if ( *(_QWORD *)(v9 + 344) )
continue;
v22 = cocos2d::CCSprite::create("mapimages/image_small.png", (const cocos2d::CCRect *)(v9 + 352));
v36 = v2;
v23 = v22;
((void (__fastcall *)(cocos2d::CCSprite *, float))v22->setScaleX)(v22, a1->m_scaleX);
((void (__fastcall *)(cocos2d::CCSprite *, float))v23->setScaleY)(v23, a1->m_scaleY);
v24 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 192LL))(v9);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v23->setPosition)(v23, v24);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v23->setTag)(v23, 0xFFFFFFFFLL);
}
else
{
*(_QWORD *)&a1->m_spritesLoaded.__begin_[8 * (i >> 6)] |= 1LL << i;
v4 = (*(_BYTE *)(v9 + 320) & 1) == 0;
v36 = v2;
if ( v4 )
v17 = (const char *)(v9 + 321);
else
v17 = *(const char **)(v9 + 336);
v23 = cocos2d::CCSprite::create_1(v17);
v25 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 192LL))(v9);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v23->setPosition)(v23, v25);
((void (__fastcall *)(cocos2d::CCSprite *, float))v23->setScale)(v23, 1.002);
}
((void (__fastcall *)(GJBigSprite *, cocos2d::CCSprite *))a1->addChild)(a1, v23);
*(_QWORD *)(v9 + 344) = v23;
v2 = v36;
}
}
else
{
*(_BYTE *)(v9 + 368) = 0;
v13 = *(_QWORD *)(v9 + 344);
if ( v13 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v13 + 520LL))(v13);
*(_QWORD *)(v9 + 344) = 0;
if ( (*(_BYTE *)(v9 + 320) & 1) != 0 )
{
sub_100006B70(&v33, *(const void **)(v9 + 336), *(_QWORD *)(v9 + 328), v12);
}
else
{
v14 = v9 + 320;
__p = *(void **)(v14 + 16);
v33 = *(_OWORD *)v14;
}
v15 = cocos2d::CCTextureCache::sharedTextureCache();
v16 = (char *)&v33 + 1;
if ( (v33 & 1) != 0 )
v16 = (const char *)__p;
cocos2d::CCTextureCache::removeTextureForKey(v15, v16);
*(_QWORD *)&a1->m_spritesLoaded.__begin_[8 * (i >> 6)] &= __ROL8__(-2, i);
if ( (v33 & 1) != 0 )
operator delete(__p);
}
}
}
}
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(v2);
}
}