//
// cocos2d::CCTileMapAtlas::setTile from 0x10022cf60 to 0x10022d0b3 (339 bytes)
//
// 0 xrefs:
//
// 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 cocos2d::CCTileMapAtlas::setTile(
cocos2d::CCTileMapAtlas *a1,
const cocos2d::ccColor3B *a2,
const cocos2d::CCPoint *a3)
{
double v3; // xmm0_8
cocos2d::sImageTGA *m_pTGAInfo; // rax
float width; // xmm0_4
unsigned __int8 *imageData; // rax
__int64 v7; // rcx
cocos2d::CCTileMapAtlas *v9; // r14
cocos2d::CCString *v10; // rax
const char *CString; // r12
size_t v12; // rax
size_t v13; // r13
char *v14; // r15
size_t v15; // r14
__int64 v16; // r15
char v17; // [rsp+0h] [rbp-60h]
cocos2d::CCDictionary *m_pPosToAtlasIndex; // [rsp+8h] [rbp-58h]
_QWORD __dst[2]; // [rsp+20h] [rbp-40h] BYREF
void *__p; // [rsp+30h] [rbp-30h]
m_pTGAInfo = a1->m_pTGAInfo;
width = (float)m_pTGAInfo->width;
imageData = m_pTGAInfo->imageData;
*(float *)&v3 = (float)(width * a3->y) + a3->x;
v7 = 3LL * (unsigned int)(int)*(float *)&v3;
if ( !imageData[v7] )
return;
v9 = a1;
*(cocos2d::ccColor3B *)&imageData[v7] = *a2;
m_pPosToAtlasIndex = a1->m_pPosToAtlasIndex;
v10 = (cocos2d::CCString *)sub_1007AB580("%ld,%ld", v17);
CString = cocos2d::CCString::getCString(v10);
v12 = strlen(CString);
if ( v12 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v3);
v13 = v12;
if ( v12 >= 0x17 )
{
v15 = 26;
if ( (v12 | 7) != 0x17 )
v15 = (v12 | 7) + 1;
v14 = (char *)operator new(v15);
__p = v14;
__dst[0] = v15 + 1;
v9 = a1;
__dst[1] = v13;
}
else
{
LOBYTE(__dst[0]) = 2 * v12;
v14 = (char *)__dst + 1;
if ( !v12 )
goto LABEL_10;
}
memmove(v14, CString, v13);
LABEL_10:
v14[v13] = 0;
v16 = cocos2d::CCDictionary::objectForKey_1(m_pPosToAtlasIndex, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
cocos2d::CCTileMapAtlas::updateAtlasValueAt(v9, a3, a2, *(_DWORD *)(v16 + 56));
}