//
// LevelTools::posForTimeInternal from 0x6051ec to 0x605718 (1324 bytes)
//
// 5 xrefs:
// > LevelTools::posForTime @ 0x60573c
// > DrawGridLayer::update @ 0x65b760
// > DrawGridLayer::draw @ 0x66686c
// > DrawGridLayer::draw @ 0x6671c8
// > ??> @ 0xa3770
//
// 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
//
cocos2d::CCPoint LevelTools::posForTimeInternal(
float a1,
cocos2d::CCArray *a2,
int a3,
bool a4,
bool a5,
bool a6,
int *a7,
int a8)
{
cocos2d::CCPoint *v8; // x8
_BOOL4 v10; // w19
float v13; // s9
float v14; // s12
cocos2d::ccArray *data; // x0
float v16; // s10
float v17; // s0
float v18; // s1
cocos2d::CCObject **arr; // x24
__int64 v22; // x23
cocos2d::CCObject *v23; // x21
float i; // s13
float v25; // s11
float x; // s8
float y; // s1
unsigned int v28; // w28
float v29; // s8
float v30; // s14
float v31; // s15
float v32; // s15
float v33; // s0
int v34; // w1
float v35; // s2
float v36; // s8
float v37; // s1
float v38; // s11
int m_nLuaID; // s3
float v40; // s0
float v41; // s1
bool v42; // w3
_BOOL4 v43; // [xsp+B8h] [xbp+B8h]
_BOOL4 v44; // [xsp+BCh] [xbp+BCh]
char *v45; // [xsp+C0h] [xbp+C0h]
cocos2d::CCPoint *v46; // [xsp+C8h] [xbp+C8h]
cocos2d::CCPoint v47; // [xsp+D0h] [xbp+D0h] BYREF
cocos2d::CCPoint v48; // [xsp+D8h] [xbp+D8h] BYREF
cocos2d::CCPoint v49; // [xsp+E0h] [xbp+E0h] BYREF
cocos2d::CCPoint v50; // [xsp+E8h] [xbp+E8h] BYREF
cocos2d::CCPoint v51; // [xsp+F0h] [xbp+F0h] BYREF
cocos2d::CCPoint result; // 0:s0.4,4:s1.4
v10 = a4;
v46 = v8;
v44 = a5;
v43 = a6;
if ( a4 )
v13 = 311.58;
else
v13 = LevelTools::valueForSpeedMod(a3);
if ( a2 && (unsigned int)cocos2d::CCArray::count(a2) && !v10 )
{
v14 = 1.0;
dword_122F014 = 1.0;
cocos2d::CCPoint::CCPoint(&v47, &stru_1241F88);
byte_1241F81 = 0;
data = a2->data;
*a7 = 0;
byte_1241F80 = 0;
if ( data->num )
{
arr = data->arr;
v22 = 8LL * data->num - 8;
v45 = (char *)arr + v22;
if ( arr <= (cocos2d::CCObject **)((char *)arr + v22) )
{
v23 = *arr;
if ( *arr )
{
for ( i = 0.0; ; i = v32 )
{
v25 = v13 * v14;
cocos2d::CCPoint::CCPoint(&v50, (const cocos2d::CCPoint *)&v23[31].m_uIndexInArray);
x = 0.0;
if ( v50.x > 0.0 )
{
cocos2d::CCPoint::CCPoint(&v51, (const cocos2d::CCPoint *)&v23[31].m_uIndexInArray);
x = v51.x;
}
cocos2d::CCPoint::CCPoint(&v50, (const cocos2d::CCPoint *)&v23[31].m_uIndexInArray);
y = 0.0;
if ( v50.y > 0.0 )
{
cocos2d::CCPoint::CCPoint(&v51, (const cocos2d::CCPoint *)&v23[31].m_uIndexInArray);
y = v51.y;
}
v28 = (unsigned __int8)byte_1241F80;
v29 = x - v47.x;
v30 = y - v47.y;
if ( byte_1241F81 )
{
if ( byte_1241F80 )
{
if ( v30 > 0.0 )
goto LABEL_66;
LABEL_69:
v30 = 0.0;
LABEL_66:
if ( v23[31].m_uAutoReleaseCount == *a7 )
{
v31 = fabsf(v30);
}
else
{
LABEL_23:
v30 = 0.0;
v31 = 0.0;
v29 = 0.0;
}
v32 = i + (float)(v31 / v25);
if ( a1 <= v32 )
goto LABEL_45;
goto LABEL_25;
}
if ( v29 < 0.0 )
{
LABEL_22:
if ( v23[31].m_uAutoReleaseCount != *a7 )
goto LABEL_23;
goto LABEL_44;
}
}
else
{
if ( byte_1241F80 )
{
if ( v30 >= 0.0 )
goto LABEL_69;
goto LABEL_66;
}
if ( v29 > 0.0 )
goto LABEL_22;
}
v29 = 0.0;
if ( v23[31].m_uAutoReleaseCount != *a7 )
goto LABEL_23;
LABEL_44:
v32 = i + (float)(fabsf(v29) / v25);
if ( a1 <= v32 )
{
LABEL_45:
v38 = (float)(a1 - i) * v25;
if ( byte_1241F81 != byte_1241F80 )
v38 = -v38;
if ( byte_1241F80 )
{
v47.y = v38 + v47.y;
if ( v44 )
{
LABEL_40:
v47.x = 0.0;
goto LABEL_10;
}
}
else
{
v47.x = v38 + v47.x;
if ( v44 )
goto LABEL_9;
}
goto LABEL_10;
}
LABEL_25:
cocos2d::CCPoint::CCPoint(&v48, &stru_1241F88);
switch ( HIWORD(v23[31].m_eObjType) )
{
case 0xFFFB:
cocos2d::CCPoint::CCPoint(&v49, (const cocos2d::CCPoint *)&v23[33].m_eObjType);
cocos2d::CCPoint::CCPoint(&v50, (const cocos2d::CCPoint *)&v23[31].m_uIndexInArray);
cocos2d::CCPoint::operator-(&v51, &v49, &v50);
cocos2d::CCPoint::operator=(&v48, v40, v41);
if ( BYTE1(v23[33].m_nTag) )
{
v35 = 0.0;
v48.x = 0.0;
}
else
{
v35 = v48.x;
}
if ( BYTE2(v23[33].m_nTag) )
{
v48.y = 0.0;
v34 = (unsigned __int8)byte_1241F80;
v33 = 0.0;
}
else
{
v33 = v48.y;
v34 = (unsigned __int8)byte_1241F80;
}
break;
case 0xFFFC:
if ( BYTE1(v23[32].m_uOrderOfArrival) )
{
v34 = (unsigned __int8)byte_1241F80;
}
else
{
v34 = (unsigned int)(v23[32].m_eObjType - 3) <= 1;
v42 = (v23[32].m_uIndexInArray & 0xFFFFFFFD) == 1;
byte_1241F80 = (unsigned int)(v23[32].m_eObjType - 3) <= 1;
byte_1241F81 = v42;
}
if ( LOBYTE(v23[32].m_uOrderOfArrival) )
{
*a7 = v23[32].m_unknown5;
BYTE2(v23[32].m_uAutoReleaseCount) = 1;
}
v33 = v48.y;
v35 = v48.x;
break;
case 0xFFFD:
goto LABEL_26;
case 0xFFFE:
m_nLuaID = v23[31].m_nLuaID;
v33 = v48.y;
v34 = (unsigned __int8)byte_1241F80;
v35 = v48.x;
dword_122F014 = m_nLuaID;
if ( !v43 )
v14 = *(float *)&m_nLuaID;
break;
case 0xFFFF:
v34 = (unsigned __int8)byte_1241F80;
v33 = v48.y;
v35 = v48.x;
byte_1241F81 ^= 1u;
break;
default:
v13 = LevelTools::valueForSpeedMod(SHIWORD(v23[31].m_eObjType));
LABEL_26:
v33 = v48.y;
v34 = (unsigned __int8)byte_1241F80;
v35 = v48.x;
break;
}
if ( v28 <= (v34 ^ v28) )
v36 = v29 + v47.x;
else
v36 = v47.x;
if ( v34 != v28 || v28 )
v37 = v30 + v47.y;
else
v37 = v47.y;
++arr;
v47.x = v36 + v35;
v47.y = v33 + v37;
if ( v45 >= (char *)arr )
{
v23 = *arr;
if ( *arr )
continue;
}
v16 = (float)((float)(a1 - v32) * v13) * v14;
if ( v34 != (unsigned __int8)byte_1241F81 )
v16 = -v16;
if ( v34 )
{
v47.y = v47.y + v16;
if ( !v44 )
goto LABEL_10;
goto LABEL_40;
}
goto LABEL_8;
}
}
}
}
v16 = v13 * a1;
LABEL_8:
v47.x = v47.x + v16;
if ( v44 )
LABEL_9:
v47.y = 0.0;
LABEL_10:
cocos2d::CCPoint::CCPoint(&v50);
cocos2d::CCPoint::CCPoint(&v51, v47.x, v47.y);
cocos2d::CCPoint::operator=(&v50, v17, v18);
cocos2d::CCPoint::CCPoint(v46, &v50);
}
else
{
cocos2d::CCPoint::CCPoint(v46, a1 * v13, 0.0);
}
return result;
}