//
// cocos2d::CCTMXLayer::setupTileSprite from 0x10025a700 to 0x10025a9a3 (675 bytes)
//
// 5 xrefs:
// > cocos2d::CCTMXLayer::setupTiles @ 0x10025a186
// > cocos2d::CCTMXLayer::appendTileForGID @ 0x10025a5d4
// > cocos2d::CCTMXLayer::insertTileForGID @ 0x10025b164
// > cocos2d::CCTMXLayer::updateTileForGID @ 0x10025b33f
// > cocos2d::CCTMXLayer::setTileGID @ 0x10025b587
//
// 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 __fastcall cocos2d::CCTMXLayer::setupTileSprite(
cocos2d::CCTMXLayer *a1,
cocos2d::CCSprite *a2,
cocos2d::CCPoint a3,
unsigned int a4)
{
int v4; // ecx
int v5; // r14d
float *v6; // r15
int m_uIndexInArray; // ecx
int m_fSkewX_low; // eax
float v9; // xmm0_4
__int64 v10; // rax
float *v11; // rax
cocos2d::CCSprite_vtbl *v12; // rax
__int64 v13; // xmm0_8
__int64 v14; // xmm0_8
float v15; // [rsp+8h] [rbp-48h] BYREF
char v16; // [rsp+10h] [rbp-40h] BYREF
float v17; // [rsp+14h] [rbp-3Ch]
char v18; // [rsp+18h] [rbp-38h] BYREF
float v19; // [rsp+20h] [rbp-30h]
float v20; // [rsp+24h] [rbp-2Ch]
double v21; // 0:xmm0_8.8
v5 = v4;
v6 = *(float **)&a4;
*(cocos2d::CCPoint *)&v21 = cocos2d::CCTMXLayer::positionAt((cocos2d::CCTMXLayer *)&v18, (const cocos2d::CCPoint *)a1);
((void (__fastcall *)(cocos2d::CCSprite *, char *, double))a2->setPosition)(a2, &v18, v21);
if ( LOBYTE(a1[1].m_fSkewY) == 1 )
{
m_uIndexInArray = a1[1].m_uIndexInArray;
if ( m_uIndexInArray )
{
m_fSkewX_low = 0;
if ( m_uIndexInArray != 2 )
goto LABEL_8;
v9 = (float)(int)(float)(*(float *)(&a1->m_bManualSortAllChildrenDirty + 3)
+ *(float *)&a1[1].cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable)
- (float)(*v6 + v6[1]);
}
else
{
v9 = *(float *)&a1[1].cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable
- v6[1];
}
m_fSkewX_low = (int)(float)-v9;
}
else
{
m_fSkewX_low = LODWORD(a1[1].m_fSkewX);
}
LABEL_8:
((void (__fastcall *)(cocos2d::CCSprite *, float))a2->setVertexZ)(a2, (float)m_fSkewX_low);
((void (__fastcall *)(cocos2d::CCSprite *, void *))a2->setAnchorPoint)(a2, &unk_10099F598);
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))a2->setOpacity)(a2, LOBYTE(a1[1].m_fVertexZ));
cocos2d::CCSprite::setFlipX(a2, 0);
cocos2d::CCSprite::setFlipY(a2, 0);
((void (__fastcall *)(cocos2d::CCSprite *, double))a2->setRotation)(a2, 0.0);
sub_10028CBE0(&v18, 0.0, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, char *))a2->setAnchorPoint)(a2, &v18);
if ( (v5 & 0x20000000) == 0 )
{
if ( v5 < 0 )
{
cocos2d::CCSprite::setFlipX(a2, 1);
if ( (v5 & 0x40000000) == 0 )
return;
}
else if ( (v5 & 0x40000000) == 0 )
{
return;
}
cocos2d::CCSprite::setFlipY(a2, 1);
return;
}
sub_10028CBE0(&v18, 0.5, 0.5);
((void (__fastcall *)(cocos2d::CCSprite *, char *))a2->setAnchorPoint)(a2, &v18);
cocos2d::CCTMXLayer::positionAt((cocos2d::CCTMXLayer *)&v15, (const cocos2d::CCPoint *)a1);
v20 = v15;
v10 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))a2->getContentSize)(a2);
v20 = (float)(*(float *)(v10 + 4) * 0.5) + v20;
cocos2d::CCTMXLayer::positionAt((cocos2d::CCTMXLayer *)&v16, (const cocos2d::CCPoint *)a1);
v19 = v17;
v11 = (float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a2->getContentSize)(a2);
sub_10028CBE0(&v18, v20, (float)(0.5 * *v11) + v19);
((void (__fastcall *)(cocos2d::CCSprite *, char *))a2->setPosition)(a2, &v18);
if ( (v5 & 0xC0000000) == 0x40000000 )
{
v12 = a2->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v13 = 1132920832;
goto LABEL_18;
}
if ( __OFSUB__(-(v5 & 0xC0000000), 1) )
{
v12 = a2->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v13 = 1119092736;
LABEL_18:
((void (__fastcall *)(cocos2d::CCSprite *, double))v12->setRotation)(a2, *(double *)&v13);
return;
}
if ( (unsigned int)v5 < 0xC0000000 )
v14 = 1132920832;
else
v14 = 1119092736;
((void (__fastcall *)(cocos2d::CCSprite *, double))a2->setRotation)(a2, *(double *)&v14);
cocos2d::CCSprite::setFlipX(a2, 1);
}