//
// PlayerObject::tryPlaceCheckpoint from 0x1003eff10 to 0x1003f01b9 (681 bytes)
//
// 2 xrefs:
// > PlayerObject::updateCheckpointTest @ 0x1003efe58
// > PlayerObject::updateCheckpointTest @ 0x1003efeb2
//
// 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 12:29:53 +0000
//
__int64 __fastcall PlayerObject::tryPlaceCheckpoint(__int64 a1, double a2)
{
__int64 result; // rax
__int64 v3; // rax
const char *v4; // rsi
__int64 v5; // rax
__int64 v6; // rax
__int64 LastCheckpoint; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
int v11; // edx
__int64 v12; // rax
_QWORD *Checkpoint; // rax
int v14; // edx
__int64 v15; // rax
__int64 v16; // rax
__int64 v17; // rax
int v18; // edx
timeb v19; // [rsp+0h] [rbp-20h] BYREF
result = GameManager::sharedState();
if ( *(_QWORD *)(result + 544) )
{
result = *(_QWORD *)(GameManager::sharedState() + 544);
if ( *(_BYTE *)(result + 12544) == 1 )
{
v3 = GameManager::sharedState();
v4 = "0027";
result = GameManager::getGameVariable(v3, "0027");
if ( (_BYTE)result )
{
if ( *(_DWORD *)(a1 + 916) == 1 )
{
result = *(_QWORD *)(GameManager::sharedState() + 544);
if ( !*(_QWORD *)(result + 12432)
|| (v5 = GameManager::sharedState(),
v4 = "0234",
result = GameManager::getGameVariable(v5, "0234"),
!(_BYTE)result) )
{
if ( *(_BYTE *)(a1 + 2417) || *(_BYTE *)(a1 + 2418) || *(_BYTE *)(a1 + 2420) || *(_BYTE *)(a1 + 2428) == 1 )
{
if ( *(_BYTE *)(a1 + 2832) == 1 )
{
v6 = GameManager::sharedState();
LastCheckpoint = PlayLayer::getLastCheckpoint(*(_QWORD *)(v6 + 544));
if ( !LastCheckpoint
|| (result = (unsigned int)(*(_DWORD *)(*(_QWORD *)(GameManager::sharedState() + 544) + 952LL)
- *(_DWORD *)(LastCheckpoint + 3872)),
(int)result >= 501) )
{
LABEL_14:
*(_BYTE *)(a1 + 1977) = 1;
ftime(&v19);
*(double *)(a1 + 1984) = (double)v19.millitm / 1000.0 + (double)SLODWORD(v19.time);
v8 = GameManager::sharedState();
return PlayLayer::markCheckpoint(*(_QWORD *)(v8 + 544), (__int64)v4);
}
}
else
{
if ( *(_QWORD *)(a1 + 2120) )
goto LABEL_22;
v9 = GameManager::sharedState();
v10 = PlayLayer::getLastCheckpoint(*(_QWORD *)(v9 + 544));
if ( !v10 )
goto LABEL_20;
result = (unsigned int)(*(_DWORD *)(*(_QWORD *)(GameManager::sharedState() + 544) + 952LL)
- *(_DWORD *)(v10 + 3872));
v11 = 500;
if ( *(_BYTE *)(a1 + 1525) )
v11 = 100;
if ( (int)result > v11 )
{
LABEL_20:
v12 = GameManager::sharedState();
Checkpoint = PlayLayer::createCheckpoint(*(_QWORD *)(v12 + 544), a2);
*(_QWORD *)(a1 + 2120) = Checkpoint;
result = cocos2d::CCObject::retain(Checkpoint);
}
if ( *(_QWORD *)(a1 + 2120) )
{
LABEL_22:
result = (unsigned int)(*(_DWORD *)(*(_QWORD *)(GameManager::sharedState() + 544) + 952LL)
- *(_DWORD *)(*(_QWORD *)(a1 + 2120) + 3872LL));
v14 = 500;
if ( *(_BYTE *)(a1 + 1525) )
v14 = 100;
if ( (int)result > v14 )
{
v15 = GameManager::sharedState();
PlayLayer::storeCheckpoint(*(_QWORD *)(v15 + 544), *(_QWORD *)(a1 + 2120));
result = cocos2d::CCObject::release(*(_QWORD *)(a1 + 2120));
*(_QWORD *)(a1 + 2120) = 0;
}
}
}
}
else if ( *(_BYTE *)(a1 + 1971) || *(_BYTE *)(a1 + 2353) == 1 )
{
*(_BYTE *)(a1 + 1971) = 0;
v16 = GameManager::sharedState();
v17 = PlayLayer::getLastCheckpoint(*(_QWORD *)(v16 + 544));
if ( !v17 )
goto LABEL_14;
result = (unsigned int)(*(_DWORD *)(*(_QWORD *)(GameManager::sharedState() + 544) + 952LL)
- *(_DWORD *)(v17 + 3872));
v18 = 500;
if ( *(_BYTE *)(a1 + 1525) )
v18 = 100;
if ( (int)result > v18 )
goto LABEL_14;
}
}
}
}
}
}
return result;
}