//
// cocos2d::CCTMXLayer::setupTileSprite from 0xb391c4 to 0xb39450 (652 bytes)
//
// 5 xrefs:
// > cocos2d::CCTMXLayer::insertTileForGID @ 0xb3955c
// > cocos2d::CCTMXLayer::updateTileForGID @ 0xb39704
// > cocos2d::CCTMXLayer::appendTileForGID @ 0xb39878
// > cocos2d::CCTMXLayer::setTileGID @ 0xb39f4c
// > ??> @ 0x3add0
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void cocos2d::CCTMXLayer::setupTileSprite(
cocos2d::CCTMXLayer *a1,
cocos2d::CCSprite *a2,
cocos2d::CCPoint a3,
unsigned int a4)
{
int v4; // w3
int v5; // w22
const cocos2d::CCPoint *v7; // x24
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
void (__fastcall *setVertexZ)(cocos2d::CCSprite *__hidden, float); // x25
int v11; // w0
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
unsigned int v13; // w22
void (__fastcall *v14)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
void (__fastcall *v15)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
float *v16; // x0
long double v17; // q0
float v18; // [xsp+60h] [xbp+60h]
float v19; // [xsp+70h] [xbp+70h]
float v20; // [xsp+7Ch] [xbp+7Ch]
cocos2d::CCPoint v21; // [xsp+80h] [xbp+80h] BYREF
cocos2d::CCPoint v22; // 0:kr00_8.8
cocos2d::CCPoint v23; // 0:kr08_8.8
cocos2d::CCPoint v24; // 0:kr10_8.8
v5 = v4;
v7 = *(const cocos2d::CCPoint **)&a4;
setPosition = a2->setPosition;
v22 = cocos2d::CCTMXLayer::positionAt(a1, *(const cocos2d::CCPoint **)&a4);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCPoint *, float, float))setPosition)(a2, &v21, v22.x, v22.y);
setVertexZ = a2->setVertexZ;
v11 = cocos2d::CCTMXLayer::vertexZForPos(a1, v7);
setVertexZ(a2, (float)v11);
a2->setAnchorPoint(a2, &stru_1247458);
a2->setOpacity(a2, LOBYTE(a1[1].m_fRotationX));
cocos2d::CCSprite::setFlipX(a2, 0);
cocos2d::CCSprite::setFlipY(a2, 0);
a2->setRotation(a2, 0.0);
setAnchorPoint = a2->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v21, 0.0, 0.0);
setAnchorPoint(a2, &v21);
if ( (v5 & 0x20000000) != 0 )
{
v13 = v5 & 0xC0000000;
v14 = a2->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v21, 0.5, 0.5);
v14(a2, &v21);
v15 = a2->setPosition;
v23 = cocos2d::CCTMXLayer::positionAt(a1, v7);
v18 = v19
+ (float)(*(float *)(((__int64 (__fastcall *)(cocos2d::CCSprite *, float, float))a2->getContentSize)(
a2,
v23.x,
v23.y)
+ 4)
* 0.5);
v24 = cocos2d::CCTMXLayer::positionAt(a1, v7);
v16 = (float *)((__int64 (__fastcall *)(cocos2d::CCSprite *, float, float))a2->getContentSize)(a2, v24.x, v24.y);
cocos2d::CCPoint::CCPoint(&v21, v18, v20 + (float)(*v16 * 0.5));
v15(a2, &v21);
if ( v13 == 0x80000000 )
{
a2->setRotation(a2, 90.0);
}
else if ( v13 == 0x40000000 )
{
a2->setRotation(a2, 270.0);
}
else
{
if ( v13 == -1073741824 )
LODWORD(v17) = 1119092736;
else
LODWORD(v17) = 1132920832;
a2->setRotation(a2, v17);
cocos2d::CCSprite::setFlipX(a2, 1);
}
}
else
{
if ( (v5 & 0x80000000) == 0 )
{
if ( (v5 & 0x40000000) == 0 )
return;
LABEL_5:
cocos2d::CCSprite::setFlipY(a2, 1);
return;
}
cocos2d::CCSprite::setFlipX(a2, 1);
if ( (v5 & 0x40000000) != 0 )
goto LABEL_5;
}
}