//
// LevelTools::posForTimeInternal from 0x1404676d0 to 0x140467d32 (1634 bytes)
//
// 10 xrefs:
// > LevelEditorLayer::posForTime @ 0x1403fd223
// > DrawGridLayer::loadTimeMarkers @ 0x14040a5b5
// > DrawGridLayer::update @ 0x14040a7c2
// > DrawGridLayer::draw @ 0x14040b9e2
// > DrawGridLayer::draw @ 0x14040c141
// > PlayLayer::posForTime @ 0x14051204d
// > ??> @ 0x1408cda94
// > ??> @ 0x1408cdaa4
// > ??> @ 0x1408cdae0
// > ??> @ 0x140927eb4
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:32:35 +0000
//
cocos2d::CCPoint *__fastcall LevelTools::posForTimeInternal(
cocos2d::CCPoint *a1,
float a2,
cocos2d::CCArray *a3,
int a4,
char a5,
char a6,
char a7,
_DWORD *a8)
{
char v8; // di
int v12; // r9d
int v13; // r9d
int v14; // r9d
float v15; // xmm6_4
float v16; // xmm13_4
float v17; // xmm14_4
_DWORD *v18; // r12
unsigned int *v19; // rax
__int64 v20; // rcx
__int64 *v21; // r14
__int64 *v22; // r13
float v23; // xmm0_4
float v24; // xmm1_4
__int64 v25; // rbx
float v26; // xmm7_4
float v27; // xmm9_4
float v28; // xmm10_4
float v29; // xmm9_4
int v30; // esi
float v31; // xmm10_4
float v32; // xmm0_4
float v33; // xmm8_4
float v34; // xmm8_4
int v35; // ecx
int v36; // ecx
int v37; // ecx
int v38; // ecx
int v39; // xmm0_4
int v40; // eax
bool v41; // al
int v42; // eax
float v43; // xmm1_4
float v44; // xmm0_4
float v45; // xmm12_4
__int64 v46; // rax
const struct cocos2d::CCPoint *v47; // rdx
float v49; // xmm12_4
__int64 v50; // rax
float v51; // [rsp+20h] [rbp-E0h] BYREF
float v52; // [rsp+24h] [rbp-DCh]
float v53; // [rsp+28h] [rbp-D8h] BYREF
_BYTE v54[8]; // [rsp+30h] [rbp-D0h] BYREF
_BYTE v55[8]; // [rsp+38h] [rbp-C8h] BYREF
float v56; // [rsp+40h] [rbp-C0h] BYREF
_BYTE v57[4]; // [rsp+48h] [rbp-B8h] BYREF
float v58; // [rsp+4Ch] [rbp-B4h]
_BYTE v59[4]; // [rsp+50h] [rbp-B0h] BYREF
float v60; // [rsp+54h] [rbp-ACh]
_BYTE v61[8]; // [rsp+58h] [rbp-A8h] BYREF
_BYTE v62[16]; // [rsp+60h] [rbp-A0h] BYREF
float v63; // [rsp+150h] [rbp+50h] BYREF
float v64; // [rsp+154h] [rbp+54h]
v8 = a5;
if ( a5 )
goto LABEL_10;
v12 = a4 - 1;
if ( !v12 )
{
v15 = 251.16008;
goto LABEL_11;
}
v13 = v12 - 1;
if ( !v13 )
{
v15 = 387.42014;
goto LABEL_11;
}
v14 = v13 - 1;
if ( !v14 )
{
v15 = 468.00015;
goto LABEL_11;
}
if ( v14 != 1 )
{
LABEL_10:
v15 = 311.58011;
goto LABEL_11;
}
v15 = 576.00018;
LABEL_11:
if ( a3 && cocos2d::CCArray::count(a3) && !v8 )
{
v16 = 0.0;
v17 = 1.0;
dword_1408FE4F8 = 1065353216;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v63, (const struct cocos2d::CCPoint *)&unk_14090B178);
v18 = a8;
byte_14090BD0C = 0;
byte_1409097DF = 0;
*a8 = 0;
v19 = *((unsigned int **)a3 + 7);
v20 = *v19;
if ( (_DWORD)v20 )
{
v21 = *((__int64 **)v19 + 2);
v22 = &v21[v20 - 1];
if ( v21 <= v22 )
{
v23 = v64;
v24 = v63;
while ( 1 )
{
v25 = *v21;
if ( !*v21 )
goto LABEL_91;
v26 = v17 * v15;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, (const struct cocos2d::CCPoint *)(v25 + 1800));
if ( v53 >= 0.0 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v56, (const struct cocos2d::CCPoint *)(v25 + 1800));
v27 = v56;
}
else
{
v27 = 0.0;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v57, (const struct cocos2d::CCPoint *)(v25 + 1800));
if ( v58 >= 0.0 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, (const struct cocos2d::CCPoint *)(v25 + 1800));
v28 = v60;
}
else
{
v28 = 0.0;
}
v29 = v27 - v63;
v30 = (unsigned __int8)byte_1409097DF;
v31 = v28 - v64;
if ( byte_14090BD0C )
{
if ( !byte_1409097DF )
{
v29 = fminf(0.0, v29);
goto LABEL_32;
}
v32 = fmaxf(0.0, v31);
}
else
{
if ( !byte_1409097DF )
{
v29 = fmaxf(0.0, v29);
goto LABEL_32;
}
v32 = fminf(0.0, v31);
}
v31 = v32;
LABEL_32:
if ( *(_DWORD *)(v25 + 1792) != *v18 )
{
v31 = 0.0;
v29 = 0.0;
}
if ( byte_1409097DF )
v33 = v31;
else
v33 = v29;
v34 = (float)(fabs(v33) / v26) + v16;
if ( v34 >= a2 )
{
v45 = (float)(a2 - v16) * v26;
if ( byte_1409097DF != byte_14090BD0C )
v45 = v45 * -1.0;
if ( byte_1409097DF )
v64 = v64 + v45;
else
v63 = v63 + v45;
if ( a6 )
{
if ( byte_1409097DF )
v63 = 0.0;
else
v64 = 0.0;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v54, v63, v64);
cocos2d::CCPoint::operator=(&v53, v46);
v47 = (const struct cocos2d::CCPoint *)&v53;
goto LABEL_88;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v51, (const struct cocos2d::CCPoint *)&unk_14090B178);
v35 = *(__int16 *)(v25 + 1798);
if ( v35 == -5 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v61, (const struct cocos2d::CCPoint *)(v25 + 1800));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v62, (const struct cocos2d::CCPoint *)(v25 + 1916));
cocos2d::CCPoint::operator-(v62, v54, v61);
cocos2d::CCPoint::operator=(&v51, v54);
if ( *(_BYTE *)(v25 + 1905) )
v51 = 0.0;
if ( *(_BYTE *)(v25 + 1906) )
v52 = 0.0;
}
else if ( v35 == -4 )
{
if ( !*(_BYTE *)(v25 + 1877) )
{
v40 = *(_DWORD *)(v25 + 1856);
v41 = v40 == 3 || v40 == 4;
byte_1409097DF = v41;
v42 = *(_DWORD *)(v25 + 1860);
if ( v42 == 1 || (byte_14090BD0C = 0, v42 == 3) )
byte_14090BD0C = 1;
}
if ( *(_BYTE *)(v25 + 1876) )
{
*v18 = *(_DWORD *)(v25 + 1880);
*(_BYTE *)(v25 + 1850) = 1;
}
}
else if ( v35 != -3 )
{
if ( v35 == -2 )
{
v39 = *(int *)(v25 + 1780);
dword_1408FE4F8 = v39;
if ( !a7 )
v17 = *(float *)&v39;
}
else if ( v35 == -1 )
{
byte_14090BD0C = byte_14090BD0C == 0;
}
else
{
v36 = v35 - 1;
if ( v36 )
{
v37 = v36 - 1;
if ( v37 )
{
v38 = v37 - 1;
if ( v38 )
{
if ( v38 == 1 )
v15 = 576.00018;
else
v15 = 311.58011;
}
else
{
v15 = 468.00015;
}
}
else
{
v15 = 387.42014;
}
}
else
{
v15 = 251.16008;
}
}
}
v16 = v34;
if ( (_BYTE)v30 && v30 == (unsigned __int8)byte_1409097DF )
{
v43 = v63;
}
else
{
v43 = v63 + v29;
if ( !(_BYTE)v30 && !byte_1409097DF )
{
v44 = v64;
goto LABEL_73;
}
}
v44 = v64 + v31;
LABEL_73:
v24 = v43 + v51;
v23 = v44 + v52;
++v21;
v63 = v24;
v64 = v23;
if ( v21 > v22 )
goto LABEL_91;
}
}
}
v23 = v64;
v24 = v63;
LABEL_91:
v49 = (float)((float)(a2 - v16) * v15) * v17;
if ( byte_1409097DF != byte_14090BD0C )
v49 = v49 * -1.0;
if ( byte_1409097DF )
v64 = v23 + v49;
else
v63 = v24 + v49;
if ( a6 )
{
if ( byte_1409097DF )
v63 = 0.0;
else
v64 = 0.0;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v54, v63, v64);
cocos2d::CCPoint::operator=(v55, v50);
v47 = (const struct cocos2d::CCPoint *)v55;
LABEL_88:
cocos2d::CCPoint::CCPoint(a1, v47);
}
else
{
cocos2d::CCPoint::CCPoint(a1, v15 * a2, 0.0);
}
return a1;
}