//
// MapSelectLayer::checkTouchMonster from 0x97ec4c to 0x97f178 (1324 bytes)
//
// 2 xrefs:
// > MapSelectLayer::ccTouchBegan @ 0x97f220
// > ??> @ 0x2c838
//
// 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 MapSelectLayer::checkTouchMonster(MapSelectLayer *a1, cocos2d::CCPoint a2)
{
const cocos2d::CCPoint *v2; // x1
const cocos2d::CCPoint *v4; // x24
unsigned int v5; // w19
bool v6; // w25
GJMapObject *v7; // x21
__int64 v8; // x28
FMODAudioEngine *v10; // x25
int v11; // w0
unsigned int *v12; // x2
void *v13; // x0
cocos2d::CCParticleSystem *v14; // x28
void (__fastcall *setStartColor)(cocos2d::CCParticleSystem *__hidden, const cocos2d::ccColor4F *); // x2
CCCircleWave *v16; // x0
CCCircleWave_vtbl *v17; // x2
int v18; // w2
cocos2d::CCRenderTexture *v19; // x22
const cocos2d::CCPoint *v20; // x0
ExplodeItemNode *v21; // x22
cocos2d::CCNode *m_mainLayer; // x0
cocos2d::CCNode_vtbl *v23; // x3
float v24; // s12
int v25; // w0
bool v26; // w5
int v27; // w1
cocos2d::ccColor4F v28; // [xsp+0h] [xbp-20h]
cocos2d::CCNode *v29; // [xsp+D0h] [xbp+B0h]
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+D0h] [xbp+B0h]
cocos2d::CCPoint v31; // [xsp+E8h] [xbp+C8h] BYREF
cocos2d::CCPoint v32; // [xsp+F0h] [xbp+D0h] BYREF
unsigned __int64 v33; // [xsp+F8h] [xbp+D8h] BYREF
int v34; // [xsp+100h] [xbp+E0h]
float v35; // [xsp+104h] [xbp+E4h]
cocos2d::ccColor4F v36; // 0:x3.16
v4 = v2;
v5 = 0;
v6 = 0;
while ( v5 < (unsigned int)cocos2d::CCArray::count(a1->m_monsters) )
{
while ( 1 )
{
v7 = (GJMapObject *)cocos2d::CCArray::objectAtIndex(a1->m_monsters, v5);
v8 = (__int64)v7->getPosition(v7);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v33, 0.0, 5.0);
cocos2d::CCPoint::operator+(&v31, v8, &v33);
if ( cocos2d::ccpDistance(v4, &v31) < 20.0 )
break;
if ( ++v5 >= (unsigned int)cocos2d::CCArray::count(a1->m_monsters) )
return v6;
}
GJMapObject::touchMonster(v7);
if ( v7->m_monstersTouched > 9 )
{
v10 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v33, "explode_11.ogg");
v11 = rand();
FMODAudioEngine::playEffect(
(__int64)v10,
(__int64)&v33,
(float)((float)((float)((float)((float)v11 * 4.6566e-10) * 2.0) + -1.0) * 0.05) + 0.95,
0.0,
0.5);
LOBYTE(v12) = v33;
v13 = (void *)(v33 - 24);
if ( (__int64 *)(v33 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v33 - 8);
do
v27 = __ldaxr(v12);
while ( __stlxr(v27 - 1, v12) );
}
else
{
v27 = *(_DWORD *)(v33 - 8);
*(_DWORD *)(v33 - 8) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v13);
}
v6 = 1;
v14 = (cocos2d::CCParticleSystem *)cocos2d::CCParticleSystemQuad::create(
(cocos2d::CCParticleSystemQuad *)"explodeEffect.plist",
nullptr,
(bool)v12);
v14->setPositionType(v14, kCCPositionTypeGrouped);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v14, 1);
v14->setAutoRemoveOnFinish(v14, 1);
v14->setPosition(v14, &v31);
v14->setScale(v14, 0.3);
setStartColor = v14->setStartColor;
v34 = 0;
v33 = COERCE_UNSIGNED_INT(1.0);
v35 = 1.0;
setStartColor(v14, (const cocos2d::ccColor4F *)&v33);
cocos2d::CCParticleSystem::resetSystem(v14);
v16 = CCCircleWave::create(10.0, 40.0, 0.4, 0);
v17 = v16->__vftable;
*(_WORD *)&v16->m_color.r = 255;
v16->m_color.b = 0;
v29 = v16;
v17->setPosition(v16, &v31);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v29, 0);
v19 = (cocos2d::CCRenderTexture *)cocos2d::CCRenderTexture::create(
(cocos2d::CCRenderTexture *)((char *)&dword_30 + 2),
(int)&dword_30 + 2,
v18);
v7->m_shadowSprite->setVisible(v7->m_shadowSprite, 0);
v20 = v7->getPosition(v7);
cocos2d::CCPoint::CCPoint(&v32, v20);
setPosition = v7->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v33, 25.0, 25.0);
setPosition(v7, (const cocos2d::CCPoint *)&v33);
cocos2d::CCRenderTexture::beginWithClear(v19, 0.0, 0.0, 0.0, 0.0);
v7->visit(v7);
cocos2d::CCRenderTexture::end(v19);
v7->setPosition(v7, &v32);
v21 = ExplodeItemNode::create(v19);
m_mainLayer = a1->m_mainLayer;
v23 = m_mainLayer->__vftable;
v21->m_floorHeight = -100.0;
v23->addChild_0(m_mainLayer, v21, 101);
v21->setPosition(v21, &v32);
*(float *)&setPosition = (float)((float)((float)((float)rand() * 4.6566e-10) * 2.0) + -1.0) * 3.0;
v24 = roundf((float)((float)rand() * 4.6566e-10) * 4.0);
v25 = rand();
v28.r = 1.0;
v28.g = 1.0;
*(_QWORD *)&v36.r = 1;
*(_QWORD *)&v28.b = *(_QWORD *)&v28.r;
ExplodeItemNode::createSprites(
v21,
(int)(v24 + 4.0),
(int)(roundf((float)((float)v25 * 4.6566e-10) * 4.0) + 4.0),
*(float *)&setPosition * 0.5,
*(float *)&setPosition,
4.0,
2.0,
6.4,
0.0,
v28,
v36,
v26);
v7->removeFromParentAndCleanup(v7, 1);
cocos2d::CCArray::removeObjectAtIndex(a1->m_monsters, v5, 1);
}
else
{
++v5;
v6 = 1;
}
}
return v6;
}