//
// cocos2d::CCSprite::setTextureRect from 0x5e624c to 0x5e64aa (606 bytes)
//
// 0 xrefs:
//
// 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::CCSprite::setTextureRect(cocos2d::CCSprite *a1, const cocos2d::CCRect *a2)
{
bool v2; // r2
cocos2d::CCSpriteBatchNode *m_pobBatchNode; // r3
float width; // s12
float height; // s10
float v8; // s13
float v9; // s15
float m_fBlVertexMod; // s9
float v11; // s13
float v12; // s15
float v13; // s12
float v14; // s14
float m_fTextureTop; // s11
float v16; // s10
GLfloat v17; // s8
float v18; // s9
float m_fBrVertexMod; // s10
float v20; // s10
float v21; // s11
float m_fTlVertexMod; // s10
float v23; // s11
float m_fTrVertexMod; // s11
float v25; // s13
cocos2d::CCPoint v26; // [sp+4h] [bp-Ch] BYREF
LODWORD(v26.x) = a2;
a1->m_bRectRotated = v2;
((void (__fastcall *)(cocos2d::CCSprite *))a1->setContentSize)(a1);
a1->setVertexRect(a1, a2);
a1->setTextureCoords(a1, a2);
cocos2d::CCPoint::CCPoint(&v26, &a1->m_obUnflippedOffsetPositionFromCenter);
if ( a1->m_bFlipX )
v26.x = -v26.x;
if ( a1->m_bFlipY )
v26.y = -v26.y;
m_pobBatchNode = a1->m_pobBatchNode;
width = a1->m_obRect.size.width;
height = a1->m_obRect.size.height;
v8 = v26.x + (float)((float)(a1->m_obContentSize.width - width) * 0.5);
v9 = v26.y + (float)((float)(a1->m_obContentSize.height - height) * 0.5);
a1->m_obOffsetPosition.x = v8;
a1->m_obOffsetPosition.y = v9;
if ( m_pobBatchNode )
{
a1->setDirty(a1, 1);
}
else
{
m_fBlVertexMod = a1->m_fBlVertexMod;
v11 = v8 + 0.0;
v12 = v9 + 0.0;
v13 = v11 + width;
v14 = v12 + height;
if ( m_fBlVertexMod == 0.0 )
{
a1->m_sQuad.bl.vertices.x = v11;
a1->m_sQuad.bl.vertices.y = v12;
a1->m_sQuad.bl.vertices.z = 0.0;
}
else
{
a1->m_sQuad.bl.vertices.z = 0.0;
m_fTextureTop = a1->m_fTextureTop;
a1->m_sQuad.bl.vertices.x = v11;
v16 = 1.0 - m_fBlVertexMod;
v17 = v14 - (float)((float)(v14 - v12) * (float)(1.0 - m_fBlVertexMod));
v18 = m_fTextureTop - a1->m_fTextureBottom;
a1->m_sQuad.bl.vertices.y = v17;
a1->m_sQuad.bl.texCoords.v = m_fTextureTop - (float)(v18 * v16);
}
m_fBrVertexMod = a1->m_fBrVertexMod;
if ( m_fBrVertexMod == 0.0 )
{
a1->m_sQuad.br.vertices.x = v13;
a1->m_sQuad.br.vertices.z = 0.0;
a1->m_sQuad.br.vertices.y = v12;
}
else
{
a1->m_sQuad.br.vertices.z = 0.0;
a1->m_sQuad.br.vertices.x = v13;
v20 = 1.0 - m_fBrVertexMod;
v21 = a1->m_fTextureTop;
a1->m_sQuad.br.vertices.y = v14 - (float)((float)(v14 - v12) * v20);
a1->m_sQuad.br.texCoords.v = v21 - (float)((float)(v21 - a1->m_fTextureBottom) * v20);
}
m_fTlVertexMod = a1->m_fTlVertexMod;
if ( m_fTlVertexMod == 0.0 )
{
a1->m_sQuad.tl.vertices.x = v11;
a1->m_sQuad.tl.vertices.z = 0.0;
a1->m_sQuad.tl.vertices.y = v14;
}
else
{
a1->m_sQuad.tl.vertices.z = 0.0;
a1->m_sQuad.tl.vertices.x = v11;
v23 = 1.0 - m_fTlVertexMod;
a1->m_sQuad.tl.vertices.y = v12 + (float)((float)(v14 - v12) * (float)(1.0 - m_fTlVertexMod));
if ( m_fTlVertexMod >= 0.0 )
{
if ( a1->m_bRectRotated )
a1->m_sQuad.tl.texCoords.u = a1->m_fTextureLeft
+ (float)((float)(a1->m_fTextureRight - a1->m_fTextureLeft) * v23);
else
a1->m_sQuad.tl.texCoords.v = a1->m_fTextureBottom
+ (float)((float)(a1->m_fTextureTop - a1->m_fTextureBottom) * v23);
}
}
m_fTrVertexMod = a1->m_fTrVertexMod;
if ( m_fTrVertexMod == 0.0 )
{
a1->m_sQuad.tr.vertices.x = v13;
a1->m_sQuad.tr.vertices.z = 0.0;
a1->m_sQuad.tr.vertices.y = v14;
}
else
{
a1->m_sQuad.tr.vertices.z = 0.0;
a1->m_sQuad.tr.vertices.x = v13;
v25 = 1.0 - m_fTrVertexMod;
a1->m_sQuad.tr.vertices.y = v12 + (float)((float)(v14 - v12) * (float)(1.0 - m_fTrVertexMod));
if ( m_fTrVertexMod >= 0.0 )
{
if ( a1->m_bRectRotated )
a1->m_sQuad.tr.texCoords.u = a1->m_fTextureLeft
+ (float)((float)(a1->m_fTextureRight - a1->m_fTextureLeft) * v25);
else
a1->m_sQuad.tr.texCoords.v = a1->m_fTextureBottom
+ (float)((float)(a1->m_fTextureTop - a1->m_fTextureBottom) * v25);
}
}
}
}