//
// cocos2d::CCTileMapAtlas::updateAtlasValueAt from 0x5fa198 to 0x5fa384 (492 bytes)
//
// 2 xrefs:
// > cocos2d::CCTileMapAtlas::setTile @ 0x5fa42e
// > cocos2d::CCTileMapAtlas::updateAtlasValues @ 0x5fa4e0
//
// 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::CCTileMapAtlas::updateAtlasValueAt(
cocos2d::CCTileMapAtlas *a1,
const cocos2d::CCPoint *a2,
const cocos2d::ccColor3B *a3,
unsigned int a4)
{
cocos2d::ccV3F_C4B_T2F_Quad *v8; // r0
unsigned int r; // r9
unsigned int m_uItemsPerRow; // r8
int x; // r10
int y; // r7
cocos2d::ccV3F_C4B_T2F_Quad *v13; // r4
unsigned int v14; // r6
cocos2d::CCTexture2D *v15; // r0
float v16; // s20
cocos2d::CCTexture2D *v17; // r0
float v18; // s19
unsigned int m_uItemWidth; // s15
cocos2d::CCDirector *v20; // r0
float v21; // s17
float m_uItemHeight; // s16
cocos2d::CCDirector *v23; // r0
float v24; // s16
unsigned int v25; // r2
unsigned int v26; // r3
GLfloat v27; // s18
GLfloat v28; // s15
GLfloat v29; // s17
GLfloat v30; // s16
GLfloat v31; // s15
GLfloat v32; // s14
GLfloat v33; // s15
GLfloat v34; // s16
GLubyte g; // r1
GLubyte v36; // r0
cocos2d::CCTextureAtlas *m_pTextureAtlas; // r0
unsigned int v38; // r0
a1->m_pTextureAtlas->getCapacity(a1->m_pTextureAtlas);
v8 = a1->m_pTextureAtlas->getQuads(a1->m_pTextureAtlas);
r = a3->r;
m_uItemsPerRow = a1->m_uItemsPerRow;
x = (int)a2->x;
y = (int)a2->y;
v13 = &v8[a4];
v14 = a4 + 1;
v15 = a1->m_pTextureAtlas->getTexture(a1->m_pTextureAtlas);
v16 = (float)v15->getPixelsWide(v15);
v17 = a1->m_pTextureAtlas->getTexture(a1->m_pTextureAtlas);
v18 = (float)v17->getPixelsHigh(v17);
m_uItemWidth = a1->m_uItemWidth;
v20 = cocos2d::CCDirector::sharedDirector();
v21 = (float)m_uItemWidth * COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v20));
m_uItemHeight = (float)a1->m_uItemHeight;
v23 = cocos2d::CCDirector::sharedDirector();
v24 = m_uItemHeight * COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v23));
v25 = a1->m_uItemWidth;
v26 = a1->m_uItemHeight;
v27 = (float)((float)(r % m_uItemsPerRow) * v21) / v16;
v13->tl.texCoords.u = v27;
v13->bl.texCoords.u = v27;
v28 = (float)((float)(int)(r / m_uItemsPerRow) * v24) / v18;
v13->tl.texCoords.v = v28;
v13->tr.texCoords.v = v28;
v29 = v27 + (float)(v21 / v16);
v13->bl.vertices.z = 0.0;
v13->br.vertices.z = 0.0;
v30 = v28 + (float)(v24 / v18);
v13->tr.texCoords.u = v29;
v13->br.texCoords.u = v29;
v13->tl.vertices.z = 0.0;
v31 = (float)(v25 * x);
v13->bl.texCoords.v = v30;
v13->br.texCoords.v = v30;
v13->bl.vertices.x = v31;
v13->tl.vertices.x = v31;
v32 = (float)(v26 * y);
v13->tr.vertices.z = 0.0;
v33 = (float)(v26 * y + v26);
v13->bl.vertices.y = v32;
v13->br.vertices.y = v32;
v34 = (float)(v25 * x + v25);
v13->tl.vertices.y = v33;
v13->tr.vertices.y = v33;
v13->br.vertices.x = v34;
v13->tr.vertices.x = v34;
g = a1->_displayedColor.g;
LOBYTE(v25) = a1->_displayedColor.b;
LOBYTE(v26) = a1->_displayedOpacity;
v36 = a1->_displayedColor.r;
v13->tr.colors.g = g;
v13->tr.colors.b = v25;
v13->tr.colors.r = v36;
v13->tr.colors.a = v26;
v13->tl.colors.r = v36;
v13->tl.colors.g = g;
v13->tl.colors.a = v26;
v13->br.colors.g = g;
v13->br.colors.a = v26;
v13->bl.colors.g = g;
v13->bl.colors.a = v26;
v13->tl.colors.b = v25;
v13->br.colors.r = v36;
v13->br.colors.b = v25;
v13->bl.colors.r = v36;
v13->bl.colors.b = v25;
m_pTextureAtlas = a1->m_pTextureAtlas;
m_pTextureAtlas->m_bDirty = 1;
v38 = m_pTextureAtlas->getTotalQuads(m_pTextureAtlas);
if ( v14 > v38 )
cocos2d::CCTextureAtlas::increaseTotalQuadsWith(a1->m_pTextureAtlas, v14 - v38);
}