//
// GJBigSprite::updateSpriteVisibility from 0x50ee38 to 0x50f110 (728 bytes)
//
// 4 xrefs:
// > MapSelectLayer::update @ 0x50f18e
// > MapSelectLayer::update @ 0x50f1e4
// > MapSelectLayer::ccTouchMoved @ 0x50f2ee
// > MapSelectLayer::init @ 0x50f792
//
// 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; // r10
float v3; // r0
float v4; // s18
float v5; // s16
cocos2d::CCDirector *v6; // r0
unsigned int v7; // r7
float x; // s17
const cocos2d::CCPoint *v9; // r0
float v10; // s17
float v11; // s18
float v12; // s19
float v13; // s20
int v14; // r5
float *v15; // r0
int (__fastcall *v16)(int); // r3
int v17; // r0
int v18; // r0
int v19; // r2
const cocos2d::CCRect *v20; // r2
cocos2d::CCNode *v21; // r6
int v22; // r0
cocos2d::CCSprite *v23; // r0
int v24; // r0
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+Ch] [bp-38h]
void (__fastcall *v26)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+Ch] [bp-38h]
const char *v27; // [sp+10h] [bp-34h] BYREF
cocos2d::CCSize v28; // [sp+14h] [bp-30h] BYREF
cocos2d::CCRect v29; // [sp+1Ch] [bp-28h] BYREF
cocos2d::CCRect v30; // [sp+2Ch] [bp-18h] BYREF
if ( !a1->m_unloadingAll )
{
v2 = cocos2d::CCTexture2D::defaultAlphaPixelFormat();
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGB888);
v3 = COERCE_FLOAT(((int (__fastcall *)(GJBigSprite *))a1->getScale)(a1));
v4 = v3;
if ( a1->m_loadSprites )
v5 = 10.0 / v3;
else
v5 = 0.0;
v6 = cocos2d::CCDirector::sharedDirector();
v7 = 0;
cocos2d::CCDirector::getWinSize(&v28, v6);
x = a1->getPosition(a1)->x;
v9 = a1->getPosition(a1);
cocos2d::CCRect::CCRect(
&v29,
(float)((float)-x / v4) - v5,
(float)((float)-v9->y / v4) - v5,
(float)(v28.width / v4) + (float)(v5 + v5),
(float)(v28.height / v4) + (float)(v5 + v5));
v10 = COERCE_FLOAT(cocos2d::CCRect::getMaxX(&v29));
v11 = COERCE_FLOAT(cocos2d::CCRect::getMinX(&v29));
v12 = COERCE_FLOAT(cocos2d::CCRect::getMaxY(&v29));
v13 = COERCE_FLOAT(cocos2d::CCRect::getMinY(&v29));
cocos2d::CCRect::CCRect(&v30, 0.0, 0.0, 120.0, 50.0);
while ( 1 )
{
if ( v7 >= cocos2d::CCArray::count(a1->m_spriteNodes) )
{
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(v2);
return;
}
v14 = cocos2d::CCArray::objectAtIndex(a1->m_spriteNodes, v7);
v15 = (float *)(*(int (__fastcall **)(int))(*(_DWORD *)v14 + 96))(v14);
v16 = *(int (__fastcall **)(int))(*(_DWORD *)v14 + 96);
v30.origin.x = *v15 - (float)(v30.size.width * 0.5);
v17 = v16(v14);
v30.origin.y = *(float *)(v17 + 4) - (float)(v30.size.height * 0.5);
if ( v10 < COERCE_FLOAT(cocos2d::CCRect::getMinX(&v30))
|| COERCE_FLOAT(cocos2d::CCRect::getMaxX(&v30)) < v11
|| v12 < COERCE_FLOAT(cocos2d::CCRect::getMinY(&v30))
|| COERCE_FLOAT(cocos2d::CCRect::getMaxY(&v30)) < v13 )
{
v18 = *(_DWORD *)(v14 + 268);
*(_BYTE *)(v14 + 288) = 0;
if ( v18 )
{
(*(void (__fastcall **)(int))(*(_DWORD *)v18 + 260))(v18);
*(_DWORD *)(v14 + 268) = 0;
sub_775C20(&v27);
GJBigSprite::unloadSprite((int)a1, &v27, v7);
sub_774008(&v27);
}
}
else
{
v19 = *(_DWORD *)(v14 + 268);
*(_BYTE *)(v14 + 288) = 1;
if ( v19 )
goto LABEL_15;
if ( a1->m_loadSprites )
{
sub_775C20(&v27);
GJBigSprite::loadSpriteAsync(a1, &v27, v7);
sub_774008(&v27);
if ( *(_DWORD *)(v14 + 268) )
goto LABEL_15;
v21 = (cocos2d::CCNode *)cocos2d::CCSprite::create(
(cocos2d::CCSprite *)"mapimages/image_small.png",
(const char *)(v14 + 272),
v20);
((void (__fastcall *)(cocos2d::CCNode *, _DWORD))v21->setScaleX)(v21, LODWORD(a1->m_scaleX));
((void (__fastcall *)(cocos2d::CCNode *, _DWORD))v21->setScaleY)(v21, LODWORD(a1->m_scaleY));
setPosition = v21->setPosition;
v22 = (*(int (__fastcall **)(int))(*(_DWORD *)v14 + 96))(v14);
setPosition(v21, (const cocos2d::CCPoint *)v22);
v21->setTag(v21, -1);
}
else
{
v23 = *(cocos2d::CCSprite **)(v14 + 264);
a1->m_spritesLoaded.m_start.m_bitptr[v7 >> 5] |= 1 << (v7 & 0x1F);
v21 = (cocos2d::CCNode *)cocos2d::CCSprite::create(v23, (const char *)(v7 >> 5));
v26 = v21->setPosition;
v24 = (*(int (__fastcall **)(int))(*(_DWORD *)v14 + 96))(v14);
v26(v21, (const cocos2d::CCPoint *)v24);
((void (__fastcall *)(cocos2d::CCNode *, int))v21->setScale)(v21, 1065369993);
}
a1->addChild(a1, v21);
*(_DWORD *)(v14 + 268) = v21;
}
LABEL_15:
++v7;
}
}
}