//
// cocos2d::CCTMXLayer::setTileGID from 0x1800ace00 to 0x1800acffa (506 bytes)
//
// 5 xrefs:
// > cocos2d::CCTMXLayer::setTileGID @ 0x1800acdf3
// > ??> @ 0x18014050c
// > ??> @ 0x180140570
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b81e4
//
// 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::CCTMXLayer::setTileGID(__int64 a1, int a2, struct cocos2d::CCPoint *a3, int a4)
{
float v7; // xmm0_4
int v8; // ecx
unsigned int v9; // eax
int v10; // ecx
unsigned int v11; // edi
unsigned int v12; // r12d
cocos2d::CCSprite *v13; // r14
cocos2d::CCDirector *v14; // rax
float ContentScaleFactor; // xmm0_4
float v16; // xmm8_4
cocos2d::CCDirector *v17; // rax
float v18; // xmm0_4
float v19; // xmm7_4
cocos2d::CCDirector *v20; // rax
float v21; // xmm0_4
float v22; // xmm6_4
cocos2d::CCDirector *v23; // rax
float v24; // xmm0_4
cocos2d::CCRect *v25; // rax
_DWORD *v26; // rax
_DWORD *v27; // rax
float v28[2]; // [rsp+30h] [rbp-78h] BYREF
float v29[2]; // [rsp+38h] [rbp-70h] BYREF
cocos2d::CCRect v30; // [rsp+40h] [rbp-68h] BYREF
int v31; // [rsp+B0h] [rbp+8h] BYREF
v7 = (float)(*(float *)(a1 + 360) * a3->y) + a3->x;
v8 = *(_DWORD *)(*(_QWORD *)(a1 + 376) + 4LL * (int)v7);
v9 = v8 & 0xE0000000;
v10 = v8 & 0x1FFFFFFF;
if ( v10 != a2 || v9 != a4 )
{
v11 = a4 | a2;
if ( a2 )
{
if ( v10 )
{
v12 = (int)v7;
v13 = (cocos2d::CCSprite *)(*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 456LL))(
a1,
(unsigned int)(int)v7);
if ( v13 )
{
cocos2d::CCTMXTilesetInfo::rectForGID(*(struct cocos2d::CCRect **)(a1 + 384), (unsigned int)v28);
v14 = cocos2d::CCDirector::sharedDirector();
ContentScaleFactor = cocos2d::CCDirector::getContentScaleFactor(v14);
v16 = v29[1] / ContentScaleFactor;
v17 = cocos2d::CCDirector::sharedDirector();
v18 = cocos2d::CCDirector::getContentScaleFactor(v17);
v19 = v29[0] / v18;
v20 = cocos2d::CCDirector::sharedDirector();
v21 = cocos2d::CCDirector::getContentScaleFactor(v20);
v22 = v28[1] / v21;
v23 = cocos2d::CCDirector::sharedDirector();
v24 = cocos2d::CCDirector::getContentScaleFactor(v23);
v25 = cocos2d::CCRect::CCRect(&v30, v28[0] / v24, v22, v19, v16);
cocos2d::CCRect::operator=(v28, (float *)&v25->origin);
((void (__fastcall *)(cocos2d::CCSprite *, float *, _QWORD, float *))v13->setTextureRect)(v13, v28, 0, v29);
if ( a4 )
{
v26 = (_DWORD *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v13->getPosition_0)(v13);
v27 = cocos2d::cc_timeval::operator=(&v31, v26);
cocos2d::CCTMXLayer::setupTileSprite((cocos2d::CCTMXLayer *)a1, v13, (struct cocos2d::CCPoint)v27, v11);
}
*(_DWORD *)(*(_QWORD *)(a1 + 376) + 4LL * v12) = v11;
}
else
{
cocos2d::CCTMXLayer::updateTileForGID((cocos2d::CCTMXLayer *)a1, v11, a3);
}
}
else
{
cocos2d::CCTMXLayer::insertTileForGID((cocos2d::CCTMXLayer *)a1, v11, a3);
}
}
else
{
cocos2d::CCTMXLayer::removeTileAt((cocos2d::CCTMXLayer *)a1, a3);
}
}
}