// // LevelTools::timeForPos from 0x606adc to 0x6078c0 (3556 bytes) // // 4 xrefs: // > PlayLayer::timeForPos @ 0x5c90e0 // > DrawGridLayer::draw @ 0x667188 // > DrawGridLayer::timeForPos @ 0x667324 // > @ 0x30c18 // // 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 // // local variable allocation has failed, the output may be wrong! float LevelTools::timeForPos( cocos2d::CCPoint a1, cocos2d::CCArray *a2, int a3, int a4, int a5, bool a6, bool a7, bool a8, bool a9, int a10) { cocos2d::CCArray *v10; // x28 _BOOL4 v11; // w25 float v12; // s9 float v13; // s10 float v14; // s9 cocos2d::ccArray *data; // x2 unsigned int num; // w0 cocos2d::CCObject **arr; // x21 cocos2d::CCObject *v19; // x22 float v20; // s11 __int64 v21; // x27 int m_unknown5; // w19 float v23; // s8 __int64 v24; // x28 __int64 v25; // x28 int *v26; // x25 int *v27; // x28 int v28; // w0 __int64 v29; // x25 int m_uReference; // w28 int *v31; // x27 int *v32; // x25 int *v33; // x1 int v34; // w3 __int64 v35; // x2 int v36; // w0 int v37; // w3 _BOOL8 v38; // x0 int v39; // w0 float v40; // s13 float v41; // s12 unsigned int v42; // w25 float v43; // s14 float v44; // s14 int v45; // w0 float y; // s2 float x; // s3 unsigned int v48; // w0 float v49; // s1 float v50; // s0 float v51; // s9 void *v52; // x0 int v53; // w0 float v54; // s1 float v55; // s0 float v56; // s1 float v57; // s0 float v58; // s9 __int64 v59; // x27 int *v60; // x1 int v61; // w25 __int64 v62; // x0 __int64 v63; // x1 __int64 v64; // x2 int v65; // w0 _BOOL8 v66; // x0 float v67; // s0 float v68; // s0 float v69; // s1 __int64 v70; // x0 int *v71; // x2 int *v72; // x28 int *v73; // x25 int v74; // w1 __int64 v75; // x2 __int64 v76; // x0 __int64 v77; // x1 int v78; // w0 _BOOL8 v79; // x0 int *v80; // x2 __int64 v81; // x0 int *v82; // x28 int *v83; // x3 int *v84; // x1 int v85; // w4 __int64 v86; // x2 __int64 v87; // x0 __int64 v88; // x1 int v89; // w0 _BOOL8 v90; // x0 int *v91; // x2 void *v92; // x0 __int64 insert_unique_pos; // x0 int *v94; // x1 __int64 v95; // x1 bool v96; // w2 __int64 v97; // x0 int *v98; // x1 __int64 v99; // x0 int *v100; // x1 int *v101; // [xsp+A0h] [xbp+A0h] int *v102; // [xsp+B8h] [xbp+B8h] int v103; // [xsp+B8h] [xbp+B8h] int v104; // [xsp+B8h] [xbp+B8h] int *v105; // [xsp+C8h] [xbp+C8h] int v106; // [xsp+C8h] [xbp+C8h] int *v107; // [xsp+C8h] [xbp+C8h] int *v108; // [xsp+C8h] [xbp+C8h] _BOOL4 v109; // [xsp+D8h] [xbp+D8h] int v111; // [xsp+E0h] [xbp+E0h] int v112; // [xsp+E8h] [xbp+E8h] cocos2d::CCObject **v114; // [xsp+100h] [xbp+100h] int v115; // [xsp+108h] [xbp+108h] _BOOL4 v116; // [xsp+10Ch] [xbp+10Ch] cocos2d::CCPoint v117; // [xsp+118h] [xbp+118h] BYREF cocos2d::CCPoint v118; // [xsp+120h] [xbp+120h] BYREF cocos2d::CCPoint v119; // [xsp+128h] [xbp+128h] BYREF cocos2d::CCPoint v120; // [xsp+130h] [xbp+130h] BYREF cocos2d::CCPoint v121; // [xsp+138h] [xbp+138h] BYREF cocos2d::CCPoint v122; // [xsp+140h] [xbp+140h] BYREF cocos2d::CCPoint v123; // [xsp+148h] [xbp+148h] BYREF cocos2d::CCPoint v124; // [xsp+150h] [xbp+150h] BYREF char v125[8]; // [xsp+158h] [xbp+158h] BYREF int v126; // [xsp+160h] [xbp+160h] BYREF __int64 v127; // [xsp+168h] [xbp+168h] int *v128; // [xsp+170h] [xbp+170h] int *v129; // [xsp+178h] [xbp+178h] __int64 v130; // [xsp+180h] [xbp+180h] int v131; // [xsp+198h] [xbp+198h] v10 = *(cocos2d::CCArray **)&a3; v116 = a7; v109 = a9; v112 = a6; v11 = a8; if ( *(float *)&a2->__vftable <= 0.0 ) return 0.0; if ( a8 ) v12 = 311.58; else v12 = LevelTools::valueForSpeedMod(a4); v13 = 1.0; byte_1241F80 = 0; byte_1241F81 = 0; dword_122F014 = 1.0; if ( !v10 || v11 | ((unsigned int)cocos2d::CCArray::count(v10) == 0) ) return *(float *)&a2->__vftable / v12; cocos2d::CCPoint::CCPoint(&v117, &stru_1241F88); v126 = 0; data = v10->data; v127 = 0; num = data->num; v130 = 0; v128 = &v126; v129 = &v126; if ( num ) { arr = data->arr; v114 = &arr[num - 1]; if ( arr <= v114 ) { v19 = *arr; if ( *arr ) { v20 = 0.0; v21 = 0; m_unknown5 = 0; v115 = 0; while ( 1 ) { v23 = v12 * v13; if ( v116 ) break; v24 = v21; if ( SHIWORD(v19[31].m_eObjType) != -3 ) break; LABEL_60: if ( v114 < ++arr ) goto LABEL_69; v19 = *arr; v21 = v24; if ( !*arr ) { if ( !byte_1241F80 ) goto LABEL_70; LABEL_63: v51 = vabds_f32(v117.y, *((float *)&a2->__vftable + 1)); goto LABEL_64; } } v25 = v21; v26 = &v126; if ( v21 ) { do { while ( m_unknown5 <= *(_DWORD *)(v25 + 32) ) { v26 = (int *)v25; v25 = *(_QWORD *)(v25 + 16); if ( !v25 ) goto LABEL_17; } v25 = *(_QWORD *)(v25 + 24); } while ( v25 ); LABEL_17: v27 = v26; if ( v26 != &v126 && m_unknown5 >= v26[8] ) { v28 = v26[9]; v29 = v21; m_uReference = v19[31].m_uReference; v111 = v28; goto LABEL_20; } } else { v27 = &v126; } v59 = operator new(0x28u); v60 = (int *)(v59 + 32); *(_DWORD *)(v59 + 32) = m_unknown5; *(_DWORD *)(v59 + 36) = 0; if ( v27 == &v126 ) { if ( v130 ) { v27 = v129; if ( m_unknown5 > v129[8] ) { v64 = 0; goto LABEL_101; } } } else { v61 = v27[8]; if ( m_unknown5 >= v61 ) { if ( m_unknown5 <= v61 ) goto LABEL_180; if ( v129 == v27 ) { LABEL_103: v65 = *(_DWORD *)(v59 + 32); v61 = v27[8]; LABEL_104: v66 = v65 < v61; LABEL_105: sub_CFAD74(v66, v59, v27, &v126); ++v130; goto LABEL_106; } v64 = sub_CFAB14(v27); v60 = (int *)(v59 + 32); if ( m_unknown5 < *(_DWORD *)(v64 + 32) ) { if ( !*((_QWORD *)v27 + 3) ) { v65 = m_unknown5; goto LABEL_104; } v27 = (int *)v64; goto LABEL_101; } } else { if ( v128 == v27 ) { v64 = (__int64)v27; goto LABEL_101; } v62 = sub_CFABD4(v27); v60 = (int *)(v59 + 32); if ( m_unknown5 > *(_DWORD *)(v62 + 32) ) { v63 = *(_QWORD *)(v62 + 24); if ( v63 ) v64 = (__int64)v27; else v64 = 0; if ( !v63 ) v27 = (int *)v62; LABEL_101: if ( v64 || v27 == &v126 ) { v66 = 1; goto LABEL_105; } goto LABEL_103; } } } insert_unique_pos = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_unique_pos( (__int64)v125, v60); v64 = insert_unique_pos; v27 = v94; if ( v94 ) goto LABEL_101; v27 = (int *)insert_unique_pos; LABEL_180: v92 = (void *)v59; v59 = (__int64)v27; operator delete(v92); LABEL_106: v29 = v127; v111 = *(_DWORD *)(v59 + 36); m_uReference = v19[31].m_uReference; if ( !v127 ) { v31 = &v126; goto LABEL_25; } LABEL_20: v31 = &v126; do { while ( m_unknown5 <= *(_DWORD *)(v29 + 32) ) { v31 = (int *)v29; v29 = *(_QWORD *)(v29 + 16); if ( !v29 ) goto LABEL_23; } v29 = *(_QWORD *)(v29 + 24); } while ( v29 ); LABEL_23: if ( v31 != &v126 && m_unknown5 >= v31[8] ) { LABEL_37: if ( m_uReference <= v31[9] ) goto LABEL_38; v70 = v127; if ( v127 ) { v71 = &v126; do { while ( m_unknown5 <= *(_DWORD *)(v70 + 32) ) { v71 = (int *)v70; v70 = *(_QWORD *)(v70 + 16); if ( !v70 ) goto LABEL_131; } v70 = *(_QWORD *)(v70 + 24); } while ( v70 ); LABEL_131: v72 = v71; if ( v71 != &v126 && m_unknown5 >= v71[8] ) goto LABEL_147; } else { v72 = &v126; } v73 = (int *)operator new(0x28u); v73[8] = m_unknown5; v73[9] = 0; if ( v72 == &v126 ) { if ( v130 ) { v72 = v129; if ( m_unknown5 > v129[8] ) { v75 = 0; goto LABEL_142; } } } else { v74 = v72[8]; if ( m_unknown5 < v74 ) { v75 = (__int64)v128; if ( v72 == v128 ) goto LABEL_142; v76 = sub_CFABD4(v72); if ( m_unknown5 > *(_DWORD *)(v76 + 32) ) { v77 = *(_QWORD *)(v76 + 24); if ( v77 ) v75 = (__int64)v72; else v75 = 0; if ( !v77 ) v72 = (int *)v76; goto LABEL_142; } goto LABEL_217; } if ( m_unknown5 <= v74 ) { LABEL_219: operator delete(v73); goto LABEL_147; } if ( v72 == v129 ) { LABEL_243: v78 = m_unknown5; goto LABEL_145; } v106 = v72[8]; v75 = sub_CFAB14(v72); if ( m_unknown5 < *(_DWORD *)(v75 + 32) ) { v74 = v106; if ( *((_QWORD *)v72 + 3) ) { v72 = (int *)v75; goto LABEL_142; } goto LABEL_243; } } LABEL_217: v97 = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_unique_pos( (__int64)v125, v73 + 8); v75 = v97; v72 = v98; if ( !v98 ) { v72 = (int *)v97; goto LABEL_219; } LABEL_142: if ( v75 || v72 == &v126 ) { v79 = 1; goto LABEL_146; } v78 = v73[8]; v74 = v72[8]; LABEL_145: v79 = v78 < v74; LABEL_146: v80 = v72; v72 = v73; sub_CFAD74(v79, v73, v80, &v126); ++v130; LABEL_147: v72[9] = v19[31].m_uReference; LABEL_38: if ( v131 > 0 ) { v39 = v115; if ( HIDWORD(v19[16].__vftable) == v131 ) v39 = 1; v115 = v39; } cocos2d::CCPoint::CCPoint(&v124, (const cocos2d::CCPoint *)&v19[31].m_uIndexInArray); if ( v124.x <= 0.0 ) { v40 = 0.0 - v117.x; } else { cocos2d::CCPoint::CCPoint(&v122, (const cocos2d::CCPoint *)&v19[31].m_uIndexInArray); v40 = v122.x - v117.x; } cocos2d::CCPoint::CCPoint(&v124, (const cocos2d::CCPoint *)&v19[31].m_uIndexInArray); if ( v124.y <= 0.0 ) { v41 = 0.0 - v117.y; } else { cocos2d::CCPoint::CCPoint(&v123, (const cocos2d::CCPoint *)&v19[31].m_uIndexInArray); v41 = v123.y - v117.y; } v42 = (unsigned __int8)byte_1241F80; if ( byte_1241F81 ) { if ( !byte_1241F80 ) { if ( v40 < 0.0 ) goto LABEL_49; goto LABEL_74; } if ( v41 <= 0.0 ) goto LABEL_151; } else { if ( !byte_1241F80 ) { if ( v40 > 0.0 ) { LABEL_49: v43 = fabsf(v40); goto LABEL_50; } LABEL_74: v40 = 0.0; v44 = 0.0 / v23; if ( v115 ) goto LABEL_75; LABEL_51: if ( v112 != m_unknown5 && v112 != -1 ) { LABEL_53: cocos2d::CCPoint::CCPoint(&v121, &stru_1241F88); switch ( HIWORD(v19[31].m_eObjType) ) { case 0xFFFB: cocos2d::CCPoint::CCPoint(&v122, (const cocos2d::CCPoint *)&v19[33].m_eObjType); cocos2d::CCPoint::CCPoint(&v123, (const cocos2d::CCPoint *)&v19[31].m_uIndexInArray); cocos2d::CCPoint::operator-(&v124, &v122, &v123); cocos2d::CCPoint::operator=(&v121, v68, v69); if ( BYTE1(v19[33].m_nTag) ) { x = 0.0; v121.x = 0.0; } else { x = v121.x; } if ( BYTE2(v19[33].m_nTag) ) { y = 0.0; v45 = (unsigned __int8)byte_1241F80; v121.y = 0.0; } else { y = v121.y; v45 = (unsigned __int8)byte_1241F80; } break; case 0xFFFC: if ( BYTE1(v19[32].m_uOrderOfArrival) ) { v45 = (unsigned __int8)byte_1241F80; } else { v45 = (unsigned int)(v19[32].m_eObjType - 3) <= 1; v96 = (v19[32].m_uIndexInArray & 0xFFFFFFFD) == 1; byte_1241F80 = (unsigned int)(v19[32].m_eObjType - 3) <= 1; byte_1241F81 = v96; } if ( LOBYTE(v19[32].m_uOrderOfArrival) ) m_unknown5 = v19[32].m_unknown5; y = v121.y; x = v121.x; break; case 0xFFFD: v45 = (unsigned __int8)byte_1241F80; y = v121.y; x = v121.x; break; case 0xFFFE: v67 = *(float *)&v19[31].m_nLuaID; dword_122F014 = LODWORD(v67); y = v121.y; v45 = (unsigned __int8)byte_1241F80; if ( v109 ) { x = v121.x; } else { v23 = v67 * v12; x = v121.x; v13 = v67; } break; case 0xFFFF: v45 = (unsigned __int8)byte_1241F80; y = v121.y; x = v121.x; byte_1241F81 ^= 1u; break; default: v12 = LevelTools::valueForSpeedMod(SHIWORD(v19[31].m_eObjType)); v45 = (unsigned __int8)byte_1241F80; v23 = v12 * v13; y = v121.y; x = v121.x; break; } v48 = v45 ^ v42; v20 = v20 + v44; v49 = v117.x; if ( v42 <= v48 ) v49 = v40 + v117.x; v50 = v117.y; if ( v48 || v42 ) v50 = v41 + v117.y; v24 = v127; v117.x = v49 + x; v117.y = v50 + y; goto LABEL_60; } if ( a5 > 0 ) { v81 = v127; v82 = &v126; if ( v127 ) { do { while ( m_unknown5 <= *(_DWORD *)(v81 + 32) ) { v82 = (int *)v81; v81 = *(_QWORD *)(v81 + 16); if ( !v81 ) goto LABEL_158; } v81 = *(_QWORD *)(v81 + 24); } while ( v81 ); LABEL_158: if ( v82 != &v126 && m_unknown5 >= v82[8] ) goto LABEL_174; } v83 = (int *)operator new(0x28u); v84 = v83 + 8; v83[8] = m_unknown5; v83[9] = 0; if ( v82 == &v126 ) { if ( v130 ) { v82 = v129; if ( m_unknown5 > v129[8] ) { v86 = 0; goto LABEL_169; } } } else { v85 = v82[8]; if ( m_unknown5 < v85 ) { v86 = (__int64)v128; v102 = v83 + 8; if ( v82 == v128 ) goto LABEL_169; v105 = v83; v87 = sub_CFABD4(v82); v83 = v105; v84 = v102; if ( m_unknown5 > *(_DWORD *)(v87 + 32) ) { v88 = *(_QWORD *)(v87 + 24); if ( v88 ) v86 = (__int64)v82; else v86 = 0; if ( !v88 ) v82 = (int *)v87; goto LABEL_169; } goto LABEL_228; } if ( m_unknown5 <= v85 ) { LABEL_221: operator delete(v83); LABEL_174: if ( a5 > v82[9] && v111 != a5 ) goto LABEL_53; v53 = (unsigned __int8)byte_1241F80; LABEL_76: if ( v53 ) { if ( (_BYTE)a10 ) goto LABEL_53; } else { v54 = v117.x; v55 = *(float *)&a2->__vftable; if ( v117.x <= *(float *)&a2->__vftable ) { cocos2d::CCPoint::CCPoint(&v118, (const cocos2d::CCPoint *)&v19[31].m_uIndexInArray); v55 = *(float *)&a2->__vftable; if ( v118.x >= *(float *)&a2->__vftable ) goto LABEL_84; v54 = v117.x; } if ( v54 >= v55 ) { cocos2d::CCPoint::CCPoint(&v119, (const cocos2d::CCPoint *)&v19[31].m_uIndexInArray); if ( v119.x <= *(float *)&a2->__vftable ) goto LABEL_84; } if ( (_BYTE)a10 || !byte_1241F80 ) goto LABEL_53; } v56 = v117.y; v57 = *((float *)&a2->__vftable + 1); if ( v117.y <= v57 ) { cocos2d::CCPoint::CCPoint(&v120, (const cocos2d::CCPoint *)&v19[31].m_uIndexInArray); v57 = *((float *)&a2->__vftable + 1); if ( v120.y >= v57 ) goto LABEL_84; v56 = v117.y; } if ( v56 >= v57 ) { cocos2d::CCPoint::CCPoint(&v124, (const cocos2d::CCPoint *)&v19[31].m_uIndexInArray); if ( v124.y <= *((float *)&a2->__vftable + 1) ) { LABEL_84: if ( byte_1241F80 ) v58 = vabds_f32(v117.y, *((float *)&a2->__vftable + 1)); else v58 = vabds_f32(v117.x, *(float *)&a2->__vftable); v24 = v127; v14 = (float)(v58 / v23) + v20; goto LABEL_65; } } goto LABEL_53; } v101 = v83 + 8; if ( v82 == v129 ) { LABEL_245: v89 = m_unknown5; goto LABEL_172; } v108 = v83; v104 = v82[8]; v86 = sub_CFAB14(v82); v83 = v108; v84 = v101; if ( m_unknown5 < *(_DWORD *)(v86 + 32) ) { v85 = v104; if ( *((_QWORD *)v82 + 3) ) { v82 = (int *)v86; goto LABEL_169; } goto LABEL_245; } } LABEL_228: v107 = v83; v99 = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_unique_pos( (__int64)v125, v84); v86 = v99; v82 = v100; v83 = v107; if ( !v100 ) { v82 = (int *)v99; goto LABEL_221; } LABEL_169: if ( v86 || v82 == &v126 ) { v90 = 1; goto LABEL_173; } v89 = v83[8]; v85 = v82[8]; LABEL_172: v90 = v89 < v85; LABEL_173: v91 = v82; v82 = v83; sub_CFAD74(v90, v83, v91, &v126); ++v130; goto LABEL_174; } LABEL_75: v53 = (unsigned __int8)byte_1241F80; goto LABEL_76; } if ( v41 >= 0.0 ) { LABEL_151: v41 = 0.0; v43 = 0.0; goto LABEL_50; } } v43 = fabsf(v41); LABEL_50: v44 = v43 / v23; if ( v115 ) goto LABEL_75; goto LABEL_51; } LABEL_25: v32 = (int *)operator new(0x28u); v33 = v32 + 8; v32[8] = m_unknown5; v32[9] = 0; if ( v31 == &v126 ) { if ( v130 ) { v35 = (__int64)v129; if ( m_unknown5 > v129[8] ) { v31 = nullptr; goto LABEL_32; } } } else { v34 = v31[8]; if ( m_unknown5 >= v34 ) { if ( m_unknown5 <= v34 ) { LABEL_182: operator delete(v32); goto LABEL_37; } v103 = v31[8]; if ( v129 == v31 ) { v35 = (__int64)v31; LABEL_34: v36 = v32[8]; v37 = *(_DWORD *)(v35 + 32); LABEL_35: v38 = v37 > v36; LABEL_36: v31 = v32; sub_CFAD74(v38, v32, v35, &v126); ++v130; goto LABEL_37; } v35 = sub_CFAB14(v31); v33 = v32 + 8; if ( m_unknown5 < *(_DWORD *)(v35 + 32) ) { v37 = v103; if ( !*((_QWORD *)v31 + 3) ) { v36 = m_unknown5; v35 = (__int64)v31; goto LABEL_35; } v31 = (int *)v35; goto LABEL_32; } } else { if ( v128 == v31 ) { v35 = (__int64)v31; goto LABEL_32; } v35 = sub_CFABD4(v31); v33 = v32 + 8; if ( m_unknown5 > *(_DWORD *)(v35 + 32) ) { if ( *(_QWORD *)(v35 + 24) ) v35 = (__int64)v31; else v31 = nullptr; LABEL_32: if ( v31 || (int *)v35 == &v126 ) { v38 = 1; goto LABEL_36; } goto LABEL_34; } } } v31 = (int *)std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_unique_pos( (__int64)v125, v33); v35 = v95; if ( v95 ) goto LABEL_32; goto LABEL_182; } } } v23 = v12; v24 = 0; v20 = 0.0; LABEL_69: if ( byte_1241F80 ) goto LABEL_63; LABEL_70: v51 = vabds_f32(v117.x, *(float *)&a2->__vftable); LABEL_64: v14 = v20 + (float)(v51 / v23); LABEL_65: while ( v24 ) { std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_erase( (__int64)v125, *(_QWORD **)(v24 + 24)); v52 = (void *)v24; v24 = *(_QWORD *)(v24 + 16); operator delete(v52); } return v14; }
GD Web Decomp Icon

GD Web Decomp

Raw Source