//
// cocos2d::CCTMXLayer::removeTileAt from 0x1800acba0 to 0x1800accee (334 bytes)
//
// 6 xrefs:
// > cocos2d::CCTMXLayer::setTileGID @ 0x1800ace6e
// > ??> @ 0x180140588
// > ??> @ 0x18014059c
// > ??> @ 0x1801405ac
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b8190
//
// 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::removeTileAt(cocos2d::CCTMXLayer *this, const struct cocos2d::CCPoint *a2)
{
float v3; // xmm0_4
const void **v4; // rdx
unsigned __int64 v5; // rsi
struct cocos2d::CCSprite *v6; // rax
cocos2d::CCArray *m_pChildren; // rcx
cocos2d::CCArray *v8; // rax
cocos2d::ccArray *data; // rcx
__int64 num; // rax
cocos2d::CCObject **arr; // rcx
cocos2d::CCObject **i; // r8
cocos2d::CCObject *v13; // rdx
unsigned int m_uAutoReleaseCount; // eax
int Key; // [rsp+40h] [rbp+8h] BYREF
v3 = (float)(*((float *)this + 90) * a2->y) + a2->x;
if ( (*(_DWORD *)(*((_QWORD *)this + 47) + 4LL * (int)v3) & 0x1FFFFFFF) != 0 )
{
v4 = *((const void ***)this + 59);
Key = (int)v3;
v5 = ((unsigned __int64)bsearch(
&Key,
v4[2],
*(unsigned int *)v4,
8u,
(_CoreCrtNonSecureSearchSortCompareFunction)CompareFunction)
- *(_QWORD *)(*((_QWORD *)this + 59) + 16LL)) >> 3;
*(_DWORD *)(*((_QWORD *)this + 47) + 4LL * (unsigned int)(int)v3) = 0;
sub_18009E360(*((_QWORD *)this + 59), (unsigned int)v5);
v6 = (struct cocos2d::CCSprite *)((__int64 (__fastcall *)(cocos2d::CCTMXLayer *, _QWORD))this->getChildByTag)(
this,
(unsigned int)(int)v3);
if ( v6 )
{
cocos2d::CCSpriteBatchNode::removeChild(this, v6, 1);
}
else
{
cocos2d::CCTextureAtlas::removeQuadAtIndex(this->m_pobTextureAtlas, v5);
m_pChildren = this->m_pChildren;
if ( m_pChildren )
{
if ( (unsigned int)cocos2d::CCArray::count(m_pChildren) )
{
v8 = this->m_pChildren;
if ( v8 )
{
data = v8->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
for ( i = &arr[num - 1]; arr <= i; ++arr )
{
v13 = *arr;
if ( !*arr )
break;
m_uAutoReleaseCount = v13[6].m_uAutoReleaseCount;
if ( m_uAutoReleaseCount >= (unsigned int)v5 )
v13[6].m_uAutoReleaseCount = m_uAutoReleaseCount - 1;
}
}
}
}
}
}
}
}