//
// LevelPage::ccTouchBegan from 0x14031e290 to 0x14031e451 (449 bytes)
//
// 2 xrefs:
// > ??> @ 0x14058d1c0
// > ??> @ 0x1406d4b74
//
// 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=3
bool LevelPage::ccTouchBegan(LevelPage *a1, cocos2d::CCTouch *a2, cocos2d::CCEvent *a3)
{
__int64 v4; // r8
struct cocos2d::CCPoint v5; // rax
cocos2d *v6; // rax
const struct cocos2d::CCPoint *v7; // r8
bool v8; // r9
GameManager *v9; // rcx
GameStatsManager *v10; // rcx
GameStatsManager *v11; // rcx
struct cocos2d::CCPoint v13; // [rsp+30h] [rbp+8h] BYREF
struct cocos2d::CCPoint v14; // [rsp+48h] [rbp+20h] BYREF
v4 = *(_QWORD *)&a1->m_obAnchorPoint.y;
if ( !v4 || !a1->m_pShaderProgram || *(_DWORD *)(v4 + 328) - *(_DWORD *)(v4 + 332) != -1 )
return 0;
cocos2d::CCTouch::getLocation(a2);
v5 = cocos2d::CCNode::convertToNodeSpace((LevelPage *)((char *)a1 - 320), &v14);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(&v13, v5);
v6 = (cocos2d *)((__int64 (__fastcall *)(cocos2d::CCGLProgram *))a1->m_pShaderProgram->cocos2d::CCLayer::cocos2d::CCNode::__vftable[2].getTag)(a1->m_pShaderProgram);
if ( cocos2d::ccpDistance(v6, &v13, v7) <= 30.0 )
{
(*(void (__fastcall **)(cocos2d::CCScheduler **, _QWORD))&a1[-1].m_pScheduler[7].m_uID)(&a1[-1].m_pScheduler, 0);
LevelPage::playCoinEffect((LevelPage *)((char *)a1 - 320));
v9 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v14 = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v9 = (GameManager *)qword_1406C2ED8;
}
GameManager::reportAchievementWithID(v9, "geometry.ach.secret04", 100, v8);
v10 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v14 = (struct cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(*(_QWORD *)&v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v10 = (GameStatsManager *)qword_1406C2EE8;
}
GameStatsManager::storeSecretCoin(v10, "secret04");
v11 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v14 = (struct cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(*(_QWORD *)&v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v11 = (GameStatsManager *)qword_1406C2EE8;
}
GameStatsManager::incrementStat(v11, "8", 1);
}
return 1;
}