//
// cocos2d::CCSprite::setTextureRect from 0xb14db4 to 0xb15078 (708 bytes)
//
// 80 xrefs:
// > ??> @ 0x3a068
// > ??> @ 0x1136358
// > ??> @ 0x1136908
// > ??> @ 0x1137688
// > ??> @ 0x11397d8
// > ??> @ 0x1139d68
// > ??> @ 0x113cfe8
// > ??> @ 0x113d608
// > ??> @ 0x113ea38
// > ??> @ 0x1142f68
// > ??> @ 0x1143508
// > ??> @ 0x1144e58
// > ??> @ 0x11453f8
// > ??> @ 0x1149838
// > ??> @ 0x1152b48
// > ??> @ 0x1153338
// > ??> @ 0x1153918
// > ??> @ 0x11540e8
// > ??> @ 0x11548e8
// > ??> @ 0x1159b88
// > ??> @ 0x1162298
// > ??> @ 0x1162a98
// > ??> @ 0x1163298
// > ??> @ 0x1163a98
// > ??> @ 0x1164298
// > ??> @ 0x1164a98
// > ??> @ 0x1165298
// > ??> @ 0x1165a98
// > ??> @ 0x1166268
// > ??> @ 0x1166a68
// > ??> @ 0x1167268
// > ??> @ 0x1167a68
// > ??> @ 0x1168268
// > ??> @ 0x1168aa8
// > ??> @ 0x11692a8
// > ??> @ 0x1169aa8
// > ??> @ 0x116a2a8
// > ??> @ 0x116aaa8
// > ??> @ 0x116b2b8
// > ??> @ 0x116bab8
// > ??> @ 0x116c2b8
// > ??> @ 0x116cab8
// > ??> @ 0x116d2b8
// > ??> @ 0x116dab8
// > ??> @ 0x116e2b8
// > ??> @ 0x116eab8
// > ??> @ 0x116f2b8
// > ??> @ 0x116fab8
// > ??> @ 0x11702b8
// > ??> @ 0x1170ab8
// > ??> @ 0x11712b8
// > ??> @ 0x1171ab8
// > ??> @ 0x11722b8
// > ??> @ 0x1172ab8
// > ??> @ 0x11732b8
// > ??> @ 0x1173ab8
// > ??> @ 0x11742b8
// > ??> @ 0x1174ab8
// > ??> @ 0x11752b8
// > ??> @ 0x1175ab8
// > ??> @ 0x11762b8
// > ??> @ 0x1176ab8
// > ??> @ 0x11772d8
// > ??> @ 0x1179128
// > ??> @ 0x11796b8
// > ??> @ 0x1192748
// > ??> @ 0x1194438
// > ??> @ 0x11a1008
// > ??> @ 0x11a15a8
// > ??> @ 0x11aab28
// > ??> @ 0x11b04e8
// > ??> @ 0x11b27e8
// > ??> @ 0x11d9f48
// > ??> @ 0x11ed7f8
// > ??> @ 0x11f7548
// > ??> @ 0x12022e8
// > ??> @ 0x1202878
// > ??> @ 0x12033d8
// > ??> @ 0x1218988
// > ??> @ 0x1219fb8
//
// 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; // w2
cocos2d::CCSprite_vtbl *v3; // x4
float x; // s1
float y; // s5
float width; // s4
cocos2d::CCSpriteBatchNode *m_pobBatchNode; // x0
float height; // s3
float v11; // s1
float v12; // s0
float m_fBlVertexMod; // s6
float v14; // s2
float v15; // s0
float v16; // s4
float v17; // s3
float m_fTextureTop; // s16
float m_fTextureBottom; // s7
float m_fBrVertexMod; // s5
float v21; // s16
float v22; // s7
float m_fTlVertexMod; // s5
float v24; // s1
float m_fTrVertexMod; // s5
float v26; // s2
cocos2d::CCPoint v27; // [xsp+30h] [xbp+30h] BYREF
v3 = a1->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_bRectRotated = v2;
((void (__fastcall *)(cocos2d::CCSprite *))v3->setContentSize)(a1);
a1->setVertexRect(a1, a2);
a1->setTextureCoords(a1, a2);
cocos2d::CCPoint::CCPoint(&v27, &a1->m_obUnflippedOffsetPositionFromCenter);
x = v27.x;
if ( a1->m_bFlipX )
{
x = -v27.x;
v27.x = -v27.x;
}
y = v27.y;
if ( a1->m_bFlipY )
{
y = -v27.y;
v27.y = -v27.y;
}
width = a1->m_obRect.size.width;
m_pobBatchNode = a1->m_pobBatchNode;
height = a1->m_obRect.size.height;
v11 = x + (float)((float)(a1->m_obContentSize.width - width) * 0.5);
v12 = y + (float)((float)(a1->m_obContentSize.height - height) * 0.5);
a1->m_obOffsetPosition.x = v11;
a1->m_obOffsetPosition.y = v12;
if ( m_pobBatchNode )
{
a1->setDirty(a1, 1);
return;
}
m_fBlVertexMod = a1->m_fBlVertexMod;
v14 = v11 + 0.0;
v15 = v12 + 0.0;
v16 = width + (float)(v11 + 0.0);
v17 = height + v15;
if ( m_fBlVertexMod == 0.0 )
{
a1->m_sQuad.bl.vertices.z = 0.0;
m_fBrVertexMod = a1->m_fBrVertexMod;
a1->m_sQuad.bl.vertices.x = v14;
a1->m_sQuad.bl.vertices.y = v15;
if ( m_fBrVertexMod != 0.0 )
goto LABEL_10;
}
else
{
m_fTextureTop = a1->m_fTextureTop;
m_fTextureBottom = a1->m_fTextureBottom;
a1->m_sQuad.bl.vertices.z = 0.0;
m_fBrVertexMod = a1->m_fBrVertexMod;
a1->m_sQuad.bl.vertices.x = v14;
a1->m_sQuad.bl.vertices.y = v17 - (float)((float)(v17 - v15) * (float)(1.0 - m_fBlVertexMod));
a1->m_sQuad.bl.texCoords.v = m_fTextureTop
- (float)((float)(1.0 - m_fBlVertexMod) * (float)(m_fTextureTop - m_fTextureBottom));
if ( m_fBrVertexMod != 0.0 )
{
LABEL_10:
v21 = a1->m_fTextureTop;
v22 = v21 - a1->m_fTextureBottom;
a1->m_sQuad.br.vertices.x = v16;
a1->m_sQuad.br.vertices.z = 0.0;
a1->m_sQuad.br.vertices.y = v17 - (float)((float)(v17 - v15) * (float)(1.0 - m_fBrVertexMod));
a1->m_sQuad.br.texCoords.v = v21 - (float)((float)(1.0 - m_fBrVertexMod) * v22);
goto LABEL_11;
}
}
a1->m_sQuad.br.vertices.x = v16;
a1->m_sQuad.br.vertices.y = v15;
a1->m_sQuad.br.vertices.z = 0.0;
LABEL_11:
m_fTlVertexMod = a1->m_fTlVertexMod;
if ( m_fTlVertexMod != 0.0 )
{
v24 = 1.0 - m_fTlVertexMod;
a1->m_sQuad.tl.vertices.x = v14;
a1->m_sQuad.tl.vertices.z = 0.0;
a1->m_sQuad.tl.vertices.y = v15 + (float)((float)(v17 - v15) * (float)(1.0 - m_fTlVertexMod));
if ( m_fTlVertexMod >= 0.0 )
{
if ( a1->m_bRectRotated )
a1->m_sQuad.tl.texCoords.u = a1->m_fTextureLeft
+ (float)(v24 * (float)(a1->m_fTextureRight - a1->m_fTextureLeft));
else
a1->m_sQuad.tl.texCoords.v = a1->m_fTextureBottom
+ (float)(v24 * (float)(a1->m_fTextureTop - a1->m_fTextureBottom));
}
m_fTrVertexMod = a1->m_fTrVertexMod;
if ( m_fTrVertexMod != 0.0 )
goto LABEL_16;
LABEL_20:
a1->m_sQuad.tr.vertices.x = v16;
a1->m_sQuad.tr.vertices.y = v17;
a1->m_sQuad.tr.vertices.z = 0.0;
return;
}
m_fTrVertexMod = a1->m_fTrVertexMod;
a1->m_sQuad.tl.vertices.x = v14;
a1->m_sQuad.tl.vertices.y = v17;
a1->m_sQuad.tl.vertices.z = 0.0;
if ( m_fTrVertexMod == 0.0 )
goto LABEL_20;
LABEL_16:
v26 = 1.0 - m_fTrVertexMod;
a1->m_sQuad.tr.vertices.x = v16;
a1->m_sQuad.tr.vertices.z = 0.0;
a1->m_sQuad.tr.vertices.y = v15 + (float)((float)(v17 - v15) * (float)(1.0 - m_fTrVertexMod));
if ( m_fTrVertexMod >= 0.0 )
{
if ( a1->m_bRectRotated )
a1->m_sQuad.tr.texCoords.u = a1->m_fTextureLeft + (float)(v26 * (float)(a1->m_fTextureRight - a1->m_fTextureLeft));
else
a1->m_sQuad.tr.texCoords.v = a1->m_fTextureBottom
+ (float)(v26 * (float)(a1->m_fTextureTop - a1->m_fTextureBottom));
}
}