// // cocos2d::CCDrawNode::drawPolygon from 0xada5c8 to 0xadacec (1828 bytes) // // 8 xrefs: // > HardStreak::updateStroke @ 0x825cf0 // > GJBaseGameLayer::updateDebugDraw @ 0x854e00 // > GJBaseGameLayer::updateDebugDraw @ 0x855074 // > GJBaseGameLayer::updateDebugDraw @ 0x85537c // > GJBaseGameLayer::updateDebugDraw @ 0x8553d8 // > cocos2d::CCDrawNode::drawRect @ 0xadade8 // > cocos2d::CCDrawNode::drawCircle @ 0xadb0bc // > @ 0xb7030 // // 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 // __int64 __fastcall cocos2d::CCDrawNode::drawPolygon( cocos2d::CCDrawNode *a1, float *a2, unsigned int a3, float *a4, float *a5, int a6, float a7) { float *v12; // x28 unsigned int v13; // w21 float *v14; // x26 float *v15; // x22 unsigned int v16; // w2 float v17; // s11 float v18; // s9 __int64 v19; // x1 float v20; // s13 float v21; // s8 float v22; // s8 _BOOL4 v23; // w19 __int64 m_nBufferCount; // x1 cocos2d::ccV2F_C4B_T2F *v25; // x0 float v26; // s11 float *v27; // x7 float *v28; // x6 float v29; // s13 float *p_vertices; // x1 float v31; // s12 unsigned int v32; // w5 float *v33; // x8 float *v34; // x4 float v35; // s7 float v36; // s9 float v37; // s2 float v38; // s6 float v39; // s8 float v40; // s4 float v41; // s3 char v42; // w3 char v43; // w2 float v44; // s19 float *v45; // x4 float *v46; // x2 cocos2d::ccV2F_C4B_T2F *v47; // x0 unsigned int v48; // w3 float v49; // s21 float v50; // s17 float v51; // s6 float v52; // s12 GLfloat v53; // s23 GLfloat v54; // s22 GLfloat v55; // s25 GLfloat v56; // s24 GLubyte v57; // w5 float v58; // s6 float v59; // s5 float v60; // s2 float v61; // s1 GLubyte v62; // w1 GLubyte v63; // w7 GLubyte v64; // w6 GLubyte v65; // w5 float v66; // s16 float v67; // s13 float v68; // s8 float v69; // s7 float v70; // s11 float v71; // s9 __int64 v72; // x1 float *v73; // x6 float v74; // s4 float v75; // s3 float v76; // s2 float v77; // s1 float v78; // s21 float v79; // s6 float v80; // s5 float v81; // s12 GLfloat v82; // s22 GLfloat v83; // s17 GLfloat v84; // s24 GLfloat v85; // s23 GLubyte v86; // w5 float v87; // s6 float v88; // s4 float v89; // s3 float v90; // s1 GLubyte v91; // w7 GLubyte v92; // w6 GLubyte v93; // w5 GLubyte v94; // w1 GLsizei v95; // w1 __int64 v98; // [xsp+A0h] [xbp+A0h] size_t v99; // [xsp+A0h] [xbp+A0h] float v101; // [xsp+B8h] [xbp+B8h] float v102; // [xsp+BCh] [xbp+BCh] cocos2d::CCPoint v103; // [xsp+C0h] [xbp+C0h] BYREF v98 = 16LL * a3; v12 = (float *)malloc(v98); memset(v12, 0, v98); if ( a3 ) { v99 = (size_t)a4; v13 = 0; v14 = a2; v15 = v12; do { v16 = v13 + a3 - 1; ++v13; v17 = a2[1]; a2 += 2; v15 += 4; v18 = *(a2 - 2); v19 = 2LL * (v13 % a3); v20 = v14[v19]; v21 = v14[v19 + 1]; cocos2d::CCPoint::CCPoint(&v103, -(float)(v17 - v14[2 * (v16 % a3) + 1]), v18 - v14[2 * (v16 % a3)]); cocos2d::ccpNormalize(&v103); cocos2d::CCPoint::CCPoint(&v103, -(float)(v21 - v17), v20 - v18); cocos2d::ccpNormalize(&v103); *(v15 - 2) = v101; *(v15 - 1) = v102; v22 = 1.0 / ((float)((float)(v102 * v102) + (float)(v101 * v101)) + 1.0); *(v15 - 4) = v22 * (float)(v101 + v101); *(v15 - 3) = v22 * (float)(v102 + v102); } while ( v13 != a3 ); a2 = v14; a4 = (float *)v99; } v23 = a7 > 0.0 && a5[3] > 0.0; cocos2d::CCDrawNode::ensureCapacity(a1, 3 * (3 * a3 - 2)); m_nBufferCount = a1->m_nBufferCount; v25 = &a1->m_pBuffer[m_nBufferCount]; v26 = 0.0; if ( !v23 ) v26 = 0.5; if ( a3 != 2 ) { v27 = a2 + 2; v28 = v12 + 4; v29 = v26 * *v12; p_vertices = (float *)&a1->m_pBuffer[m_nBufferCount].vertices; v31 = v26 * v12[1]; v32 = 2; do { v28 += 4; v33 = &a2[2 * v32]; v34 = &v12[4 * v32]; v35 = v27[1]; ++v32; v36 = *v27; v27 += 2; v37 = v33[1] - (float)(v26 * v34[1]); v38 = v35 - (float)(v26 * *(v28 - 3)); v39 = v36 - (float)(v26 * *(v28 - 4)); v40 = *v33 - (float)(v26 * *v34); v41 = a2[1] - v31; LOBYTE(v33) = (unsigned int)(float)(*a4 * 255.0); LOBYTE(v34) = (unsigned int)(float)(a4[1] * 255.0); v42 = (unsigned int)(float)(a4[2] * 255.0); v43 = (unsigned int)(float)(a4[3] * 255.0); *p_vertices = *a2 - v29; p_vertices += 15; *((_BYTE *)p_vertices - 52) = (_BYTE)v33; *(p_vertices - 14) = v41; *((_BYTE *)p_vertices - 51) = (_BYTE)v34; *((_BYTE *)p_vertices - 50) = v42; *((_BYTE *)p_vertices - 49) = v43; *(p_vertices - 12) = 0.0; *((_BYTE *)p_vertices - 32) = (_BYTE)v33; *(p_vertices - 11) = 0.0; *((_BYTE *)p_vertices - 31) = (_BYTE)v34; *(p_vertices - 10) = v39; *((_BYTE *)p_vertices - 30) = v42; *(p_vertices - 9) = v38; *((_BYTE *)p_vertices - 29) = v43; *(p_vertices - 7) = 0.0; *((_BYTE *)p_vertices - 12) = (_BYTE)v33; *(p_vertices - 6) = 0.0; *(p_vertices - 5) = v40; *(p_vertices - 4) = v37; *((_BYTE *)p_vertices - 11) = (_BYTE)v34; *((_BYTE *)p_vertices - 10) = v42; *((_BYTE *)p_vertices - 9) = v43; *(p_vertices - 2) = 0.0; *(p_vertices - 1) = 0.0; } while ( v32 != a3 ); v25 += 3 * a3 - 6; } v44 = -a7; if ( v23 ) { if ( a6 == 1 ) { v44 = a7 * -2.0; a7 = 0.0; } else if ( a6 == 2 ) { a7 = a7 + a7; v44 = 0.0; } } if ( a3 ) { v45 = a2; v46 = v12; v47 = v25 + 6; v48 = 0; do { while ( 1 ) { ++v48; v66 = *v45; v67 = v45[1]; v68 = v46[2]; v69 = v46[3]; v70 = *v46; v71 = v46[1]; v72 = (int)(v48 % a3); v73 = &v12[4 * v72]; v74 = a2[2 * v72]; v75 = a2[2 * v72 + 1]; v76 = *v73; v77 = v73[1]; if ( !v23 ) break; v45 += 2; v46 += 4; v47 += 6; v49 = *a5 * 255.0; v50 = a5[3] * 255.0; v51 = a5[2] * 255.0; v52 = a5[1] * 255.0; v53 = v74 + (float)(a7 * v76); v54 = v75 + (float)(a7 * v77); v55 = v66 + (float)(v44 * v70); v56 = v67 + (float)(v44 * v71); v47[-10].texCoords.u = v68; v47[-10].texCoords.v = v69; v47[-10].vertices.x = v53; v47[-10].vertices.y = v54; v47[-12].colors.r = (unsigned int)v49; v47[-11].colors.r = (unsigned int)v49; v47[-10].colors.r = (unsigned int)v49; v47[-12].colors.a = (unsigned int)v50; v57 = (unsigned int)v51; v47[-12].colors.g = (unsigned int)v52; v47[-12].colors.b = v57; v47[-11].colors.g = (unsigned int)v52; v47[-11].colors.b = v57; v47[-11].colors.a = (unsigned int)v50; v47[-10].colors.g = (unsigned int)v52; v47[-10].colors.b = v57; v47[-10].colors.a = (unsigned int)v50; v47[-11].vertices.x = v74 + (float)(v44 * v76); v47[-12].vertices.x = v55; v47[-12].vertices.y = v56; v47[-12].texCoords.u = -v68; v47[-12].texCoords.v = -v69; v47[-11].vertices.y = v75 + (float)(v44 * v77); v47[-11].texCoords.u = -v68; v47[-11].texCoords.v = -v69; v58 = *a5 * 255.0; v59 = a5[1] * 255.0; v60 = a5[2] * 255.0; v61 = a5[3] * 255.0; v47[-9].vertices.x = v55; v47[-9].vertices.y = v56; v62 = (unsigned int)v58; v63 = (unsigned int)v59; v47[-9].colors.r = v62; v47[-9].colors.g = v63; v64 = (unsigned int)v60; v47[-8].colors.r = v62; v65 = (unsigned int)v61; v47[-9].colors.b = v64; v47[-9].colors.a = v65; v47[-8].colors.g = v63; v47[-8].colors.b = v64; v47[-8].colors.a = v65; v47[-7].colors.r = v62; v47[-7].colors.g = v63; v47[-7].colors.b = v64; v47[-7].colors.a = v65; v47[-9].texCoords.u = -v68; v47[-9].texCoords.v = -v69; v47[-8].vertices.x = v66 + (float)(a7 * v70); v47[-8].vertices.y = v67 + (float)(a7 * v71); v47[-8].texCoords.u = v68; v47[-8].texCoords.v = v69; v47[-7].vertices.x = v53; v47[-7].vertices.y = v54; v47[-7].texCoords.u = v68; v47[-7].texCoords.v = v69; if ( v48 == a3 ) goto LABEL_20; } v45 += 2; v46 += 4; v47 += 6; v78 = *a4 * 255.0; v79 = a4[2] * 255.0; v80 = a4[3] * 255.0; v81 = a4[1] * 255.0; v82 = v74 + (float)(v76 * 0.5); v83 = v75 + (float)(v77 * 0.5); v84 = v66 - (float)(v70 * 0.5); v85 = v67 - (float)(v71 * 0.5); v47[-12].texCoords.u = 0.0; v47[-12].texCoords.v = 0.0; v47[-11].texCoords.u = 0.0; v47[-11].texCoords.v = 0.0; v47[-12].colors.r = (unsigned int)v78; v47[-11].colors.r = (unsigned int)v78; v47[-10].colors.r = (unsigned int)v78; v86 = (unsigned int)v79; v47[-12].colors.a = (unsigned int)v80; v47[-12].colors.b = v86; v47[-11].colors.b = v86; v47[-12].colors.g = (unsigned int)v81; v47[-11].colors.g = (unsigned int)v81; v47[-11].colors.a = (unsigned int)v80; v47[-10].colors.g = (unsigned int)v81; v47[-10].colors.b = v86; v47[-10].colors.a = (unsigned int)v80; v47[-11].vertices.x = v74 - (float)(v76 * 0.5); v47[-12].vertices.x = v84; v47[-12].vertices.y = v85; v47[-11].vertices.y = v75 - (float)(v77 * 0.5); v47[-10].vertices.x = v82; v47[-10].vertices.y = v83; v47[-10].texCoords.u = v68; v47[-10].texCoords.v = v69; v87 = *a4 * 255.0; v88 = a4[1] * 255.0; v89 = a4[2] * 255.0; v90 = a4[3] * 255.0; v47[-9].vertices.x = v84; v47[-9].vertices.y = v85; v91 = (unsigned int)v87; v92 = (unsigned int)v88; v47[-9].colors.r = v91; v47[-9].colors.g = v92; v93 = (unsigned int)v89; v47[-8].colors.r = v91; v94 = (unsigned int)v90; v47[-9].colors.b = v93; v47[-9].colors.a = v94; v47[-8].colors.g = v92; v47[-8].colors.b = v93; v47[-8].colors.a = v94; v47[-7].colors.r = v91; v47[-7].colors.g = v92; v47[-7].colors.b = v93; v47[-7].colors.a = v94; v47[-9].texCoords.u = 0.0; v47[-9].texCoords.v = 0.0; v47[-8].vertices.x = v66 + (float)(v70 * 0.5); v47[-8].vertices.y = v67 + (float)(v71 * 0.5); v47[-8].texCoords.u = v68; v47[-8].texCoords.v = v69; v47[-7].vertices.x = v82; v47[-7].vertices.y = v83; v47[-7].texCoords.u = v68; v47[-7].texCoords.v = v69; } while ( v48 != a3 ); } LABEL_20: v95 = a1->m_nBufferCount; a1->m_bDirty = 1; a1->m_nBufferCount = v95 + 3 * (3 * a3 - 2); free(v12); return 1; }
GD Web Decomp Icon

GD Web Decomp

Raw Source