//
// GJBaseGameLayer::loadUpToPosition from 0x14033e670 to 0x14033eab1 (1089 bytes)
//
// 5 xrefs:
// > GJBaseGameLayer::loadStartPosObject @ 0x14033e522
// > ??> @ 0x1408b75e8
// > ??> @ 0x1408b75f8
// > ??> @ 0x14091fc88
// > ??> @ 0x14091fc94
//
// 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:30:38 +0000
//
__int64 __fastcall GJBaseGameLayer::loadUpToPosition(__int64 a1, float a2, unsigned int a3, unsigned int a4)
{
__int64 v7; // rax
float v8; // xmm7_4
float (__fastcall *v9)(__int64, __int64, _QWORD, _QWORD, char, _DWORD); // rbx
__int64 v10; // rax
float v11; // xmm8_4
_QWORD *v12; // rbp
int v13; // r13d
const struct cocos2d::CCPoint *v14; // rax
__int64 v15; // rdx
_QWORD *v16; // r14
int v17; // r12d
__int64 v18; // rdi
float v19; // xmm6_4
__int64 v20; // rax
__m128d v21; // xmm1
float *v22; // rax
float v23; // xmm10_4
__int64 v24; // rax
float v25; // xmm11_4
__int64 **v26; // rcx
__int64 *i; // rax
_QWORD *v28; // rsi
_QWORD *v29; // rbx
void *v30; // rcx
_QWORD *v31; // rsi
_QWORD *v32; // rbx
void *v33; // rcx
__int64 v34; // rdx
_QWORD *v35; // rbx
__int64 v36; // rdx
__int64 result; // rax
char v38; // [rsp+20h] [rbp-B8h]
_BYTE v39[16]; // [rsp+30h] [rbp-A8h] BYREF
float v40; // [rsp+E0h] [rbp+8h] BYREF
float v41; // [rsp+E4h] [rbp+Ch]
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1272LL))(a1);
sub_140067440((_QWORD *)(a1 + 1960));
v7 = *(_QWORD *)a1;
*(_QWORD *)(a1 + 976) = 0;
v8 = 0.0;
v9 = *(float (__fastcall **)(__int64, __int64, _QWORD, _QWORD, char, _DWORD))(v7 + 1256);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v40, a2, 0.0);
v38 = 0;
v11 = fminf(3600.0, v9(a1, v10, a3, a4, v38, 0));
v12 = (_QWORD *)(a1 + 3512);
v13 = (int)(float)(ceilf(v11 / 0.016666668) + 1.0);
v14 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3512) + 200LL))(*(_QWORD *)(a1 + 3512));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, v14);
(*(void (__fastcall **)(_QWORD, int *))(*(_QWORD *)*v12 + 184LL))(*v12, &dword_14090AA70);
v16 = (_QWORD *)(a1 + 2408);
v17 = 0;
if ( v13 <= 0 )
{
v35 = (_QWORD *)(a1 + 3512);
}
else
{
v18 = a1 + 4504;
do
{
v19 = 0.016666668;
if ( (float)(v8 + 0.016666668) > v11 )
v19 = v11 - v8;
v20 = *(_QWORD *)a1;
v21 = 0;
v8 = v8 + v19;
v21.m128d_f64[0] = v19;
*(__m128d *)(a1 + 968) = _mm_add_pd(*(__m128d *)(a1 + 968), _mm_unpacklo_pd(v21, v21));
(*(void (__fastcall **)(__int64, float *))(v20 + 1264))(a1, &v40);
v22 = (float *)(*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*v12 + 200LL))(*v12);
v23 = v40 - *v22;
v24 = (*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*v12 + 200LL))(*v12);
v25 = v41 - *(float *)(v24 + 4);
(*(void (__fastcall **)(_QWORD, float *))(*(_QWORD *)*v12 + 184LL))(*v12, &v40);
GJEffectManager::updateEffects(*v16);
v26 = *(__int64 ***)(*v16 + 680LL);
for ( i = *v26; i != (__int64 *)v26; i = (__int64 *)*i )
*((_BYTE *)i + 20) = 0;
v28 = *(_QWORD **)v18;
v29 = *(_QWORD **)(*(_QWORD *)v18 + 8LL);
while ( !*((_BYTE *)v29 + 25) )
{
sub_1400806E0(a1 + 4504, a1 + 4504, v29[2]);
v30 = v29;
v29 = (_QWORD *)*v29;
j_j_free(v30);
}
v28[1] = v28;
*v28 = v28;
v28[2] = v28;
*(_QWORD *)(a1 + 4512) = 0;
GJEffectManager::updateSpawnTriggers(*v16);
v31 = *(_QWORD **)v18;
v32 = *(_QWORD **)(*(_QWORD *)v18 + 8LL);
while ( !*((_BYTE *)v32 + 25) )
{
sub_1400806E0(a1 + 4504, a1 + 4504, v32[2]);
v33 = v32;
v32 = (_QWORD *)*v32;
j_j_free(v33);
}
v31[1] = v31;
*v31 = v31;
v31[2] = v31;
*(_QWORD *)(a1 + 4512) = 0;
*(float *)(*v16 + 2056LL) = v23;
*(float *)(*v16 + 2060LL) = v25;
*(float *)(*v16 + 2064LL) = v23;
*(float *)(*v16 + 2068LL) = v25;
GJEffectManager::updateTimers(*v16);
GJEffectManager::prepareMoveActions(*v16, v34, 0);
GJBaseGameLayer::processMoveActionsStep(a1, v19, v17 == v13 - 1);
GJEffectManager::postMoveActions(*v16);
GJBaseGameLayer::updateCollisionBlocks(a1);
GJBaseGameLayer::checkSpawnObjects(a1);
*(_DWORD *)(a1 + 828) = *(_DWORD *)(a1 + 832);
GJBaseGameLayer::checkSpawnObjects(a1);
GJEffectManager::postCollisionCheck(*v16);
GJGameState::updateTweenActions(a1 + 424, v19);
GJEffectManager::processColors(*v16);
++v17;
}
while ( v17 < v13 );
v35 = (_QWORD *)(a1 + 3512);
}
*(_QWORD *)(*v12 + 2520LL) = 0;
*(_QWORD *)(*v12 + 2528LL) = 0;
*(_QWORD *)(*v12 + 2472LL) = 0;
PlayerObject::enablePlayerControls(*v12, v15);
PlayerObject::enablePlayerControls(*(_QWORD *)(a1 + 3520), v36);
*(_DWORD *)(*v16 + 2056LL) = 0;
*(_DWORD *)(*v16 + 2060LL) = 0;
*(_DWORD *)(*v16 + 2064LL) = 0;
*(_DWORD *)(*v16 + 2068LL) = 0;
(*(void (__fastcall **)(_QWORD, _BYTE *))(*(_QWORD *)*v35 + 184LL))(*v35, v39);
result = (unsigned int)(int)((v11 + v11) / 0.004166666666666667 + 0.5);
*(_DWORD *)(a1 + 992) = result;
*(_DWORD *)(a1 + 1000) = result;
return result;
}