//
// GJBigSprite::updateSpriteVisibility from 0x97f7b8 to 0x97fc78 (1216 bytes)
//
// 5 xrefs:
// > MapSelectLayer::update @ 0x97fd3c
// > MapSelectLayer::update @ 0x97fe24
// > MapSelectLayer::ccTouchMoved @ 0x97ff48
// > MapSelectLayer::init @ 0x980604
// > ??> @ 0x92898
//
// 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 GJBigSprite::updateSpriteVisibility(GJBigSprite *a1)
{
cocos2d::CCTexture2DPixelFormat v2; // w27
float v3; // s9
float v4; // s0
float v5; // s10
cocos2d::CCDirector *v6; // x0
unsigned __int64 v7; // x21
int v8; // w23
const cocos2d::CCPoint *v9; // x0
float v10; // s0
float v11; // s9
float v12; // s0
float v13; // s10
float v14; // s0
float v15; // s11
float v16; // s0
float v17; // s13
__int64 v18; // x19
float *v19; // x0
__int64 (__fastcall *v20)(__int64); // x1
float v21; // s0
__int64 v22; // x0
char *v23; // x0
unsigned int *v24; // x2
int v25; // w1
float v26; // s0
float v27; // s0
float v28; // s0
__int64 v29; // x0
char *v30; // x2
char *v31; // x0
cocos2d::CCNode *v32; // x23
void (__fastcall *v33)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
__int64 v34; // x0
std::uintptr_t *m_bitptr; // x1
cocos2d::CCSprite *v36; // x0
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
__int64 v38; // x0
int v39; // w1
float v40; // [xsp+90h] [xbp+90h]
float v41; // [xsp+A8h] [xbp+A8h]
float v42; // [xsp+ACh] [xbp+ACh]
char *v43; // [xsp+B0h] [xbp+B0h] BYREF
cocos2d::CCRect v44; // [xsp+B8h] [xbp+B8h] BYREF
cocos2d::CCRect v45; // [xsp+C8h] [xbp+C8h] BYREF
cocos2d::CCSize WinSize; // 0:kr00_8.8
if ( !a1->m_unloadingAll )
{
v2 = cocos2d::CCTexture2D::defaultAlphaPixelFormat();
v3 = 0.0;
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGB888);
v4 = a1->getScale(a1);
v5 = v4;
if ( a1->m_loadSprites )
v3 = 10.0 / v4;
v6 = cocos2d::CCDirector::sharedDirector();
v7 = 0;
WinSize = cocos2d::CCDirector::getWinSize(v6);
v8 = 0;
v40 = (float)((float)-*(float *)((__int64 (__fastcall *)(GJBigSprite *, float, float))a1->getPosition)(
a1,
WinSize.width,
WinSize.height)
/ v5)
- v3;
v9 = a1->getPosition(a1);
cocos2d::CCRect::CCRect(
&v44,
v40,
(float)((float)-v9->y / v5) - v3,
(float)(v41 / v5) + (float)(v3 * 2.0),
(float)(v42 / v5) + (float)(v3 * 2.0));
cocos2d::CCRect::getMaxX(&v44);
v11 = v10;
cocos2d::CCRect::getMinX(&v44);
v13 = v12;
cocos2d::CCRect::getMaxY(&v44);
v15 = v14;
cocos2d::CCRect::getMinY(&v44);
v17 = v16;
cocos2d::CCRect::CCRect(&v45, 0.0, 0.0, 120.0, 50.0);
if ( (unsigned int)cocos2d::CCArray::count(a1->m_spriteNodes) )
{
do
{
v18 = cocos2d::CCArray::objectAtIndex(a1->m_spriteNodes, v7);
v19 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v18 + 192LL))(v18);
v20 = *(__int64 (__fastcall **)(__int64))(*(_QWORD *)v18 + 192LL);
v45.origin.x = *v19 - (float)(v45.size.width * 0.5);
v45.origin.y = *(float *)(v20(v18) + 4) - (float)(v45.size.height * 0.5);
cocos2d::CCRect::getMinX(&v45);
if ( v11 < v21
|| (cocos2d::CCRect::getMaxX(&v45), v13 > v26)
|| (cocos2d::CCRect::getMinY(&v45), v15 < v27)
|| (cocos2d::CCRect::getMaxY(&v45), v17 > v28) )
{
v22 = *(_QWORD *)(v18 + 328);
*(_BYTE *)(v18 + 352) = 0;
if ( v22 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v22 + 520LL))(v22);
*(_QWORD *)(v18 + 328) = 0;
sub_D18D28(&v43);
GJBigSprite::unloadSprite((__int64)a1, (const char **)&v43, v8);
v23 = v43 - 24;
if ( v43 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v43 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *((_DWORD *)v43 - 2);
*((_DWORD *)v43 - 2) = v25 - 1;
}
if ( v25 <= 0 )
{
++v7;
operator delete(v23);
goto LABEL_9;
}
}
}
}
else
{
v29 = *(_QWORD *)(v18 + 328);
*(_BYTE *)(v18 + 352) = 1;
if ( !v29 )
{
if ( !a1->m_loadSprites )
{
m_bitptr = a1->m_spritesLoaded.m_start.m_bitptr;
v36 = *(cocos2d::CCSprite **)(v18 + 320);
m_bitptr[v7 >> 6] |= 1LL << (v8 & 0x3F);
v32 = (cocos2d::CCNode *)cocos2d::CCSprite::create(v36, (const char *)m_bitptr);
setPosition = v32->setPosition;
v38 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v18 + 192LL))(v18);
setPosition(v32, (const cocos2d::CCPoint *)v38);
v32->setScale(v32, 1.002);
goto LABEL_25;
}
sub_D18D28(&v43);
GJBigSprite::loadSpriteAsync((__int64)a1, (const char **)&v43, v7);
v30 = v43;
v31 = v43 - 24;
if ( v43 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = v43 - 8;
do
v39 = __ldaxr((unsigned int *)v30);
while ( __stlxr(v39 - 1, (unsigned int *)v30) );
}
else
{
v39 = *((_DWORD *)v43 - 2);
*((_DWORD *)v43 - 2) = v39 - 1;
}
if ( v39 <= 0 )
operator delete(v31);
}
if ( !*(_QWORD *)(v18 + 328) )
{
v32 = (cocos2d::CCNode *)cocos2d::CCSprite::create(
(cocos2d::CCSprite *)"mapimages/image_small.png",
(const char *)(v18 + 336),
(const cocos2d::CCRect *)v30);
v32->setScaleX(v32, a1->m_scaleX);
v32->setScaleY(v32, a1->m_scaleY);
v33 = v32->setPosition;
v34 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v18 + 192LL))(v18);
v33(v32, (const cocos2d::CCPoint *)v34);
v32->setTag(v32, -1);
LABEL_25:
++v7;
a1->addChild(a1, v32);
*(_QWORD *)(v18 + 328) = v32;
goto LABEL_9;
}
}
}
++v7;
LABEL_9:
v8 = v7;
}
while ( (unsigned int)cocos2d::CCArray::count(a1->m_spriteNodes) > (unsigned int)v7 );
}
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(v2);
}
}