//
// GJPathSprite::changeToLockedArt from 0x100301910 to 0x100301ba7 (663 bytes)
//
// 2 xrefs:
// > GJPathSprite::updateState @ 0x1002fea22
// > GJPathPage::playUnlockAnimation @ 0x100300ffd
//
// 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 GJPathSprite::changeToLockedArt(GJPathSprite *a1)
{
double v1; // xmm0_8
cocos2d::CCString *v2; // rax
const char *CString; // r15
size_t v4; // rax
size_t v5; // r14
char *v6; // r12
char *v7; // r14
size_t v8; // r13
size_t v9; // rax
size_t v10; // r15
char *v11; // r12
size_t v12; // r13
CCSpriteWithHue *v13; // r14
unsigned int v14; // eax
float v15; // xmm0_4
cocos2d::CCSprite *v16; // r14
char v17; // [rsp+0h] [rbp-70h]
unsigned __int64 v18; // [rsp+8h] [rbp-68h] BYREF
unsigned __int64 v19; // [rsp+10h] [rbp-60h] BYREF
_QWORD __dst[2]; // [rsp+18h] [rbp-58h] BYREF
char *__s; // [rsp+28h] [rbp-48h]
double v22[2]; // [rsp+30h] [rbp-40h] BYREF
void *__p; // [rsp+40h] [rbp-30h]
double v24; // 0:xmm0_8.8
v2 = (cocos2d::CCString *)sub_1007AB580("pathIcon_%02d_001.png", v17);
CString = cocos2d::CCString::getCString(v2);
v4 = strlen(CString);
if ( v4 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v5 = v4;
if ( v4 >= 0x17 )
{
v8 = 26;
if ( (v4 | 7) != 0x17 )
v8 = (v4 | 7) + 1;
v6 = (char *)operator new(v8);
__s = v6;
__dst[0] = v8 + 1;
__dst[1] = v5;
LABEL_9:
memmove(v6, CString, v5);
v6[v5] = 0;
a1->m_bDontDraw = 1;
if ( (__dst[0] & 1) != 0 )
goto LABEL_5;
goto LABEL_10;
}
LOBYTE(__dst[0]) = 2 * v4;
v6 = (char *)__dst + 1;
if ( v4 )
goto LABEL_9;
BYTE1(__dst[0]) = 0;
a1->m_bDontDraw = 1;
if ( (__dst[0] & 1) != 0 )
{
LABEL_5:
v7 = __s;
goto LABEL_11;
}
LABEL_10:
v7 = (char *)__dst + 1;
LABEL_11:
v9 = strlen(v7);
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v10 = v9;
if ( v9 >= 0x17 )
{
v12 = 26;
if ( (v9 | 7) != 0x17 )
v12 = (v9 | 7) + 1;
v11 = (char *)operator new(v12);
__p = v11;
*(_QWORD *)&v22[0] = v12 | 1;
*(_QWORD *)&v22[1] = v10;
goto LABEL_18;
}
LOBYTE(v22[0]) = 2 * v9;
v11 = (char *)v22 + 1;
if ( v9 )
LABEL_18:
memmove(v11, v7, v10);
v11[v10] = 0;
v13 = (CCSpriteWithHue *)CCSpriteGrayscale::createWithSpriteFrameName(v22);
if ( (LOBYTE(v22[0]) & 1) != 0 )
operator delete(__p);
((void (__fastcall *)(GJPathSprite *, CCSpriteWithHue *, __int64))a1->addChild_0)(a1, v13, 0xFFFFFFFFLL);
*(cocos2d::CCPoint *)&v24 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v22, (const cocos2d::CCPoint *)a1);
((void (__fastcall *)(CCSpriteWithHue *, double *, double))v13->setPosition)(v13, v22, v24);
v14 = a1->m_pathNumber - 3;
if ( v14 >= 6 )
v15 = 3.0;
else
v15 = flt_100819660[v14];
CCSpriteWithHue::setEvenLuminance(v13, v15);
memset(v22, 40, 3);
((void (__fastcall *)(CCSpriteWithHue *, double *))v13->setColor)(v13, v22);
v16 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_lockGray_001.png");
((void (__fastcall *)(GJPathSprite *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v16, 1);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v18, (const cocos2d::CCPoint *)a1);
sub_10028CBE0((float *)&v19, 0.0, 0.0);
sub_10028CCE0(v22, &v18, &v19);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v16->setPosition)(v16, v22);
((void (__fastcall *)(cocos2d::CCSprite *, float))v16->setScale)(v16, 1.0);
BYTE2(v22[0]) = -56;
LOWORD(v22[0]) = -14136;
((void (__fastcall *)(cocos2d::CCSprite *, double *))v16->setColor)(v16, v22);
if ( (__dst[0] & 1) != 0 )
operator delete(__s);
}