//
// GauntletSprite::addLockedSprite from 0x100394e20 to 0x10039503c (540 bytes)
//
// 3 xrefs:
// > GauntletSprite::create @ 0x10039459d
// > GauntletSprite::toggleLockedSprite @ 0x100394c12
// > GauntletSprite::init @ 0x100394d25
//
// 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 GauntletSprite::addLockedSprite(GauntletSprite *a1)
{
double v1; // xmm0_8
char *v2; // r14
size_t v3; // rax
size_t v4; // r15
char *v5; // r12
size_t v6; // r13
CCSpriteWithHue *v7; // r14
unsigned __int32 v8; // eax
float v9; // xmm0_4
__int64 v10; // rax
cocos2d::CCSprite *v11; // rbx
__int64 v12; // rax
char v13; // [rsp+0h] [rbp-60h] BYREF
char v14; // [rsp+1h] [rbp-5Fh] BYREF
char *__s; // [rsp+10h] [rbp-50h]
_QWORD __dst[2]; // [rsp+18h] [rbp-48h] BYREF
void *__p; // [rsp+28h] [rbp-38h]
float v18; // [rsp+34h] [rbp-2Ch]
GauntletNode::frameForType(&v13, (unsigned int)a1->m_gauntletType);
if ( (v13 & 1) != 0 )
v2 = __s;
else
v2 = &v14;
v3 = strlen(v2);
if ( v3 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v4 = v3;
if ( v3 >= 0x17 )
{
v6 = 26;
if ( (v3 | 7) != 0x17 )
v6 = (v3 | 7) + 1;
v5 = (char *)operator new(v6);
__p = v5;
__dst[0] = v6 | 1;
__dst[1] = v4;
goto LABEL_11;
}
LOBYTE(__dst[0]) = 2 * v3;
v5 = (char *)__dst + 1;
if ( v3 )
LABEL_11:
memmove(v5, v2, v4);
v5[v4] = 0;
v7 = (CCSpriteWithHue *)CCSpriteGrayscale::createWithSpriteFrameName(__dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
BYTE2(__dst[0]) = -1;
LOWORD(__dst[0]) = -256;
((void (__fastcall *)(CCSpriteWithHue *, _QWORD *))v7->setColor)(v7, __dst);
((void (__fastcall *)(GauntletSprite *, CCSpriteWithHue *))a1->addChild)(a1, v7);
v8 = a1->m_gauntletType - 1;
if ( v8 > 0xC )
v9 = 1.0;
else
v9 = flt_10081A4C4[v8];
CCSpriteWithHue::setLuminance(v7, v9);
v18 = *(float *)((__int64 (__fastcall *)(GauntletSprite *))a1->getContentSize)(a1);
v10 = ((__int64 (__fastcall *)(GauntletSprite *))a1->getContentSize)(a1);
sub_10028CBE0((float *)__dst, v18 * 0.5, *(float *)(v10 + 4) * 0.5);
((void (__fastcall *)(CCSpriteWithHue *, _QWORD *))v7->setPosition)(v7, __dst);
BYTE2(__dst[0]) = -31;
LOWORD(__dst[0]) = -7711;
((void (__fastcall *)(CCSpriteWithHue *, _QWORD *))v7->setColor)(v7, __dst);
v11 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletLock_001.png");
((void (__fastcall *)(CCSpriteWithHue *, cocos2d::CCSprite *, __int64))v7->addChild_0)(v7, v11, 1);
v18 = *(float *)((__int64 (__fastcall *)(CCSpriteWithHue *))v7->getContentSize)(v7);
v12 = ((__int64 (__fastcall *)(CCSpriteWithHue *))v7->getContentSize)(v7);
sub_10028CBE0((float *)__dst, v18 * 0.5, 0.5 * *(float *)(v12 + 4));
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD *))v11->setPosition)(v11, __dst);
if ( (v13 & 1) != 0 )
operator delete(__s);
}