//
// PlayLayer::checkForEnd from 0x5c9198 to 0x5c92b8 (288 bytes)
//
// 2 xrefs:
// > ??> @ 0xb0088
// > ??> @ 0x1148998
//
// 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::checkForEnd(PlayLayer *a1)
{
EndPortalObject *m_endPortal; // x0
float m_sectionYFactor; // s0
float v4; // [xsp+38h] [xbp+38h]
float v5; // [xsp+40h] [xbp+40h]
cocos2d::CCPoint v6; // 0:kr00_8.8
cocos2d::CCPoint SpawnPos; // 0:kr08_8.8
m_endPortal = a1->m_endPortal;
if ( !m_endPortal || a1->m_endChecked )
return;
if ( m_endPortal->m_flippedX )
goto LABEL_4;
SpawnPos = EndPortalObject::getSpawnPos(m_endPortal);
if ( v4 > *(float *)((__int64 (__fastcall *)(PlayerObject *, float, float))a1->m_player1->getPosition)(
a1->m_player1,
SpawnPos.x,
SpawnPos.y) )
{
m_endPortal = a1->m_endPortal;
if ( !m_endPortal->m_flippedX )
return;
LABEL_4:
v6 = EndPortalObject::getSpawnPos(m_endPortal);
if ( v5 < *(float *)((__int64 (__fastcall *)(PlayerObject *, float, float))a1->m_player1->getPosition)(
a1->m_player1,
v6.x,
v6.y) )
return;
}
m_sectionYFactor = a1->m_sectionYFactor;
a1->m_endChecked = 1;
if ( m_sectionYFactor != 0.0 )
{
EndPortalObject::updateEndPos(a1->m_endPortal, 0);
GJBaseGameLayer::reorderObjectSection(a1, a1->m_endPortal);
}
EndPortalObject::triggerObject(a1->m_endPortal, a1);
}