//
// LevelPage::ccTouchBegan from 0x140447820 to 0x140447b3b (795 bytes)
//
// 2 xrefs:
// > ??> @ 0x1407928e0
// > ??> @ 0x140927254
//
// This function is hookable on this platform (idp: pc, 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 11:32:24 +0000
//
// Hidden C++ exception states: #wind=4
char __fastcall LevelPage::ccTouchBegan(__int64 a1, __int64 a2)
{
__int64 v4; // rdx
__int64 v5; // rax
cocos2d *v6; // rax
const struct cocos2d::CCPoint *v7; // r8
__int64 v8; // rdx
__int64 v9; // rcx
__int64 v10; // r8
__int64 v11; // rdi
__int64 v12; // rbx
cocos2d::CCString *v13; // rax
int v14; // ebx
void *v15; // r8
__int64 v16; // rdx
__int64 v17; // rcx
__int64 v18; // r8
__int64 v19; // rax
__int64 v20; // rcx
__int64 v21; // rcx
void *v23; // [rsp+30h] [rbp-19h] BYREF
_BYTE v24[8]; // [rsp+38h] [rbp-11h] BYREF
__int128 v25; // [rsp+40h] [rbp-9h] BYREF
__int64 v26; // [rsp+50h] [rbp+7h]
__int64 v27; // [rsp+58h] [rbp+Fh]
void *Block[2]; // [rsp+60h] [rbp+17h] BYREF
__int64 v29; // [rsp+70h] [rbp+27h]
unsigned __int64 v30; // [rsp+78h] [rbp+2Fh]
v4 = *(_QWORD *)(a1 + 104);
if ( !v4 || !*(_QWORD *)(a1 + 240) || *(_DWORD *)(v4 + 328) - *(_DWORD *)(v4 + 332) != -1 )
return 0;
cocos2d::CCTouch::getLocation(a2, v24);
cocos2d::CCNode::convertToNodeSpace(a1 - 320, &v23, v24);
cocos2d::CCPoint::operator=(v24, v5);
v6 = (cocos2d *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 240) + 200LL))(*(_QWORD *)(a1 + 240));
if ( cocos2d::ccpDistance(v6, (const struct cocos2d::CCPoint *)v24, v7) <= 30.0 )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)(a1 - 320) + 920LL))(a1 - 320, 0);
LevelPage::playCoinEffect((_QWORD **)(a1 - 320));
v11 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v23 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v11 = qword_14090BFD0;
}
v12 = AchievementManager::sharedState(v9, v8, v10);
*(_OWORD *)Block = 0;
v29 = 0;
v30 = 0;
Block[0] = sub_14003D460(0x20u);
v29 = 21;
v30 = 31;
strcpy((char *)Block[0], "geometry.ach.secret04");
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v12 + 352), Block);
v14 = cocos2d::CCString::intValue(v13);
if ( v30 > 0xF )
{
v15 = Block[0];
if ( v30 + 1 >= 0x1000 )
{
v15 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v15 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v15);
}
v29 = 0;
v30 = 15;
LOBYTE(Block[0]) = 0;
if ( v14 < 100 )
{
v25 = 0;
v26 = 0;
v27 = 0;
*(_QWORD *)&v25 = sub_14003D460(0x20u);
v26 = 21;
v27 = 31;
strcpy((char *)v25, "geometry.ach.secret04");
GameManager::completedAchievement(v11, (__int64)&v25);
v19 = AchievementManager::sharedState(v17, v16, v18);
AchievementManager::reportAchievementWithID(v19, (__int64)"geometry.ach.secret04", 100);
}
v20 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v23 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v20 = qword_14090BFE0;
}
GameStatsManager::storeSecretCoin(v20, "secret04");
v21 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v23 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v21 = qword_14090BFE0;
}
GameStatsManager::incrementStat(v21, (const char *)&word_14070D038, 1u);
}
return 1;
}