//
// GJPathSprite::addShardSprite from 0xa6e5e4 to 0xa6e8c8 (740 bytes)
//
// 3 xrefs:
// > GJPathPage::unlockAnimationStep3 @ 0xa6e974
// > GJPathSprite::updateState @ 0xa6eee8
// > ??> @ 0xab4e0
//
// 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 GJPathSprite::addShardSprite(GJPathSprite *a1)
{
char *v2; // x0
cocos2d::CCSprite *v3; // x19
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
char *p_m_fBrVertexMod; // x0
unsigned int *p_m_fTextureTop; // x19
int m_fTextureTop_low; // w1
unsigned int *v8; // x19
int v9; // w1
cocos2d::CCSprite *v10; // [xsp+58h] [xbp+58h] BYREF
cocos2d::CCPoint v11; // [xsp+60h] [xbp+60h] BYREF
_BYTE v12[8]; // [xsp+68h] [xbp+68h] BYREF
__int64 v13; // [xsp+70h] [xbp+70h] BYREF
v10 = (cocos2d::CCSprite *)&byte_124B6C8;
cocos2d::CCPoint::CCPoint(&v11, 0.0, 1.0);
switch ( a1->m_pathNumber )
{
case 1:
sub_D1798C(&v10, "fireShardBig_001.png", 20);
goto LABEL_6;
case 2:
sub_D1798C(&v10, "iceShardBig_001.png", 19);
goto LABEL_6;
case 3:
sub_D1798C(&v10, "poisonShardBig_001.png", 22);
goto LABEL_6;
case 4:
sub_D1798C(&v10, "shadowShardBig_001.png", 22);
goto LABEL_6;
case 5:
sub_D1798C(&v10, "lavaShardBig_001.png", 20);
goto LABEL_6;
case 6:
sub_D1798C(&v10, "shard0201ShardBig_001.png", 25);
goto LABEL_6;
case 7:
sub_D1798C(&v10, "shard0202ShardBig_001.png", 25);
goto LABEL_6;
case 8:
sub_D1798C(&v10, "shard0203ShardBig_001.png", 25);
goto LABEL_6;
case 9:
sub_D1798C(&v10, "shard0204ShardBig_001.png", 25);
goto LABEL_6;
case 0xA:
sub_D1798C(&v10, "shard0205ShardBig_001.png", 25);
LABEL_6:
v3 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v10);
a1->addChild_0(a1, v3, 1);
v3->setScale(v3, 0.55);
setPosition = v3->setPosition;
cocos2d::CCNode::convertToNodeSpace(a1, &stru_1244548);
cocos2d::CCPoint::operator+(&v13, v12, &v11);
setPosition(v3, (const cocos2d::CCPoint *)&v13);
p_m_fBrVertexMod = (char *)&v10[-1].m_fBrVertexMod;
if ( (__int64 *)&v10[-1].m_fBrVertexMod != &qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_fTextureTop = (unsigned int *)&v10[-1].m_fTextureTop;
do
m_fTextureTop_low = __ldaxr(p_m_fTextureTop);
while ( __stlxr(m_fTextureTop_low - 1, p_m_fTextureTop) );
}
else
{
m_fTextureTop_low = LODWORD(v10[-1].m_fTextureTop);
LODWORD(v10[-1].m_fTextureTop) = m_fTextureTop_low - 1;
}
if ( m_fTextureTop_low <= 0 )
operator delete(p_m_fBrVertexMod);
}
break;
default:
v2 = (char *)&v10[-1].m_fBrVertexMod;
if ( (__int64 *)&v10[-1].m_fBrVertexMod != &qword_124B6B0 )
{
if ( &pthread_create )
{
v8 = (unsigned int *)&v10[-1].m_fTextureTop;
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 - 1, v8) );
}
else
{
v9 = LODWORD(v10[-1].m_fTextureTop);
LODWORD(v10[-1].m_fTextureTop) = v9 - 1;
}
if ( v9 <= 0 )
operator delete(v2);
}
break;
}
}