//
// cocos2d::CCTMXLayer::setupTileSprite from 0x100244690 to 0x100244933 (675 bytes)
//
// 5 xrefs:
// > cocos2d::CCTMXLayer::setupTiles @ 0x100244116
// > cocos2d::CCTMXLayer::appendTileForGID @ 0x100244564
// > cocos2d::CCTMXLayer::insertTileForGID @ 0x1002450f4
// > cocos2d::CCTMXLayer::updateTileForGID @ 0x1002452cf
// > cocos2d::CCTMXLayer::setTileGID @ 0x100245517
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:27:19 +0000
//
__int64 __fastcall cocos2d::CCTMXLayer::setupTileSprite(__int64 a1, __int64 *a2, float *a3, int a4)
{
int v6; // ecx
int v7; // eax
float v8; // xmm0_4
__int64 result; // rax
__int64 v10; // rax
float *v11; // rax
__int64 v12; // rax
__int64 v13; // xmm0_8
__int64 v14; // xmm0_8
float v15; // [rsp+8h] [rbp-48h] BYREF
_BYTE v16[4]; // [rsp+10h] [rbp-40h] BYREF
float v17; // [rsp+14h] [rbp-3Ch]
_BYTE v18[8]; // [rsp+18h] [rbp-38h] BYREF
float v19; // [rsp+20h] [rbp-30h]
float v20; // [rsp+24h] [rbp-2Ch]
cocos2d::CCTMXLayer::positionAt(v18, a1);
(*(void (__fastcall **)(__int64 *, _BYTE *))(*a2 + 184))(a2, v18);
if ( *(_BYTE *)(a1 + 448) == 1 )
{
v6 = *(_DWORD *)(a1 + 392);
if ( v6 )
{
v7 = 0;
if ( v6 != 2 )
goto LABEL_8;
v8 = (float)(int)(float)(*(float *)(a1 + 356) + *(float *)(a1 + 360)) - (float)(*a3 + a3[1]);
}
else
{
v8 = *(float *)(a1 + 360) - a3[1];
}
v7 = (int)(float)-v8;
}
else
{
v7 = *(_DWORD *)(a1 + 444);
}
LABEL_8:
(*(void (__fastcall **)(__int64 *, float))(*a2 + 112))(a2, (float)v7);
(*(void (__fastcall **)(__int64 *, void *))(*a2 + 296))(a2, &unk_100BE1810);
(*(void (__fastcall **)(__int64 *, _QWORD))(*a2 + 912))(a2, *(unsigned __int8 *)(a1 + 432));
cocos2d::CCSprite::setFlipX(a2, 0);
cocos2d::CCSprite::setFlipY(a2, 0);
(*(void (__fastcall **)(__int64 *, double))(*a2 + 360))(a2, 0.0);
sub_100278250(v18, 0.0, 0.0);
result = (*(__int64 (__fastcall **)(__int64 *, _BYTE *))(*a2 + 296))(a2, v18);
if ( (a4 & 0x20000000) == 0 )
{
if ( a4 < 0 )
{
result = cocos2d::CCSprite::setFlipX(a2, 1);
if ( (a4 & 0x40000000) == 0 )
return result;
}
else if ( (a4 & 0x40000000) == 0 )
{
return result;
}
return cocos2d::CCSprite::setFlipY(a2, 1);
}
sub_100278250(v18, 0.5, 0.5);
(*(void (__fastcall **)(__int64 *, _BYTE *))(*a2 + 296))(a2, v18);
cocos2d::CCTMXLayer::positionAt(&v15, a1);
v20 = v15;
v10 = (*(__int64 (__fastcall **)(__int64 *))(*a2 + 328))(a2);
v20 = (float)(*(float *)(v10 + 4) * 0.5) + v20;
cocos2d::CCTMXLayer::positionAt(v16, a1);
v19 = v17;
v11 = (float *)(*(__int64 (__fastcall **)(__int64 *))(*a2 + 328))(a2);
sub_100278250(v18, v20, (float)(0.5 * *v11) + v19);
(*(void (__fastcall **)(__int64 *, _BYTE *))(*a2 + 184))(a2, v18);
if ( (a4 & 0xC0000000) == 0x40000000 )
{
v12 = *a2;
v13 = 1132920832;
return (*(__int64 (__fastcall **)(__int64 *, double))(v12 + 360))(a2, *(double *)&v13);
}
if ( __OFSUB__(-(a4 & 0xC0000000), 1) )
{
v12 = *a2;
v13 = 1119092736;
return (*(__int64 (__fastcall **)(__int64 *, double))(v12 + 360))(a2, *(double *)&v13);
}
if ( (unsigned int)a4 < 0xC0000000 )
v14 = 1132920832;
else
v14 = 1119092736;
(*(void (__fastcall **)(__int64 *, double))(*a2 + 360))(a2, *(double *)&v14);
return cocos2d::CCSprite::setFlipX(a2, 1);
}