//
// PlayLayer::processCheckpoints from 0x5e42dc to 0x5e4508 (556 bytes)
//
// 2 xrefs:
// > ??> @ 0x4cce0
// > ??> @ 0x1148b30
//
// 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
//
void PlayLayer::processCheckpoints(PlayLayer *a1)
{
GameManager *v2; // x0
CheckpointGameObject *m_activatedCheckpoint; // x2
__int64 m_targetGroupID; // x1
__int64 m_uniqueID; // x4
__int64 m_controlID; // x5
void (__fastcall *spawnGroup)(GJBaseGameLayer *__hidden, int, bool, double, const std::vector *, int, int); // x6
CheckpointObject *v8; // x21
CheckpointGameObject *v9; // x0
int m_centerGroupID; // w1
GameObject *MainObject; // x0
float v12; // s0
float v13; // s1
GameObject *Object; // x24
void (__fastcall *setStartPos)(GameObject *__hidden, cocos2d::CCPoint); // x25
PlayerCheckpoint *m_player1Checkpoint; // x24
float v17; // s0
float v18; // s1
GameObject *v19; // x0
float v20; // s0
float v21; // s1
cocos2d::CCPoint v22; // [xsp+58h] [xbp+58h] BYREF
void *p[3]; // [xsp+60h] [xbp+60h] BYREF
if ( a1->m_tryPlaceCheckpoint )
{
a1->m_tryPlaceCheckpoint = 0;
PlayLayer::markCheckpoint(a1);
}
if ( a1->m_activatedCheckpoint )
{
v2 = GameManager::sharedState();
if ( GameManager::getGameVariable(v2, "0146") || (v8 = PlayLayer::markCheckpoint(a1)) == nullptr )
{
m_activatedCheckpoint = a1->m_activatedCheckpoint;
}
else
{
((void (__fastcall *)(cocos2d::CCPoint *__return_ptr, CheckpointGameObject *))a1->m_activatedCheckpoint->getRealPosition)(
&v22,
a1->m_activatedCheckpoint);
v9 = a1->m_activatedCheckpoint;
if ( v9->m_targetPlayer1 )
{
v20 = ((float (__fastcall *)(PlayerObject *))a1->m_player1->getPosition)(a1->m_player1);
cocos2d::CCPoint::operator=(&v22, v20, v21);
}
else
{
m_centerGroupID = v9->m_centerGroupID;
if ( m_centerGroupID > 0 )
{
MainObject = GJBaseGameLayer::tryGetMainObject(a1, m_centerGroupID);
if ( MainObject )
{
MainObject->getRealPosition((GameObject *)p);
cocos2d::CCPoint::operator=(&v22, v12, v13);
}
}
}
Object = CheckpointObject::getObject(v8);
setStartPos = Object->setStartPos;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)p, &v22);
((void (__fastcall *)(GameObject *, void **))setStartPos)(Object, p);
m_player1Checkpoint = v8->m_player1Checkpoint;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)p, &v22);
cocos2d::CCPoint::operator=(&m_player1Checkpoint->m_position, v17, v18);
v8->m_player1Checkpoint->m_platformerCheckpoint = 1;
v19 = CheckpointObject::getObject(v8);
GameObject::makeInvisible(v19);
m_activatedCheckpoint = a1->m_activatedCheckpoint;
v8->m_uniqueID = m_activatedCheckpoint->m_uniqueID;
v8->m_respawnID = m_activatedCheckpoint->m_respawnID;
}
m_targetGroupID = (unsigned int)m_activatedCheckpoint->m_targetGroupID;
if ( (int)m_targetGroupID > 0 )
{
m_uniqueID = (unsigned int)m_activatedCheckpoint->m_uniqueID;
m_controlID = (unsigned int)m_activatedCheckpoint->m_controlID;
spawnGroup = a1->spawnGroup;
memset(p, 0, sizeof(p));
((void (__fastcall *)(PlayLayer *, __int64, _QWORD, void **, __int64, __int64, double))spawnGroup)(
a1,
m_targetGroupID,
0,
p,
m_uniqueID,
m_controlID,
0.0);
if ( p[0] )
operator delete(p[0]);
}
GJBaseGameLayer::gameEventTriggered(a1, Checkpoint, 0, 0);
a1->m_activatedCheckpoint = nullptr;
}
}