//
// PlayerObject::tryPlaceCheckpoint from 0x75490c to 0x754b1c (528 bytes)
//
// 3 xrefs:
// > PlayerObject::updateCheckpointTest @ 0x754bac
// > PlayerObject::updateCheckpointTest @ 0x754bc0
// > ??> @ 0xfc970
//
// This function is hookable on this platform (idp: arm, 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:52:56 +0000
//
__int64 __fastcall PlayerObject::tryPlaceCheckpoint(CheckpointObject **this)
{
__int64 result; // x0
GameManager *v3; // x0
GameManager *v4; // x0
GameManager *v5; // x0
int v6; // w1
__int64 v7; // x0
__int64 v8; // x0
GameManager *LastCheckpoint; // x0
GameManager *v10; // x20
int v11; // w1
GameManager *v12; // x0
__int64 v13; // x0
__int64 v14; // x0
GameManager *v15; // x0
__int64 v16; // x0
GameManager *v17; // x0
GameManager *v18; // x20
int v19; // w1
__int64 v20; // x0
cocos2d::CCObject *Checkpoint; // x0
result = *(_QWORD *)(GameManager::sharedState((GameManager *)this) + 544);
if ( !result )
return result;
result = *(unsigned __int8 *)(*(_QWORD *)(GameManager::sharedState((GameManager *)result) + 544) + 12544LL);
if ( !(_DWORD)result )
return result;
v3 = (GameManager *)GameManager::sharedState((GameManager *)result);
result = (unsigned __int8)GameManager::getGameVariable(v3, "0027");
if ( !(_BYTE)result )
return result;
result = *((unsigned int *)this + 229);
if ( (_DWORD)result != 1 )
return result;
v4 = *(GameManager **)(*(_QWORD *)(GameManager::sharedState((GameManager *)result) + 544) + 12432LL);
if ( v4 )
{
v5 = (GameManager *)GameManager::sharedState(v4);
result = (unsigned __int8)GameManager::getGameVariable(v5, "0234");
if ( (_BYTE)result )
return result;
}
if ( !(unsigned __int8)PlayerObject::isFlying((PlayerObject *)this) )
{
result = *((unsigned __int8 *)this + 1971);
if ( !*((_BYTE *)this + 1971) )
{
result = *((unsigned __int8 *)this + 2353);
if ( !*((_BYTE *)this + 2353) )
return result;
}
*((_BYTE *)this + 1971) = 0;
v8 = GameManager::sharedState((GameManager *)result);
LastCheckpoint = (GameManager *)PlayLayer::getLastCheckpoint(*(cocos2d::CCArray ***)(v8 + 544));
v10 = LastCheckpoint;
if ( LastCheckpoint )
{
v11 = *(_DWORD *)(*(_QWORD *)(GameManager::sharedState(LastCheckpoint) + 544) + 952LL);
result = *((_BYTE *)this + 1525) ? 100LL : 500LL;
if ( v11 - *((_DWORD *)v10 + 968) <= (int)result )
return result;
}
LABEL_23:
*((_BYTE *)this + 1977) = 1;
*((double *)this + 248) = sub_74D970();
v13 = GameManager::sharedState(v12);
return (__int64)PlayLayer::markCheckpoint(*(PlayLayer **)(v13 + 544));
}
if ( *((_BYTE *)this + 2832) )
{
v14 = GameManager::sharedState((GameManager *)*((unsigned __int8 *)this + 2832));
v15 = (GameManager *)PlayLayer::getLastCheckpoint(*(cocos2d::CCArray ***)(v14 + 544));
if ( v15 )
{
result = (unsigned int)(*(_DWORD *)(*(_QWORD *)(GameManager::sharedState(v15) + 544) + 952LL)
- *((_DWORD *)v15 + 968));
if ( (int)result <= 500 )
return result;
}
goto LABEL_23;
}
result = (__int64)*(this + 265);
if ( result )
goto LABEL_11;
v16 = GameManager::sharedState(nullptr);
v17 = (GameManager *)PlayLayer::getLastCheckpoint(*(cocos2d::CCArray ***)(v16 + 544));
v18 = v17;
if ( !v17
|| ((v19 = *(_DWORD *)(*(_QWORD *)(GameManager::sharedState(v17) + 544) + 952LL), !*((_BYTE *)this + 1525))
? (v17 = (GameManager *)&elf_hash_nchain)
: (v17 = (GameManager *)(&qword_60 + 4)),
v19 - *((_DWORD *)v18 + 968) > (int)v17) )
{
v20 = GameManager::sharedState(v17);
Checkpoint = (cocos2d::CCObject *)PlayLayer::createCheckpoint(*(PlayerObject ***)(v20 + 544));
*(this + 265) = Checkpoint;
cocos2d::CCObject::retain(Checkpoint);
}
result = (__int64)*(this + 265);
if ( result )
{
LABEL_11:
v6 = *(_DWORD *)(*(_QWORD *)(GameManager::sharedState((GameManager *)result) + 544) + 952LL);
if ( *((_BYTE *)this + 1525) )
result = 100;
else
result = 500;
if ( v6 - *((_DWORD *)*(this + 265) + 968) > (int)result )
{
v7 = GameManager::sharedState((GameManager *)result);
PlayLayer::storeCheckpoint(*(cocos2d::CCArray ***)(v7 + 544), *(this + 265));
result = cocos2d::CCObject::release(*(this + 265));
*(this + 265) = nullptr;
}
}
return result;
}