//
// GJShopLayer::ccTouchBegan from 0x4e2e40 to 0x4e2f76 (310 bytes)
//
// 1 xrefs:
// > `non-virtual thunk to'GJShopLayer::ccTouchBegan @ 0x4e2f98
//
// 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
//
bool GJShopLayer::ccTouchBegan(GJShopLayer *a1, cocos2d::CCTouch *a2, cocos2d::CCEvent *a3)
{
int v4; // r2
bool v5; // r3
float x; // s15
const cocos2d::CCPoint *v7; // r0
int v8; // r7
GameManager *v9; // r0
GameStatsManager *v10; // r5
stl::StringData::Internal *v11; // r2
stl::StringData::Internal *v12; // r3
int v13; // r5
AnimatedShopKeeper *m_shopKeeper; // r0
char *v16; // [sp+10h] [bp-20h] BYREF
cocos2d::CCPoint v17; // [sp+14h] [bp-1Ch] BYREF
cocos2d::CCRect v18; // [sp+1Ch] [bp-14h] BYREF
if ( a1->m_type )
{
LOBYTE(v8) = 0;
return v8;
}
cocos2d::CCTouch::getLocation(&v17, a2);
cocos2d::CCNode::convertToNodeSpace(&v18.origin, a1, &v17);
cocos2d::CCPoint::operator=((PlayerObject *)&v17, COERCE_FLOAT(&v18), v4, v5);
x = a1->m_shopKeeper->getPosition(a1->m_shopKeeper)->x;
v7 = a1->m_shopKeeper->getPosition(a1->m_shopKeeper);
cocos2d::CCRect::CCRect(&v18, x - 40.0, (float)(v7->y - 45.0) + 10.0, 80.0, 90.0);
v8 = cocos2d::CCRect::containsPoint(&v18, &v17);
if ( !v8 || a1->m_shopKeeper->m_reacting )
goto LABEL_3;
v9 = GameManager::sharedState();
if ( GameManager::getUGV(v9, "31") )
{
v10 = GameStatsManager::sharedState();
sub_776584((int)&v16, "0022");
v13 = (unsigned __int8)GameStatsManager::isSpecialChestUnlocked((int)v10, &v16, v11, v12) ^ 1;
sub_774008(&v16);
}
else
{
v13 = 0;
}
m_shopKeeper = a1->m_shopKeeper;
if ( m_shopKeeper->m_reactCount <= 4 && !v13 )
{
AnimatedShopKeeper::playReactAnimation(m_shopKeeper);
return v8;
}
m_shopKeeper->m_reactCount = 2;
GJShopLayer::showReactMessage(a1);
if ( a1->m_zolgurothDialogIndex == 9 )
a1->m_shopKeeper->m_reactCount = 0;
else
LABEL_3:
LOBYTE(v8) = 1;
return v8;
}