//
// cocos2d::CCTMXLayer::tileAt from 0xb39a38 to 0xb39c5c (548 bytes)
//
// 1 xrefs:
// > ??> @ 0xc0c18
//
// 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
//
cocos2d::CCSprite *cocos2d::CCTMXLayer::tileAt(cocos2d::CCTMXLayer *a1, const cocos2d::CCPoint *a2)
{
unsigned int v4; // w24
unsigned int v5; // w20
cocos2d::CCSprite *v6; // x22
float x; // s10
cocos2d::CCDirector *v9; // x0
float v10; // s10
float y; // s8
cocos2d::CCDirector *v12; // x0
float v13; // s1
float width; // s9
cocos2d::CCDirector *v15; // x0
float v16; // s2
float height; // s8
cocos2d::CCDirector *v18; // x0
float ContentScaleFactor; // s0
float v20; // s0
bool (__fastcall *initWithTexture_0)(cocos2d::CCSprite *__hidden, cocos2d::CCTexture2D *, const cocos2d::CCRect *); // x26
__int64 v22; // x0
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
const cocos2d::CCPoint *v24; // x1
void (__fastcall *setVertexZ)(cocos2d::CCSprite *__hidden, float); // x23
int v26; // w0
unsigned int v27; // w0
float v28; // [xsp+70h] [xbp+70h]
float v29; // [xsp+80h] [xbp+80h]
cocos2d::CCRect v30; // [xsp+98h] [xbp+98h] BYREF
cocos2d::CCRect v31; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::CCPoint v32; // 0:kr10_8.8
v4 = cocos2d::CCTMXLayer::tileGIDAt(a1, a2);
if ( !v4 )
return nullptr;
v5 = (int)(float)(a2->x + (float)(a2->y * *(float *)(&a1->m_bManualSortAllChildrenDirty + 3)));
v6 = (cocos2d::CCSprite *)a1->getChildByTag(a1, v5);
if ( !v6 )
{
cocos2d::CCTMXTilesetInfo::rectForGID(*(cocos2d::CCTMXTilesetInfo **)&a1[1].m_uAutoReleaseCount, v4);
x = v30.origin.x;
v9 = cocos2d::CCDirector::sharedDirector();
v10 = x / cocos2d::CCDirector::getContentScaleFactor(v9);
y = v30.origin.y;
v12 = cocos2d::CCDirector::sharedDirector();
v13 = y / cocos2d::CCDirector::getContentScaleFactor(v12);
width = v30.size.width;
v28 = v13;
v15 = cocos2d::CCDirector::sharedDirector();
v16 = width / cocos2d::CCDirector::getContentScaleFactor(v15);
height = v30.size.height;
v29 = v16;
v18 = cocos2d::CCDirector::sharedDirector();
ContentScaleFactor = cocos2d::CCDirector::getContentScaleFactor(v18);
cocos2d::CCRect::CCRect(&v31, v10, v28, v29, height / ContentScaleFactor);
cocos2d::CCRect::operator=(&v30, (float *)&v31.origin);
v6 = (cocos2d::CCSprite *)operator new(0x258u);
v20 = cocos2d::CCSprite::CCSprite(v6);
initWithTexture_0 = v6->initWithTexture_0;
v22 = ((__int64 (__fastcall *)(cocos2d::CCTMXLayer *, float))a1->getTexture)(a1, v20);
initWithTexture_0(v6, (cocos2d::CCTexture2D *)v22, &v30);
v6->setBatchNode(v6, a1);
setPosition = v6->setPosition;
v32 = cocos2d::CCTMXLayer::positionAt(a1, a2);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCRect *, float, float))setPosition)(v6, &v31, v32.x, v32.y);
v24 = a2;
setVertexZ = v6->setVertexZ;
v26 = cocos2d::CCTMXLayer::vertexZForPos(a1, v24);
setVertexZ(v6, (float)v26);
v6->setAnchorPoint(v6, &stru_1247458);
v6->setOpacity(v6, LOBYTE(a1[1].m_fRotationX));
v27 = cocos2d::CCTMXLayer::atlasIndexForExistantZ(a1, v5);
cocos2d::CCSpriteBatchNode::addSpriteWithoutQuad(a1, v6, v27, v5);
cocos2d::CCObject::release(v6);
}
return v6;
}