//
// cocos2d::CCTMXLayer::setupTileSprite from 0x1800ad000 to 0x1800ad26a (618 bytes)
//
// 8 xrefs:
// > cocos2d::CCTMXLayer::appendTileForGID @ 0x1800abef3
// > cocos2d::CCTMXLayer::insertTileForGID @ 0x1800ac533
// > cocos2d::CCTMXLayer::setTileGID @ 0x1800acfb4
// > cocos2d::CCTMXLayer::updateTileForGID @ 0x1800ad757
// > ??> @ 0x1801406c8
// > ??> @ 0x1801406d8
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b8238
//
// 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::setupTileSprite(
cocos2d::CCTMXLayer *this,
cocos2d::CCSprite *a2,
struct cocos2d::CCPoint a3,
int a4)
{
cocos2d::CCSprite_vtbl *v4; // rbx
struct cocos2d::CCPoint *v9; // rax
cocos2d::CCSprite_vtbl *v10; // rbx
cocos2d::CCSprite_vtbl *v11; // rbx
float *v12; // rax
cocos2d::CCSprite_vtbl *v13; // rbx
float *v14; // rax
cocos2d::CCSprite_vtbl *v15; // rdi
struct cocos2d::CCPoint *v16; // rbx
float *v17; // rax
float y; // xmm6_4
float v19; // xmm7_4
struct cocos2d::CCPoint *v20; // rbx
__int64 v21; // rax
float *v22; // rax
cocos2d::CCSprite_vtbl *v23; // rax
unsigned int v24; // ebp
float v25[4]; // [rsp+20h] [rbp-68h] BYREF
struct cocos2d::CCPoint v26; // [rsp+90h] [rbp+8h] BYREF
struct cocos2d::CCPoint v27; // [rsp+98h] [rbp+10h] BYREF
v4 = a2->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v9 = cocos2d::CCTMXLayer::positionAt(this, &v26, *(float **)&a3);
((void (__fastcall *)(cocos2d::CCSprite *, struct cocos2d::CCPoint *))v4->setPosition_0)(a2, v9);
v10 = a2->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCTMXLayer::vertexZForPos(this, *(const struct cocos2d::CCPoint **)&a3);
((void (__fastcall *)(cocos2d::CCSprite *))v10->setVertexZ)(a2);
((void (__fastcall *)(cocos2d::CCSprite *, struct cocos2d::CCSize *))a2->setAnchorPoint)(a2, &unk_1801A9AC8);
((void (__fastcall *)(cocos2d::CCRGBAProtocol *, _QWORD))a2->setOpacity)(
&a2->cocos2d::CCRGBAProtocol,
*((unsigned __int8 *)this + 440));
cocos2d::CCSprite::setFlipX(a2, 0);
cocos2d::CCSprite::setFlipY(a2, 0);
((void (__fastcall *)(cocos2d::CCSprite *))a2->setRotation)(a2);
v11 = a2->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v12 = kmVec2Fill((float *)&v26, 0.0, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, float *))v11->setAnchorPoint)(a2, v12);
if ( (a4 & 0x20000000) != 0 )
{
v13 = a2->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v14 = kmVec2Fill((float *)&v26, 0.5, 0.5);
((void (__fastcall *)(cocos2d::CCSprite *, float *))v13->setAnchorPoint)(a2, v14);
v15 = a2->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v16 = cocos2d::CCTMXLayer::positionAt(this, &v26, *(float **)&a3);
v17 = (float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a2->getContentSize)(a2);
y = v16->y;
v19 = *v17;
v20 = cocos2d::CCTMXLayer::positionAt(this, &v27, *(float **)&a3);
v21 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))a2->getContentSize)(a2);
v22 = kmVec2Fill(v25, (float)(*(float *)(v21 + 4) * 0.5) + v20->x, (float)(v19 * 0.5) + y);
((void (__fastcall *)(cocos2d::CCSprite *, float *))v15->setPosition_0)(a2, v22);
v23 = a2->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v24 = a4 & 0xC0000000;
if ( v24 == 0x80000000 || v24 == 0x40000000 )
{
((void (__fastcall *)(cocos2d::CCSprite *))v23->setRotation)(a2);
}
else
{
((void (__fastcall *)(cocos2d::CCSprite *))v23->setRotation)(a2);
cocos2d::CCSprite::setFlipX(a2, 1);
}
}
else
{
if ( a4 < 0 )
cocos2d::CCSprite::setFlipX(a2, 1);
if ( (a4 & 0x40000000) != 0 )
cocos2d::CCSprite::setFlipY(a2, 1);
}
}