//
// cocos2d::CCSprite::updateTransform from 0x18008d570 to 0x18008dc89 (1817 bytes)
//
// 9 xrefs:
// > ??> @ 0x1800ebb80
// > ??> @ 0x1800ec058
// > ??> @ 0x1800ecbd8
// > ??> @ 0x180103a90
// > ??> @ 0x180106a88
// > ??> @ 0x18013d59c
// > ??> @ 0x18013d5f4
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b5eec
//
// 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 __fastcall cocos2d::CCSprite::updateTransform(cocos2d::CCSprite *this)
{
cocos2d::CCNode *m_pParent; // rbx
struct cocos2d::CCAffineTransform *v3; // rax
const struct cocos2d::CCAffineTransform *v4; // r9
cocos2d *v5; // rax
__int64 v6; // xmm0_8
__int64 v7; // rax
bool *p_m_bDontDraw; // rbx
bool v9; // zf
float x; // xmm3_4
float y; // xmm2_4
float tx; // xmm9_4
float ty; // xmm10_4
float v14; // xmm8_4
float v15; // xmm1_4
float v16; // xmm12_4
float v17; // xmm5_4
float v18; // xmm0_4
float v19; // xmm13_4
float v20; // xmm15_4
float v21; // xmm11_4
float v22; // xmm6_4
float v23; // xmm14_4
float v24; // xmm8_4
float v25; // xmm2_4
float v26; // xmm3_4
float v27; // xmm1_4
float v28; // xmm14_4
float v29; // xmm15_4
float v30; // xmm13_4
float v31; // xmm12_4
float v32; // xmm11_4
float m_fBlVertexMod; // xmm0_4
float m_fVertexZ; // xmm8_4
float v35; // xmm7_4
float v36; // xmm6_4
float m_fBrVertexMod; // xmm8_4
float v38; // xmm0_4
float v39; // xmm10_4
float v40; // xmm9_4
GLfloat v41; // xmm8_4
float v42; // xmm3_4
float m_fTlVertexMod; // xmm2_4
float v44; // xmm3_4
float v45; // xmm2_4
float m_fTrVertexMod; // xmm2_4
float v47; // xmm3_4
float v48; // xmm4_4
float v49; // xmm0_4
__int64 v50; // xmm0_8
GLfloat z; // eax
cocos2d::CCTextureAtlas *m_pobTextureAtlas; // rcx
cocos2d::CCSprite_vtbl *v53; // rax
float v54; // [rsp+24h] [rbp-F4h]
float v55; // [rsp+28h] [rbp-F0h]
float v56; // [rsp+30h] [rbp-E8h] BYREF
float v57; // [rsp+34h] [rbp-E4h]
_BYTE v58[24]; // [rsp+38h] [rbp-E0h] BYREF
_BYTE v59[24]; // [rsp+50h] [rbp-C8h] BYREF
if ( !((unsigned __int8 (__fastcall *)(cocos2d::CCSprite *))this->isDirty)(this) )
goto LABEL_41;
if ( !this->m_bVisible
|| (m_pParent = this->m_pParent) != nullptr
&& m_pParent != this->m_pobBatchNode
&& HIBYTE(m_pParent[1].m_fRotationX) )
{
p_m_bDontDraw = &this->m_bDontDraw;
*(_QWORD *)&this->m_sQuad.bl.vertices.x = 0;
this->m_sQuad.bl.vertices.z = 0.0;
this->m_bShouldBeHidden = 1;
}
else
{
this->m_bShouldBeHidden = 0;
if ( !m_pParent || m_pParent == this->m_pobBatchNode )
{
v7 = ((__int64 (__fastcall *)(cocos2d::CCSprite *, _BYTE *))this->nodeToParentTransform)(this, v58);
*(_OWORD *)&this->m_transformToBatch.a = *(_OWORD *)v7;
*(_QWORD *)&this->m_transformToBatch.tx = *(_QWORD *)(v7 + 16);
}
else
{
v3 = (struct cocos2d::CCAffineTransform *)((__int64 (__fastcall *)(cocos2d::CCSprite *, _BYTE *))this->nodeToParentTransform)(
this,
v59);
v5 = cocos2d::CCAffineTransformConcat(
(cocos2d *)v58,
v3,
(const struct cocos2d::CCAffineTransform *)&m_pParent[1].m_fRotationY,
v4);
v6 = *((_QWORD *)v5 + 2);
*(_OWORD *)&this->m_transformToBatch.a = *(_OWORD *)v5;
*(_QWORD *)&this->m_transformToBatch.tx = v6;
}
p_m_bDontDraw = &this->m_bDontDraw;
v9 = !this->m_bDontDraw;
if ( this->m_bDontDraw )
goto LABEL_37;
if ( this->_realOpacity )
{
cocos2d::cc_timeval::operator=(&v56, &this->m_obRect.size);
x = this->m_obOffsetPosition.x;
y = this->m_obOffsetPosition.y;
tx = this->m_transformToBatch.tx;
ty = this->m_transformToBatch.ty;
v14 = -this->m_transformToBatch.c;
v15 = this->m_transformToBatch.d * y;
v16 = this->m_transformToBatch.a * x;
v17 = this->m_transformToBatch.b * x;
v18 = v14 * y;
v19 = this->m_transformToBatch.a * (float)(v56 + x);
v20 = v17 + v15;
v21 = this->m_transformToBatch.d * (float)(v57 + y);
v22 = this->m_transformToBatch.b * (float)(v56 + x);
v23 = v16 - (float)(v14 * y);
v24 = v14 * (float)(v57 + y);
v25 = (float)(v19 - v18) + tx;
v26 = (float)(v22 + v15) + ty;
v27 = (float)(v21 + v22) + ty;
v28 = v23 + tx;
v54 = v25;
v29 = v20 + ty;
v55 = v26;
v30 = (float)(v19 - v24) + tx;
v31 = (float)(v16 - v24) + tx;
v32 = (float)(v21 + v17) + ty;
if ( this->m_bUseVertexMod )
{
m_fBlVertexMod = this->m_fBlVertexMod;
m_fVertexZ = this->m_fVertexZ;
v35 = v31 - v28;
v36 = v32 - v29;
if ( m_fBlVertexMod == 0.0 )
{
this->m_sQuad.bl.vertices.x = v28;
this->m_sQuad.bl.vertices.y = v29;
this->m_sQuad.bl.vertices.z = m_fVertexZ;
}
else
{
this->m_sQuad.bl.vertices.x = v31 - (float)(v35 * (float)(1.0 - m_fBlVertexMod));
this->m_sQuad.bl.vertices.y = v32 - (float)((float)(1.0 - m_fBlVertexMod) * v36);
this->m_sQuad.bl.vertices.z = m_fVertexZ;
this->m_sQuad.bl.texCoords.v = this->m_fTextureTop
- (float)((float)(this->m_fTextureTop - this->m_fTextureBottom)
* (float)(1.0 - m_fBlVertexMod));
}
m_fBrVertexMod = this->m_fBrVertexMod;
v38 = this->m_fVertexZ;
v39 = v30 - v25;
v56 = v38;
v40 = v27 - v26;
if ( m_fBrVertexMod == 0.0 )
{
v41 = v27;
this->m_sQuad.br.vertices.x = v25;
this->m_sQuad.br.vertices.y = v26;
this->m_sQuad.br.vertices.z = v38;
}
else
{
v42 = 1.0 - m_fBrVertexMod;
v41 = v27;
this->m_sQuad.br.vertices.x = v30 - (float)(v39 * v42);
this->m_sQuad.br.vertices.y = v27 - (float)(v40 * v42);
this->m_sQuad.br.vertices.z = v56;
this->m_sQuad.br.texCoords.v = this->m_fTextureTop
- (float)((float)(this->m_fTextureTop - this->m_fTextureBottom) * v42);
}
m_fTlVertexMod = this->m_fTlVertexMod;
v44 = this->m_fVertexZ;
if ( m_fTlVertexMod == 0.0 )
{
this->m_sQuad.tl.vertices.x = v31;
this->m_sQuad.tl.vertices.y = v32;
this->m_sQuad.tl.vertices.z = v44;
}
else
{
this->m_sQuad.tl.vertices.x = (float)((float)(1.0 - m_fTlVertexMod) * v35) + v28;
this->m_sQuad.tl.vertices.y = (float)((float)(1.0 - m_fTlVertexMod) * v36) + v29;
this->m_sQuad.tl.vertices.z = v44;
if ( m_fTlVertexMod >= 0.0 )
{
v45 = 1.0 - this->m_fTlVertexMod;
if ( this->m_bRectRotated )
this->m_sQuad.tl.texCoords.u = (float)((float)(this->m_fTextureRight - this->m_fTextureLeft) * v45)
+ this->m_fTextureLeft;
else
this->m_sQuad.tl.texCoords.v = (float)((float)(this->m_fTextureTop - this->m_fTextureBottom) * v45)
+ this->m_fTextureBottom;
}
}
m_fTrVertexMod = this->m_fTrVertexMod;
v47 = this->m_fVertexZ;
if ( m_fTrVertexMod == 0.0 )
{
this->m_sQuad.tr.vertices.x = v30;
this->m_sQuad.tr.vertices.y = v41;
this->m_sQuad.tr.vertices.z = v47;
}
else
{
this->m_sQuad.tr.vertices.x = (float)((float)(1.0 - m_fTrVertexMod) * v39) + v54;
this->m_sQuad.tr.vertices.y = (float)((float)(1.0 - m_fTrVertexMod) * v40) + v55;
this->m_sQuad.tr.vertices.z = v47;
if ( m_fTrVertexMod >= 0.0 )
{
v48 = 1.0 - this->m_fTrVertexMod;
if ( this->m_bRectRotated )
this->m_sQuad.tr.texCoords.u = (float)((float)(this->m_fTextureRight - this->m_fTextureLeft) * v48)
+ this->m_fTextureLeft;
else
this->m_sQuad.tr.texCoords.v = (float)((float)(this->m_fTextureTop - this->m_fTextureBottom) * v48)
+ this->m_fTextureBottom;
}
}
}
else
{
v49 = this->m_fVertexZ;
this->m_sQuad.bl.vertices.x = v28;
this->m_sQuad.bl.vertices.y = v29;
this->m_sQuad.bl.vertices.z = v49;
this->m_sQuad.br.vertices.x = v25;
this->m_sQuad.br.vertices.y = v26;
this->m_sQuad.br.vertices.z = v49;
this->m_sQuad.tl.vertices.x = v31;
this->m_sQuad.tl.vertices.y = v32;
this->m_sQuad.tl.vertices.z = v49;
this->m_sQuad.tr.vertices.x = v30;
this->m_sQuad.tr.vertices.y = v27;
this->m_sQuad.tr.vertices.z = v49;
}
goto LABEL_36;
}
*(_QWORD *)&this->m_sQuad.bl.vertices.x = 0;
this->m_sQuad.bl.vertices.z = 0.0;
}
v50 = *(_QWORD *)&this->m_sQuad.bl.vertices.x;
z = this->m_sQuad.bl.vertices.z;
*(_QWORD *)&this->m_sQuad.tr.vertices.x = v50;
*(_QWORD *)&this->m_sQuad.tl.vertices.x = v50;
*(_QWORD *)&this->m_sQuad.br.vertices.x = v50;
this->m_sQuad.tr.vertices.z = z;
this->m_sQuad.tl.vertices.z = z;
this->m_sQuad.br.vertices.z = z;
LABEL_36:
v9 = !*p_m_bDontDraw;
LABEL_37:
if ( v9 )
{
m_pobTextureAtlas = this->m_pobTextureAtlas;
if ( m_pobTextureAtlas )
cocos2d::CCTextureAtlas::updateQuad(m_pobTextureAtlas, &this->m_sQuad, this->m_uAtlasIndex);
}
v53 = this->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
this->m_bRecursiveDirty = 0;
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))v53->setDirty)(this, 0);
LABEL_41:
cocos2d::CCNode::updateTransform(this);
}