//
// GJPathsLayer::onPath from 0x1402851b0 to 0x1402853eb (571 bytes)
//
// 3 xrefs:
// > GJPathsLayer::init @ 0x140284fdd
// > ??> @ 0x1406d1544
// > ??> @ 0x1406d1550
//
// 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
//
// Hidden C++ exception states: #wind=5
void GJPathsLayer::onPath(GJPathsLayer *a1, cocos2d::CCObject *a2)
{
int v3; // edi
GJPathPage *v4; // rax
GameStatsManager *v5; // rbx
const char *v6; // rax
int Stat; // ebx
__int64 v8; // rcx
__int64 v9; // rbx
_QWORD *v10; // rax
bool isSpecialChestUnlocked; // bl
GJPathRewardPopup *v12; // rbx
void (*show)(FLAlertLayer *); // rdx
void *v14; // [rsp+20h] [rbp-78h]
void *v15; // [rsp+20h] [rbp-78h]
_BYTE v16[32]; // [rsp+28h] [rbp-70h] BYREF
_QWORD v17[4]; // [rsp+48h] [rbp-50h] BYREF
_QWORD v18[4]; // [rsp+68h] [rbp-30h] BYREF
v3 = a2->getTag(a2);
v4 = GJPathPage::create(v3, a1);
v4->m_noElasticity = 1;
v4->show(v4);
v5 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v14 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v5 = (GameStatsManager *)qword_1406C2EE8;
}
v6 = (const char *)GameToolbox::intToString(v18, v3 + 29);
if ( *((_QWORD *)v6 + 3) > 0xFu )
v6 = *(const char **)v6;
Stat = GameStatsManager::getStat(v5, v6);
sub_14003A830((__int64)v18);
if ( Stat >= 1000 )
{
v9 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v15 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v9 = qword_1406C2EE8;
}
GameStatsManager::getPathRewardKey(v8, v17, v3);
v10 = (_QWORD *)sub_14003BDB0((__int64)v16, (__int64)v17);
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v9, v10);
sub_14003A830((__int64)v17);
if ( !isSpecialChestUnlocked )
{
v12 = (GJPathRewardPopup *)operator new(0x280u);
FLAlertLayer::FLAlertLayer(v12);
v12->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable = (GJPathRewardPopup_vtbl *)&GJPathRewardPopup::`vftable';
v12->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCTouchDelegate::__vftable = (cocos2d::CCTouchDelegate_vtbl *)&GJPathRewardPopup::`vftable';
v12->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCAccelerometerDelegate::__vftable = (cocos2d::CCAccelerometerDelegate_vtbl *)&GJPathRewardPopup::`vftable';
v12->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCKeypadDelegate::__vftable = (cocos2d::CCKeypadDelegate_vtbl *)&GJPathRewardPopup::`vftable';
v12->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCKeyboardDelegate::__vftable = (cocos2d::CCKeyboardDelegate_vtbl *)&GJPathRewardPopup::`vftable';
v12->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCMouseDelegate::__vftable = (cocos2d::CCMouseDelegate_vtbl *)&GJPathRewardPopup::`vftable';
v12->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCRGBAProtocol::__vftable = (cocos2d::CCRGBAProtocol_vtbl *)&GJPathRewardPopup::`vftable';
v12->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCBlendProtocol::__vftable = (cocos2d::CCBlendProtocol_vtbl *)&GJPathRewardPopup::`vftable';
v12->m_pathNumber = 0;
if ( GJPathRewardPopup::init(v12, v3) )
{
cocos2d::CCObject::autorelease(v12);
}
else
{
((void (__fastcall *)(GJPathRewardPopup *, __int64))v12->~GJPathRewardPopup)(v12, 1);
v12 = nullptr;
}
show = (void (*)(FLAlertLayer *))v12->show;
if ( show == FLAlertLayer::show )
FLAlertLayer::show(v12);
else
show(v12);
}
}
}