// // LevelTools::timeForPos from 0x14032c1c0 to 0x14032cb96 (2518 bytes) // // 10 xrefs: // > EditorPauseLayer::init @ 0x1400da25f // > EditorPauseLayer::saveLevel @ 0x1400dda78 // > EditorUI::onPlayback @ 0x140111de3 // > EditorUI::onPlayback @ 0x140111e6e // > LevelEditorLayer::updateGameObjects @ 0x1402dc714 // > LevelEditorLayer::updateGameObjects @ 0x1402dc839 // > LevelEditorLayer::timeForPos @ 0x1402de87f // > DrawGridLayer::draw @ 0x1402ea8fa // > PlayLayer::timeForPos @ 0x1403b3645 // > @ 0x1406d4e50 // // 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 // // Hidden C++ exception states: #wind=5 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) { int v13; // r8d int v14; // r8d int v15; // r8d float v16; // xmm9_4 float v17; // xmm12_4 float v18; // xmm13_4 _QWORD *v19; // rdi __int64 v20; // r8 int m_uIndexInArray; // esi char v22; // r14 cocos2d::ccArray *data; // rcx __int64 num; // rdx cocos2d::CCObject **arr; // rcx cocos2d::CCObject **v26; // rax int v27; // ebx float y; // xmm0_4 float x; // xmm6_4 cocos2d::CCObject *v30; // r15 float v31; // xmm10_4 __int64 *v32; // rax _QWORD *v33; // rcx _DWORD *v34; // rax int v35; // r12d __int64 *v36; // rax _DWORD *v37; // rax __int64 v38; // rax _DWORD *v39; // rax float v40; // xmm8_4 float v41; // xmm8_4 float v42; // xmm7_4 float v43; // xmm7_4 char v44; // r14 float v45; // xmm6_4 float v46; // xmm0_4 float v47; // xmm6_4 _QWORD *v48; // rbx __int64 *v49; // rax _DWORD *v50; // rax float v51; // xmm1_4 float v52; // xmm0_4 float v53; // xmm1_4 int v54; // ecx int v55; // ecx int v56; // ecx int v57; // ecx int m_nZOrder; // xmm0_4 float v59; // xmm6_4 float v60; // xmm0_4 float v61; // xmm6_4 float v62; // xmm6_4 float v63; // xmm6_4 cocos2d::CCPoint v64; // [rsp+28h] [rbp-E0h] BYREF __int128 v65; // [rsp+30h] [rbp-D8h] BYREF int v66; // [rsp+40h] [rbp-C8h] _QWORD *v67; // [rsp+58h] [rbp-B0h] BYREF __int64 v68; // [rsp+60h] [rbp-A8h] cocos2d::CCPoint v69; // [rsp+68h] [rbp-A0h] BYREF cocos2d::CCObject **v70; // [rsp+70h] [rbp-98h] cocos2d::CCPoint v71; // [rsp+7Ch] [rbp-8Ch] BYREF cocos2d::CCPoint v72; // [rsp+84h] [rbp-84h] BYREF cocos2d::CCPoint v73; // [rsp+8Ch] [rbp-7Ch] BYREF cocos2d::CCPoint v74; // [rsp+94h] [rbp-74h] BYREF cocos2d::CCPoint v75; // [rsp+9Ch] [rbp-6Ch] BYREF cocos2d::CCPoint v76; // [rsp+A4h] [rbp-64h] BYREF cocos2d::CCPoint v77; // [rsp+ACh] [rbp-5Ch] BYREF cocos2d::CCPoint v78; // [rsp+B4h] [rbp-54h] BYREF cocos2d::CCPoint v79; // [rsp+BCh] [rbp-4Ch] BYREF cocos2d::CCPoint v80; // [rsp+C4h] [rbp-44h] BYREF _BYTE v81[12]; // [rsp+CCh] [rbp-3Ch] BYREF cocos2d::CCObject **v82; // [rsp+D8h] [rbp-30h] _QWORD **v83; // [rsp+E0h] [rbp-28h] __int64 v84; // [rsp+E8h] [rbp-20h] _QWORD **v85; // [rsp+F0h] [rbp-18h] __int64 v86; // [rsp+F8h] [rbp-10h] _QWORD **v87; // [rsp+100h] [rbp-8h] __int64 v88; // [rsp+108h] [rbp+0h] _QWORD **v89; // [rsp+110h] [rbp+8h] __int64 v90; // [rsp+118h] [rbp+10h] char v91; // [rsp+208h] [rbp+100h] if ( **(float **)&a1 <= 0.0 ) return 0.0; if ( a7 ) goto LABEL_12; v13 = a3 - 1; if ( !v13 ) { v16 = 251.16008; goto LABEL_13; } v14 = v13 - 1; if ( !v14 ) { v16 = 387.42014; goto LABEL_13; } v15 = v14 - 1; if ( !v15 ) { v16 = 468.00015; goto LABEL_13; } if ( v15 != 1 ) { LABEL_12: v16 = 311.58011; goto LABEL_13; } v16 = 576.00018; LABEL_13: byte_1406C2C77 = 0; byte_1406C2C76 = 0; v17 = 1.0; dword_1406BA198 = 1065353216; if ( !a2 || !cocos2d::CCArray::count(a2) || a7 ) return **(float **)&a1 / v16; v18 = 0.0; cocos2d::CCPoint::CCPoint(&v64); v67 = nullptr; v68 = 0; v19 = operator new(0x28u); *v19 = v19; v19[1] = v19; v19[2] = v19; *((_WORD *)v19 + 12) = 257; v67 = v19; v20 = 0; m_uIndexInArray = 0; v22 = 0; v91 = 0; data = a2->data; num = data->num; if ( (_DWORD)num ) { arr = data->arr; v70 = arr; v26 = &arr[num - 1]; v82 = v26; if ( arr <= v26 ) { v27 = a5; y = v64.y; x = v64.x; while ( 1 ) { v30 = *arr; if ( !*arr ) goto LABEL_136; v31 = v17 * v16; if ( a6 || HIWORD(v30[32].__vftable) != 0xFFFD ) break; LABEL_126: v70 = ++arr; if ( arr > v26 ) goto LABEL_136; } v32 = (__int64 *)v19[1]; *((_QWORD *)&v65 + 1) = v32; v66 = 0; v33 = v19; while ( !*((_BYTE *)v32 + 25) ) { *((_QWORD *)&v65 + 1) = v32; if ( *((_DWORD *)v32 + 7) >= m_uIndexInArray ) { v66 = 1; v33 = v32; v32 = (__int64 *)*v32; } else { v66 = 0; v32 = (__int64 *)v32[2]; } } if ( *((_BYTE *)v33 + 25) || m_uIndexInArray < *((_DWORD *)v33 + 7) ) { if ( v68 == 0x666666666666666LL ) goto LABEL_142; v83 = &v67; v84 = 0; v34 = operator new(0x28u); v34[7] = m_uIndexInArray; v34[8] = 0; *(_QWORD *)v34 = v19; *((_QWORD *)v34 + 1) = v19; *((_QWORD *)v34 + 2) = v19; *((_WORD *)v34 + 12) = 0; v84 = 0; v33 = (_QWORD *)sub_1400636D0(&v67, (__int64)&v65 + 8, (__int64)v34); v19 = v67; v20 = 0; } v35 = *((_DWORD *)v33 + 8); v36 = (__int64 *)v19[1]; *((_QWORD *)&v65 + 1) = v36; v66 = 0; v33 = v19; while ( !*((_BYTE *)v36 + 25) ) { *((_QWORD *)&v65 + 1) = v36; if ( *((_DWORD *)v36 + 7) >= m_uIndexInArray ) { v66 = 1; v33 = v36; v36 = (__int64 *)*v36; } else { v66 = 0; v36 = (__int64 *)v36[2]; } } if ( *((_BYTE *)v33 + 25) || m_uIndexInArray < *((_DWORD *)v33 + 7) ) { if ( v68 == 0x666666666666666LL ) goto LABEL_142; v85 = &v67; v86 = 0; v37 = operator new(0x28u); v37[7] = m_uIndexInArray; v37[8] = 0; *(_QWORD *)v37 = v19; *((_QWORD *)v37 + 1) = v19; *((_QWORD *)v37 + 2) = v19; *((_WORD *)v37 + 12) = 0; v86 = 0; v33 = (_QWORD *)sub_1400636D0(&v67, (__int64)&v65 + 8, (__int64)v37); v19 = v67; v20 = 0; } if ( v30[31].m_unknown5 > *((_DWORD *)v33 + 8) ) { v38 = v19[1]; *((_QWORD *)&v65 + 1) = v38; v66 = 0; num = (__int64)v19; while ( !*(_BYTE *)(v38 + 25) ) { *((_QWORD *)&v65 + 1) = v38; if ( *(_DWORD *)(v38 + 28) >= m_uIndexInArray ) { v66 = 1; num = v38; v38 = *(_QWORD *)v38; } else { v66 = 0; v38 = *(_QWORD *)(v38 + 16); } } if ( *(_BYTE *)(num + 25) || m_uIndexInArray < *(_DWORD *)(num + 28) ) { if ( v68 == 0x666666666666666LL ) goto LABEL_142; v87 = &v67; v88 = 0; v39 = operator new(0x28u); v39[7] = m_uIndexInArray; v39[8] = 0; *(_QWORD *)v39 = v19; *((_QWORD *)v39 + 1) = v19; *((_QWORD *)v39 + 2) = v19; *((_WORD *)v39 + 12) = 0; v88 = 0; num = sub_1400636D0(&v67, (__int64)&v65 + 8, (__int64)v39); } *(_DWORD *)(num + 32) = v30[31].m_unknown5; } if ( a10 > 0 ) { if ( v30[16].m_eObjType == a10 ) v22 = 1; v91 = v22; } cocos2d::CCPoint::CCPoint(&v71); if ( v71.x >= 0.0 ) { cocos2d::CCPoint::CCPoint(&v72); v40 = v72.x; } else { v40 = 0.0; } v41 = v40 - v64.x; cocos2d::CCPoint::CCPoint(&v73); if ( v73.y >= 0.0 ) { cocos2d::CCPoint::CCPoint(&v74); v42 = v74.y; } else { v42 = 0.0; } v43 = v42 - v64.y; v44 = byte_1406C2C76; if ( byte_1406C2C77 ) { if ( !byte_1406C2C76 ) { v41 = fminf(0.0, v41); v45 = v41; goto LABEL_69; } v46 = fmaxf(0.0, v43); } else { if ( !byte_1406C2C76 ) { v41 = fmaxf(0.0, v41); v45 = v41; goto LABEL_69; } v46 = fminf(0.0, v43); } v43 = v46; v45 = v46; LABEL_69: v47 = fabs(v45) / v31; if ( v91 ) goto LABEL_145; if ( v27 == m_uIndexInArray || v27 == -1 ) { if ( a4 <= 0 ) goto LABEL_145; v48 = v67; v49 = (__int64 *)v67[1]; *((_QWORD *)&v65 + 1) = v49; num = 0; v66 = 0; v33 = v67; while ( !*((_BYTE *)v49 + 25) ) { *((_QWORD *)&v65 + 1) = v49; if ( *((_DWORD *)v49 + 7) >= m_uIndexInArray ) { v66 = 1; v33 = v49; v49 = (__int64 *)*v49; } else { v66 = 0; v49 = (__int64 *)v49[2]; } } if ( *((_BYTE *)v33 + 25) || m_uIndexInArray < *((_DWORD *)v33 + 7) ) { if ( v68 == 0x666666666666666LL ) LABEL_142: sub_140052E40(v33, num, v20); v89 = &v67; v90 = 0; v50 = operator new(0x28u); v50[7] = m_uIndexInArray; v50[8] = 0; *(_QWORD *)v50 = v48; *((_QWORD *)v50 + 1) = v48; *((_QWORD *)v50 + 2) = v48; *((_WORD *)v50 + 12) = 0; v90 = 0; v33 = (_QWORD *)sub_1400636D0(&v67, (__int64)&v65 + 8, (__int64)v50); } if ( *((_DWORD *)v33 + 8) >= a4 || v35 == a4 ) { LABEL_145: if ( !byte_1406C2C76 ) { v51 = **(float **)&a1; v52 = v64.x; if ( **(float **)&a1 >= v64.x ) { cocos2d::CCPoint::CCPoint(&v75); v51 = **(float **)&a1; if ( v75.x >= **(float **)&a1 ) goto LABEL_131; v52 = v64.x; } if ( v52 >= v51 ) { cocos2d::CCPoint::CCPoint(&v76); if ( **(float **)&a1 >= v76.x ) goto LABEL_131; } } if ( !a9 && byte_1406C2C76 ) { if ( (v53 = *(float *)(*(_QWORD *)&a1 + 4LL), v53 >= v64.y) && (cocos2d::CCPoint::CCPoint(&v77), v53 = *(float *)(*(_QWORD *)&a1 + 4LL), v77.y >= v53) || v64.y >= v53 && (cocos2d::CCPoint::CCPoint(&v78), *(float *)(*(_QWORD *)&a1 + 4LL) >= v78.y) ) { LABEL_131: if ( byte_1406C2C76 ) v61 = v64.y - *(float *)(*(_QWORD *)&a1 + 4LL); else v61 = v64.x - **(float **)&a1; v62 = fabs(v61) / v31; goto LABEL_140; } } } } cocos2d::CCPoint::CCPoint(&v69); v54 = SHIWORD(v30[32].__vftable); if ( v54 == -5 ) { cocos2d::CCPoint::CCPoint(&v79); cocos2d::CCPoint::CCPoint(&v80); cocos2d::CCPoint::operator-(&v80, v81, &v79); cocos2d::CCPoint::operator=(&v69, v81); if ( BYTE1(v30[34].__vftable) ) v69.x = 0.0; if ( BYTE2(v30[34].__vftable) ) v69.y = 0.0; } else if ( v54 == -4 ) { if ( !BYTE1(v30[33].m_eObjType) ) { byte_1406C2C76 = v30[33].m_uID - 3 <= 1; byte_1406C2C77 = ((v30[33].m_nLuaID - 1) & 0xFFFFFFFD) == 0; } if ( LOBYTE(v30[33].m_eObjType) ) m_uIndexInArray = v30[33].m_uIndexInArray; } else if ( v54 != -3 ) { if ( v54 == -2 ) { m_nZOrder = v30[31].m_nZOrder; dword_1406BA198 = m_nZOrder; if ( !a8 ) v17 = *(float *)&m_nZOrder; } else if ( v54 == -1 ) { byte_1406C2C77 = byte_1406C2C77 == 0; } else { v55 = v54 - 1; if ( v55 ) { v56 = v55 - 1; if ( v56 ) { v57 = v56 - 1; if ( v57 ) { if ( v57 == 1 ) v16 = 576.00018; else v16 = 311.58011; } else { v16 = 468.00015; } } else { v16 = 387.42014; } } else { v16 = 251.16008; } } } v18 = v18 + v47; if ( v44 && v44 == byte_1406C2C76 ) { v59 = v64.x; } else { v59 = v64.x + v41; if ( !v44 && !byte_1406C2C76 ) { v60 = v64.y; goto LABEL_125; } } v60 = v64.y + v43; LABEL_125: x = v59 + v69.x; v64.x = x; y = v60 + v69.y; v64.y = y; v19 = v67; arr = v70; v22 = v91; v27 = a5; v26 = v82; v20 = 0; goto LABEL_126; } } y = v64.y; x = v64.x; LABEL_136: if ( byte_1406C2C76 ) v63 = y - *(float *)(*(_QWORD *)&a1 + 4LL); else v63 = x - **(float **)&a1; v62 = fabs(v63) / (float)(v17 * v16); LABEL_140: sub_140093D70((void **)&v67); return v62 + v18; }
GD Web Decomp Icon

GD Web Decomp

Raw Source