//
// GJBaseGameLayer::parentForZLayer from 0x9f5e9c to 0x9f6898 (2556 bytes)
//
// 7 xrefs:
// > GameObject::parentForZLayer @ 0x76f24c
// > GameObject::parentForZLayer @ 0x76f270
// > LevelEditorLayer::claimCustomParticle @ 0x7871b4
// > GJBaseGameLayer::parentForZLayer @ 0x9f6004
// > GJBaseGameLayer::parentForZLayer @ 0x9f60b0
// > GJBaseGameLayer::claimCustomParticle @ 0x9f6e2c
// > ??> @ 0x7fdb0
//
// This function is hookable on this platform (idp: arm, 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 12:59:14 +0000
//
cocos2d::CCObject *__fastcall GJBaseGameLayer::parentForZLayer(
cocos2d::CCDictionary **this,
int a2,
unsigned __int8 a3,
int a4,
int a5)
{
int v5; // w23
__int64 v9; // x19
cocos2d::CCObject *result; // x0
__int64 v11; // x24
cocos2d::CCSpriteBatchNode *v12; // x0
unsigned int v13; // w2
cocos2d::CCObject *v14; // x21
CCNodeContainer *v15; // x0
cocos2d::CCSpriteBatchNode *v16; // x0
unsigned int v17; // w2
__int64 v18; // x19
void (__fastcall *v19)(__int64, cocos2d::CCObject *, _QWORD); // x20
unsigned int v20; // w0
v5 = a3;
if ( a5 )
{
if ( a4 != 5 )
{
v9 = 100000 * a4 + 1000000 + 100 * a2 + a3;
result = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(*(this + 1663), v9);
if ( result )
return result;
v15 = (CCNodeContainer *)GJBaseGameLayer::parentForZLayer((GJBaseGameLayer *)this, a2, v5, a4, 0);
v11 = (__int64)v15;
if ( a4 == 4 )
{
v14 = (cocos2d::CCObject *)CCNodeContainer::create(v15);
goto LABEL_44;
}
v16 = (cocos2d::CCSpriteBatchNode *)(*(__int64 (__fastcall **)(CCNodeContainer *))(*(_QWORD *)v15 + 896LL))(v15);
v14 = (cocos2d::CCObject *)cocos2d::CCSpriteBatchNode::createWithTexture(
v16,
(cocos2d::CCTexture2D *)((char *)&off_18 + 5),
v17);
if ( !v5 )
{
LABEL_44:
cocos2d::CCDictionary::setObject(*(this + 1663), v14, v9);
v18 = (__int64)*(this + 1664);
v19 = *(void (__fastcall **)(__int64, cocos2d::CCObject *, _QWORD))(*(_QWORD *)v18 + 464LL);
v20 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v11 + 104LL))(v11);
v19(v18, v14, v20);
return v14;
}
LABEL_31:
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v14 + 912LL))(v14, 0x100000302LL);
goto LABEL_44;
}
v9 = 100 * a2 + 1500001;
result = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(*(this + 1663), v9);
if ( !result )
{
v11 = GJBaseGameLayer::parentForZLayer((GJBaseGameLayer *)this, a2, 1, 5, 0);
v12 = (cocos2d::CCSpriteBatchNode *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v11 + 896LL))(v11);
v14 = (cocos2d::CCObject *)cocos2d::CCSpriteBatchNode::createWithTexture(
v12,
(cocos2d::CCTexture2D *)((char *)&off_18 + 5),
v13);
goto LABEL_31;
}
}
else if ( a4 == 5 )
{
if ( a2 < -4 )
{
return *(this + 395);
}
else if ( a2 < -2 )
{
return *(this + 381);
}
else if ( a2 < 0 )
{
return *(this + 367);
}
else if ( a2 <= 1 )
{
return *(this + 353);
}
else if ( a2 <= 4 )
{
return *(this + 339);
}
else if ( a2 == 5 )
{
return *(this + 319);
}
else if ( a2 <= 7 )
{
return *(this + 305);
}
else if ( a2 > 9 )
{
return *(this + 277);
}
else
{
return *(this + 291);
}
}
else if ( a4 == 4 )
{
if ( a2 < -4 )
{
return *(this + 396);
}
else if ( a2 < -2 )
{
return *(this + 382);
}
else if ( a2 < 0 )
{
return *(this + 368);
}
else if ( a2 <= 1 )
{
return *(this + 354);
}
else if ( a2 <= 3 )
{
return *(this + 340);
}
else if ( a2 <= 5 )
{
return *(this + 320);
}
else if ( a2 <= 7 )
{
return *(this + 306);
}
else if ( a2 > 9 )
{
return *(this + 278);
}
else
{
return *(this + 292);
}
}
else if ( a3 )
{
switch ( a4 )
{
case 1:
if ( a2 < -4 )
return *(this + 406);
if ( a2 < -2 )
return *(this + 392);
if ( a2 < 0 )
return *(this + 378);
if ( a2 <= 1 )
return *(this + 364);
if ( a2 <= 3 )
return *(this + 350);
if ( a2 == 4 )
return *(this + 336);
if ( a2 == 5 )
return *(this + 330);
if ( a2 <= 7 )
return *(this + 316);
if ( a2 <= 9 )
return *(this + 302);
if ( a2 > 11 )
return *(this + 274);
return *(this + 288);
case 2:
if ( *((_BYTE *)this + 4104) )
goto LABEL_171;
if ( a2 < -4 )
{
result = *(this + 398);
}
else if ( a2 < -2 )
{
result = *(this + 384);
}
else if ( a2 < 0 )
{
result = *(this + 370);
}
else if ( a2 <= 1 )
{
result = *(this + 356);
}
else if ( a2 <= 3 )
{
LABEL_171:
result = *(this + 342);
}
else if ( a2 <= 5 )
{
result = *(this + 322);
}
else if ( a2 <= 7 )
{
result = *(this + 308);
}
else if ( a2 > 9 )
{
result = *(this + 280);
}
else
{
result = *(this + 294);
}
break;
case 3:
if ( *((_BYTE *)this + 4104) )
return *(this + 344);
if ( a2 < -4 )
{
result = *(this + 400);
}
else if ( a2 < -2 )
{
result = *(this + 386);
}
else if ( a2 < 0 )
{
result = *(this + 372);
}
else if ( a2 <= 1 )
{
result = *(this + 358);
}
else
{
if ( a2 <= 3 )
return *(this + 344);
if ( a2 == 4 )
{
result = *(this + 333);
}
else if ( a2 == 5 )
{
result = *(this + 324);
}
else if ( a2 <= 7 )
{
result = *(this + 310);
}
else if ( a2 <= 9 )
{
result = *(this + 296);
}
else if ( a2 > 11 )
{
result = *(this + 271);
}
else
{
result = *(this + 282);
}
}
break;
case 6:
if ( a2 < -4 )
return *(this + 402);
if ( a2 < -2 )
return *(this + 388);
if ( a2 < 0 )
return *(this + 374);
if ( a2 <= 1 )
return *(this + 360);
if ( a2 <= 3 )
return *(this + 346);
if ( a2 == 4 )
return *(this + 334);
if ( a2 == 5 )
return *(this + 326);
if ( a2 <= 7 )
return *(this + 312);
if ( a2 <= 9 )
return *(this + 298);
if ( a2 > 11 )
return *(this + 272);
return *(this + 284);
case 8:
if ( a2 < -4 )
return *(this + 404);
if ( a2 < -2 )
return *(this + 390);
if ( a2 < 0 )
return *(this + 376);
if ( a2 <= 1 )
return *(this + 362);
if ( a2 <= 3 )
return *(this + 348);
if ( a2 == 4 )
return *(this + 335);
if ( a2 == 5 )
return *(this + 328);
if ( a2 <= 7 )
return *(this + 314);
if ( a2 <= 9 )
return *(this + 300);
if ( a2 > 11 )
return *(this + 273);
return *(this + 286);
default:
if ( a2 < -4 )
return *(this + 394);
if ( a2 < -2 )
return *(this + 380);
if ( a2 < 0 )
return *(this + 366);
if ( a2 <= 1 )
return *(this + 352);
if ( a2 <= 3 )
return *(this + 338);
if ( a2 == 4 )
return *(this + 332);
if ( a2 == 5 )
return *(this + 318);
if ( a2 <= 7 )
return *(this + 304);
if ( a2 <= 9 )
return *(this + 290);
if ( a2 > 11 )
return *(this + 270);
return *(this + 276);
}
}
else
{
switch ( a4 )
{
case 1:
if ( a2 < -4 )
return *(this + 405);
if ( a2 < -2 )
return *(this + 391);
if ( a2 < 0 )
return *(this + 377);
if ( a2 <= 1 )
return *(this + 363);
if ( a2 <= 3 )
return *(this + 349);
if ( a2 == 4 )
return *(this + 331);
if ( a2 == 5 )
return *(this + 329);
if ( a2 <= 7 )
return *(this + 315);
if ( a2 > 9 )
return *(this + 287);
return *(this + 301);
case 2:
if ( *((_BYTE *)this + 4104) )
return *(this + 341);
if ( a2 < -4 )
{
result = *(this + 397);
}
else if ( a2 < -2 )
{
result = *(this + 383);
}
else if ( a2 < 0 )
{
result = *(this + 369);
}
else if ( a2 <= 1 )
{
result = *(this + 355);
}
else
{
if ( a2 <= 3 )
return *(this + 341);
if ( a2 <= 5 )
{
result = *(this + 321);
}
else if ( a2 <= 7 )
{
result = *(this + 307);
}
else if ( a2 > 9 )
{
result = *(this + 279);
}
else
{
result = *(this + 293);
}
}
break;
case 3:
if ( *((_BYTE *)this + 4104) )
goto LABEL_170;
if ( a2 < -4 )
{
result = *(this + 399);
}
else if ( a2 < -2 )
{
result = *(this + 385);
}
else if ( a2 < 0 )
{
result = *(this + 371);
}
else if ( a2 <= 1 )
{
result = *(this + 357);
}
else if ( a2 <= 3 )
{
LABEL_170:
result = *(this + 343);
}
else if ( a2 <= 5 )
{
result = *(this + 323);
}
else if ( a2 <= 7 )
{
result = *(this + 309);
}
else if ( a2 > 9 )
{
result = *(this + 281);
}
else
{
result = *(this + 295);
}
break;
case 6:
if ( a2 < -4 )
return *(this + 401);
if ( a2 < -2 )
return *(this + 387);
if ( a2 < 0 )
return *(this + 373);
if ( a2 <= 1 )
return *(this + 359);
if ( a2 <= 3 )
return *(this + 345);
if ( a2 <= 5 )
return *(this + 325);
if ( a2 <= 7 )
return *(this + 311);
if ( a2 > 9 )
return *(this + 283);
return *(this + 297);
case 8:
if ( a2 < -4 )
return *(this + 403);
if ( a2 < -2 )
return *(this + 389);
if ( a2 < 0 )
return *(this + 375);
if ( a2 <= 1 )
return *(this + 361);
if ( a2 <= 3 )
return *(this + 347);
if ( a2 <= 5 )
return *(this + 327);
if ( a2 <= 7 )
return *(this + 313);
if ( a2 > 9 )
return *(this + 285);
return *(this + 299);
default:
if ( a2 < -4 )
return *(this + 393);
if ( a2 < -2 )
return *(this + 379);
if ( a2 < 0 )
return *(this + 365);
if ( a2 <= 1 )
return *(this + 351);
if ( a2 <= 3 )
return *(this + 337);
if ( a2 <= 5 )
return *(this + 317);
if ( a2 <= 7 )
return *(this + 303);
if ( a2 <= 9 )
return *(this + 289);
return *(this + 275);
}
}
return result;
}