//
// GauntletSprite::addLockedSprite from 0x91daa4 to 0x91dd90 (748 bytes)
//
// 2 xrefs:
// > GauntletSprite::toggleLockedSprite @ 0x91ddc0
// > ??> @ 0x813f0
//
// 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 GauntletSprite::addLockedSprite(GauntletSprite *a1)
{
CCSpriteGrayscale *v2; // x19
void *v3; // x0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x3
float v5; // s0
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
float v7; // s8
const cocos2d::CCSize *v8; // x0
GauntletSprite *v9; // x0
GauntletType m_gauntletType; // w1
void (__fastcall *v11)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x20
cocos2d::CCSprite *v12; // x20
void (__fastcall *v13)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
float v14; // s8
__int64 v15; // x0
char *v16; // x20
unsigned int *v17; // x1
int v18; // w2
unsigned int *v19; // x19
int v20; // w0
char *v21; // [xsp+68h] [xbp+68h] BYREF
cocos2d::CCPoint v22; // [xsp+70h] [xbp+70h] BYREF
GauntletNode::frameForType(a1->m_gauntletType, (__int64)&v21);
sub_D153B8((int)&v22, v21);
v2 = CCSpriteGrayscale::createWithSpriteFrameName((const char **)&v22);
v3 = (void *)(*(_QWORD *)&v22 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v22 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(*(_QWORD *)&v22 - 8LL);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *(_DWORD *)(*(_QWORD *)&v22 - 8LL);
*(_DWORD *)(*(_QWORD *)&v22 - 8LL) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v3);
}
setColor = v2->setColor;
LOWORD(v22.x) = -256;
BYTE2(v22.x) = -1;
setColor(v2, (const cocos2d::ccColor3B *)&v22);
a1->addChild(a1, v2);
v5 = GauntletSprite::luminanceForType(a1, a1->m_gauntletType);
CCSpriteWithHue::setLuminance(v2, v5);
setPosition = v2->setPosition;
v7 = a1->getContentSize(a1)->width * 0.5;
v8 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint(&v22, v7, v8->height * 0.5);
setPosition(v2, &v22);
v9 = a1;
m_gauntletType = a1->m_gauntletType;
v11 = v2->setColor;
*(cocos2d::ccColor3B *)&v22.x = GauntletSprite::colorForType(v9, m_gauntletType);
v11(v2, (const cocos2d::ccColor3B *)&v22);
v12 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletLock_001.png");
v2->addChild_0(v2, v12, 1);
v13 = v12->setPosition;
v14 = v2->getContentSize(v2)->width * 0.5;
v15 = (__int64)v2->getContentSize(v2);
cocos2d::CCPoint::CCPoint(&v22, v14, *(float *)(v15 + 4) * 0.5);
v13(v12, &v22);
v16 = v21 - 24;
if ( v21 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(v21 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *((_DWORD *)v21 - 2);
*((_DWORD *)v21 - 2) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v16);
}
}