//
// cocos2d::CCTMXLayer::setupTileSprite from 0x5f778c to 0x5f790e (386 bytes)
//
// 4 xrefs:
// > cocos2d::CCTMXLayer::insertTileForGID @ 0x5f79f8
// > cocos2d::CCTMXLayer::updateTileForGID @ 0x5f7b2c
// > cocos2d::CCTMXLayer::appendTileForGID @ 0x5f7c42
// > cocos2d::CCTMXLayer::setTileGID @ 0x5f812a
//
// 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 cocos2d::CCTMXLayer::setupTileSprite(
cocos2d::CCTMXLayer *a1,
cocos2d::CCSprite *a2,
cocos2d::CCPoint a3,
unsigned int a4)
{
float y; // r5
float x; // r9
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
void (__fastcall *setVertexZ)(cocos2d::CCSprite *__hidden, float); // r10
int v10; // r0
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
unsigned int v12; // r5
void (__fastcall *v13)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
void (__fastcall *v14)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
float v15; // s16
float height; // s15
float v17; // s18
const cocos2d::CCSize *v18; // r0
void (__fastcall *setRotation)(cocos2d::CCSprite *__hidden, float); // r3
int v20; // r1
int v21; // r1
cocos2d::CCPoint v22; // [sp+4h] [bp-1Ch] BYREF
cocos2d::CCPoint v23; // [sp+Ch] [bp-14h] BYREF
cocos2d::CCPoint v24; // [sp+14h] [bp-Ch] BYREF
y = a3.y;
x = a3.x;
setPosition = a2->setPosition;
cocos2d::CCTMXLayer::positionAt(&v24, a1, (const cocos2d::CCPoint *)LODWORD(a3.x));
setPosition(a2, &v24);
setVertexZ = a2->setVertexZ;
v10 = cocos2d::CCTMXLayer::vertexZForPos(a1, (const cocos2d::CCPoint *)LODWORD(x));
((void (__fastcall *)(_DWORD, _DWORD))setVertexZ)(a2, (float)v10);
a2->setAnchorPoint(a2, &stru_ACAB2C);
a2->setOpacity(a2, a1[1].m_unknown2);
cocos2d::CCSprite::setFlipX(a2, 0);
cocos2d::CCSprite::setFlipY(a2, 0);
((void (__fastcall *)(cocos2d::CCSprite *, _DWORD))a2->setRotation)(a2, 0);
setAnchorPoint = a2->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v24, 0.0, 0.0);
setAnchorPoint(a2, &v24);
if ( (LODWORD(y) & 0x20000000) != 0 )
{
v12 = LODWORD(y) & 0xC0000000;
v13 = a2->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v24, 0.5, 0.5);
v13(a2, &v24);
v14 = a2->setPosition;
cocos2d::CCTMXLayer::positionAt(&v22, a1, (const cocos2d::CCPoint *)LODWORD(x));
v15 = v22.x;
height = a2->getContentSize(a2)->height;
cocos2d::CCTMXLayer::positionAt(&v23, a1, (const cocos2d::CCPoint *)LODWORD(x));
v17 = v23.y;
v18 = a2->getContentSize(a2);
cocos2d::CCPoint::CCPoint(&v24, v15 + (float)(height * 0.5), v17 + (float)(v18->width * 0.5));
v14(a2, &v24);
setRotation = a2->setRotation;
switch ( v12 )
{
case 0x80000000:
v20 = 1119092736;
LABEL_6:
((void (__fastcall *)(cocos2d::CCSprite *, int))setRotation)(a2, v20);
return;
case 0x40000000u:
v20 = 1132920832;
goto LABEL_6;
case 0xC0000000:
v21 = 1119092736;
break;
default:
v21 = 1132920832;
break;
}
((void (__fastcall *)(cocos2d::CCSprite *, int))setRotation)(a2, v21);
cocos2d::CCSprite::setFlipX(a2, 1);
}
else
{
if ( y < 0.0 )
cocos2d::CCSprite::setFlipX(a2, 1);
if ( (LODWORD(y) & 0x40000000) != 0 )
cocos2d::CCSprite::setFlipY(a2, 1);
}
}