//
// cocos2d::CCTMXLayer::updateTileForGID from 0x1800ad690 to 0x1800ad7e0 (336 bytes)
//
// 3 xrefs:
// > cocos2d::CCTMXLayer::setTileGID @ 0x1800acfd0
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b828c
//
// 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
//
struct cocos2d::CCSprite *__fastcall cocos2d::CCTMXLayer::updateTileForGID(
cocos2d::CCTMXLayer *this,
int a2,
struct cocos2d::CCPoint *a3)
{
cocos2d::CCRect *v6; // rax
float v7; // xmm0_4
struct cocos2d::CCRect *v8; // rax
cocos2d::CCSprite *v9; // rbx
_DWORD *v10; // rax
const void **v11; // rdx
void *v12; // rax
__int64 v13; // rdx
struct cocos2d::CCRect v15; // [rsp+30h] [rbp-38h] BYREF
cocos2d::CCRect v16; // [rsp+40h] [rbp-28h] BYREF
int v17; // [rsp+70h] [rbp+8h] BYREF
int Key; // [rsp+78h] [rbp+10h] BYREF
cocos2d::CCTMXTilesetInfo::rectForGID(*((struct cocos2d::CCRect **)this + 48), (unsigned int)&v15);
v6 = cocos2d::CCRect::CCRect(
&v16,
v15.origin.x / *((float *)this + 120),
v15.origin.y / *((float *)this + 120),
v15.size.width / *((float *)this + 120),
v15.size.height / *((float *)this + 120));
cocos2d::CCRect::operator=((float *)&v15.origin, (float *)&v6->origin);
v7 = (float)(*((float *)this + 90) * a3->y) + a3->x;
v8 = cocos2d::CCRect::CCRect(&v16, &v15);
v9 = (cocos2d::CCSprite *)cocos2d::CCTMXLayer::reusedTileWithRect(this, v8);
v10 = cocos2d::cc_timeval::operator=(&v17, a3);
cocos2d::CCTMXLayer::setupTileSprite(this, v9, (struct cocos2d::CCPoint)v10, a2);
v11 = *((const void ***)this + 59);
Key = (int)v7;
v12 = bsearch(&Key, v11[2], *(unsigned int *)v11, 8u, (_CoreCrtNonSecureSearchSortCompareFunction)CompareFunction);
LOBYTE(v13) = 1;
v9->m_uAtlasIndex = ((unsigned __int64)v12 - *(_QWORD *)(*((_QWORD *)this + 59) + 16LL)) >> 3;
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v9->setDirty)(v9, v13);
((void (__fastcall *)(cocos2d::CCSprite *))v9->updateTransform)(v9);
*(_DWORD *)(*((_QWORD *)this + 47) + 4LL * (int)v7) = a2;
return v9;
}