//
// cocos2d::CCRenderTexture::draw from 0x1003c0b58 to 0x1003c0ce4 (396 bytes)
//
// 1 xrefs:
// > ??> @ 0x100811c60
//
// 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::CCRenderTexture::draw(cocos2d::CCRenderTexture *a1)
{
GLbitfield m_uClearFlags; // w0
GLbitfield v3; // w8
cocos2d::CCArray *m_pChildren; // x8
cocos2d::ccArray *data; // x9
__int64 num; // x8
cocos2d::CCSprite **arr; // x20
unsigned __int64 v8; // x21
cocos2d::CCSprite *v9; // x0
GLint s[2]; // [xsp+0h] [xbp-40h] BYREF
GLfloat params[2]; // [xsp+8h] [xbp-38h] BYREF
__int64 v12; // [xsp+10h] [xbp-30h]
if ( !a1->m_bAutoDraw )
return;
cocos2d::CCRenderTexture::begin(a1);
m_uClearFlags = a1->m_uClearFlags;
if ( !m_uClearFlags )
goto LABEL_11;
*(_QWORD *)params = 0;
v12 = 0;
*(_QWORD *)s = 0;
if ( (m_uClearFlags & 0x4000) == 0 )
{
if ( (m_uClearFlags & 0x100) == 0 )
goto LABEL_5;
LABEL_21:
glGetFloatv(0xB73u, (GLfloat *)&s[1]);
glClearDepthf(a1->m_fClearDepth);
m_uClearFlags = a1->m_uClearFlags;
if ( (m_uClearFlags & 0x400) == 0 )
goto LABEL_7;
goto LABEL_6;
}
glGetFloatv(0xC22u, params);
glClearColor(a1->m_sClearColor.r, a1->m_sClearColor.g, a1->m_sClearColor.b, a1->m_sClearColor.a);
m_uClearFlags = a1->m_uClearFlags;
if ( (m_uClearFlags & 0x100) != 0 )
goto LABEL_21;
LABEL_5:
if ( (m_uClearFlags & 0x400) != 0 )
{
LABEL_6:
glGetIntegerv(0xB91u, s);
glClearStencil(a1->m_nClearStencil);
m_uClearFlags = a1->m_uClearFlags;
}
LABEL_7:
glClear(m_uClearFlags);
v3 = a1->m_uClearFlags;
if ( (v3 & 0x4000) != 0 )
{
glClearColor(params[0], params[1], *(GLfloat *)&v12, *((GLfloat *)&v12 + 1));
v3 = a1->m_uClearFlags;
if ( (v3 & 0x100) == 0 )
{
LABEL_9:
if ( (v3 & 0x400) == 0 )
goto LABEL_11;
goto LABEL_10;
}
}
else if ( (v3 & 0x100) == 0 )
{
goto LABEL_9;
}
glClearDepthf(*(GLclampf *)&s[1]);
if ( (a1->m_uClearFlags & 0x400) != 0 )
LABEL_10:
glClearStencil(s[0]);
LABEL_11:
((void (__fastcall *)(cocos2d::CCRenderTexture *))a1->sortAllChildren)(a1);
m_pChildren = a1->m_pChildren;
if ( m_pChildren )
{
data = m_pChildren->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (cocos2d::CCSprite **)data->arr;
v8 = (unsigned __int64)&arr[num - 1];
do
{
v9 = *arr;
if ( !*arr )
break;
if ( v9 != a1->m_pSprite )
((void (__fastcall *)(cocos2d::CCSprite *))v9->visit)(v9);
++arr;
}
while ( (unsigned __int64)arr <= v8 );
}
}
cocos2d::CCRenderTexture::end(a1);
}