//
// PlayLayer::showNewBest from 0x10011ae58 to 0x10011b844 (2540 bytes)
//
// 2 xrefs:
// > PlayLayer::destroyPlayer @ 0x10011ee3c
// > PlayLayer::destroyPlayer @ 0x10011eedc
//
// 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
//
void __fastcall PlayLayer::showNewBest(PlayLayer *a1, bool a2, int a3, int a4, bool a5, bool a6, bool a7)
{
_BOOL4 v8; // w22
int v13; // w28
unsigned int v14; // w21
float v15; // s8
cocos2d::CCDirector *v16; // x0
__n128 v17; // q0
__n128 v18; // q1
cocos2d::CCNode *v19; // x20
cocos2d::CCLabelBMFont *v20; // x25
__n128 v21; // q0
__n128 v22; // q1
__n128 v23; // q0
__n128 v24; // q1
unsigned int v25; // w8
std::string *v26; // x0
cocos2d::CCLabelBMFont *v27; // x25
__n128 v28; // q0
__n128 v29; // q1
__n128 v30; // q0
__n128 v31; // q1
cocos2d::CCSprite *v32; // x25
__n128 v33; // q0
__n128 v34; // q1
cocos2d::CCString *v35; // x0
const char *CString; // x0
cocos2d::CCLabelBMFont *v37; // x25
__n128 v38; // q0
__n128 v39; // q1
__n128 v40; // q0
__n128 v41; // q1
float v43; // s8
cocos2d::CCString *v44; // x0
const char *v45; // x0
cocos2d::CCLabelBMFont *v46; // x26
cocos2d::CCSprite *v47; // x25
__n128 v48; // q0
__n128 v49; // q1
__n128 v50; // q0
__n128 v51; // q1
int v52; // w28
FMODAudioEngine *v53; // x27
float v54; // s9
float v55; // s9
float v56; // s10
float v57; // s10
float v58; // s11
float32x2_t *v59; // x27
float v60; // s9
__n128 v61; // q0
__n128 v62; // q1
double v63; // d0
cocos2d::CCString *v64; // x0
const char *v65; // x0
cocos2d::CCLabelBMFont *v66; // x26
cocos2d::CCSprite *v67; // x25
__n128 v68; // q0
__n128 v69; // q1
FMODAudioEngine *v70; // x27
__n128 v71; // q0
__n128 v72; // q1
float v73; // s9
float v74; // s9
float v75; // s10
float v76; // s10
float v77; // s11
float32x2_t *v78; // x27
float v79; // s8
__n128 v80; // q0
__n128 v81; // q1
double v82; // d0
CurrencySpriteType v83; // w25
float v84; // s2
float v85; // s3
CurrencyRewardLayer *v86; // x23
FMODAudioEngine *v87; // x22
float v88; // s9
cocos2d::CCScaleTo *v89; // x0
cocos2d::CCEaseElasticOut *v90; // x21
cocos2d::CCScaleTo *v91; // x0
cocos2d::CCAction *v92; // x0
cocos2d::CCLayerColor *v93; // x20
cocos2d::CCFadeTo *v94; // x19
cocos2d::CCAction *v95; // x0
int v97; // [xsp+2Ch] [xbp-F4h]
void *v98[2]; // [xsp+30h] [xbp-F0h] BYREF
char v99; // [xsp+47h] [xbp-D9h]
void *v100[2]; // [xsp+48h] [xbp-D8h] BYREF
char v101; // [xsp+5Fh] [xbp-C1h]
void *__p[2]; // [xsp+60h] [xbp-C0h] BYREF
char v103; // [xsp+77h] [xbp-A9h]
float32x2_t v104; // [xsp+78h] [xbp-A8h] BYREF
std::string v105; // [xsp+80h] [xbp-A0h] BYREF
_DWORD v106[6]; // [xsp+98h] [xbp-88h] BYREF
cocos2d::SEL_CallFunc v107; // 0:x1.16
cocos2d::SEL_CallFunc v108; // 0:x1.16
cocos2d::CCPoint v109; // 0:s0.4,4:s1.4
v8 = a5;
v13 = a4 + a3;
if ( (a4 + a3 < 0) ^ __OFADD__(a4, a3) | (a4 + a3 == 0) )
v14 = 0;
else
v14 = 1;
if ( (a4 + a3 < 0) ^ __OFADD__(a4, a3) | (a4 + a3 == 0) )
v15 = 0.0;
else
v15 = 10.0;
v16 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v16);
v17.n128_f32[0] = *(float *)&v106[2] * 0.5;
v18.n128_f32[0] = v15 + (float)((float)(*(float *)&v106[3] * 0.5) + 20.0);
sub_100022980(v17, v18, v106);
v19 = cocos2d::CCNode::create();
((void (__fastcall *)(PlayLayer *, cocos2d::CCNode *, __int64))a1->addChild_0)(a1, v19, 100);
((void (__fastcall *)(cocos2d::CCNode *, _DWORD *))v19->setPosition)(v19, v106);
if ( a7 )
goto LABEL_20;
if ( a2 )
{
if ( !a1->m_doNot )
{
v20 = cocos2d::CCLabelBMFont::create_1("New Reward!", "goldFont.fnt");
v21 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v20->setScale)(v20, 1.2);
v21.n128_u32[0] = 0;
v22.n128_u32[0] = 5.0;
sub_100022980(v21, v22, &v105);
v23 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v20->setPosition)(v20, &v105);
v23.n128_u32[0] = 0.5;
v24.n128_u32[0] = 0;
sub_100022980(v23, v24, &v105);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v20->setAnchorPoint)(v20, &v105);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCLabelBMFont *))v19->addChild)(v19, v20);
goto LABEL_20;
}
}
else if ( !a1->m_doNot )
{
v32 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_newBest_001.png");
v33 = ((__n128 (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSprite *))v19->addChild)(v19, v32);
v33.n128_u32[0] = 0.5;
v34.n128_u32[0] = 0;
sub_100022980(v33, v34, &v105);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v32->setAnchorPoint)(v32, &v105);
goto LABEL_20;
}
sub_100009900(&v105, "RIP");
v25 = llroundf(vcvts_n_f32_s32(rand(), 0x1Fu) * 90.0) - 1;
if ( v25 < 0x5A )
std::string::assign(&v105, off_100790DD8[v25]);
if ( (v105.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v26 = &v105;
else
v26 = (std::string *)v105.__r_.__value_.__r.__words[0];
v27 = cocos2d::CCLabelBMFont::create_1((const char *)v26, "goldFont.fnt");
v28 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v27->setScale)(v27, 1.2);
v28.n128_u32[0] = 0;
v29.n128_u32[0] = 5.0;
sub_100022980(v28, v29, &v104);
v30 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v27->setPosition)(v27, &v104);
v30.n128_u32[0] = 0.5;
v31.n128_u32[0] = 0;
sub_100022980(v30, v31, &v104);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v27->setAnchorPoint)(v27, &v104);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCLabelBMFont *))v19->addChild)(v19, v27);
if ( SHIBYTE(v105.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v105.__r_.__value_.__l.__data_);
LABEL_20:
v97 = v13;
v35 = (cocos2d::CCString *)sub_100268F4C("%i%%", a1->m_lastAttemptPercent);
CString = cocos2d::CCString::getCString(v35);
v37 = cocos2d::CCLabelBMFont::create_1(CString, "bigFont.fnt");
v38.n128_u32[0] = 0.5;
v39.n128_u32[0] = 1.0;
sub_100022980(v38, v39, &v105);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v37->setAnchorPoint)(v37, &v105);
v40 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v37->setScale)(v37, 1.1);
v40.n128_u32[0] = 0;
v41.n128_u32[0] = -4.0;
sub_100022980(v40, v41, &v105);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v37->setPosition)(v37, &v105);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCLabelBMFont *))v19->addChild)(v19, v37);
if ( a4 <= 0 || a3 <= 0 )
v43 = -5.0;
else
v43 = -20.0;
if ( a4 < 1 )
{
v52 = v8;
if ( a3 < 1 )
goto LABEL_50;
}
else
{
v44 = (cocos2d::CCString *)sub_100268F4C("+%i", a4);
v45 = cocos2d::CCString::getCString(v44);
v46 = cocos2d::CCLabelBMFont::create_1(v45, "bigFont.fnt");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v46->setScale)(v46, 0.6);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCLabelBMFont *))v19->addChild)(v19, v46);
v47 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigDiamond_001.png");
v48.n128_u32[0] = 0;
v49.n128_u32[0] = 0.5;
sub_100022980(v48, v49, &v105);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v47->setAnchorPoint)(v47, &v105);
((void (__fastcall *)(cocos2d::CCSprite *, float))v47->setScale)(v47, 0.55);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSprite *))v19->addChild)(v19, v47);
v52 = v8;
if ( !v8 )
{
v53 = FMODAudioEngine::sharedEngine();
sub_100009900(__p, "gold02.ogg");
FMODAudioEngine::playEffect_1(v53, __p);
if ( v103 < 0 )
operator delete(__p[0]);
}
if ( a3 <= 0 )
{
v54 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v46->getContentSize)(v46);
v55 = (float)(v54 * ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v46->getScale)(v46)) + 1.0;
v56 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v47->getContentSize)(v47);
v57 = (float)(v55 + (float)(v56 * ((float (__fastcall *)(cocos2d::CCSprite *))v47->getScale)(v47))) * 0.5;
v58 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v46->getContentSize)(v46);
v50.n128_f32[0] = -(float)(v57
- (float)((float)(v58
* ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v46->getScale)(v46))
* 0.5));
}
else
{
v50.n128_u32[0] = 1109393408;
}
v50.n128_f32[0] = v43 + v50.n128_f32[0];
v51.n128_u32[0] = -1032323072;
sub_100022980(v50, v51, &v105);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v46->setPosition)(v46, &v105);
v59 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v46->getPosition)(v46);
v60 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v46->getContentSize)(v46) * 0.5;
v61.n128_f64[0] = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))v46->getScale)(v46);
v61.n128_f32[0] = (float)(v60 * v61.n128_f32[0]) + 1.0;
v62.n128_u32[0] = -1.0;
sub_100022980(v61, v62, &v104);
*(float32x2_t *)&v63 = sub_1000229DC(v59, &v104, (float32x2_t *)&v105);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *, double))v47->setPosition)(v47, &v105, v63);
if ( a3 <= 0 )
goto LABEL_42;
}
v64 = (cocos2d::CCString *)sub_100268F4C("+%i", a3);
v65 = cocos2d::CCString::getCString(v64);
v66 = cocos2d::CCLabelBMFont::create_1(v65, "bigFont.fnt");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v66->setScale)(v66, 0.6);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCLabelBMFont *))v19->addChild)(v19, v66);
v67 = cocos2d::CCSprite::createWithSpriteFrameName("currencyOrbIcon_001.png");
v68.n128_u32[0] = 0;
v69.n128_u32[0] = 0.5;
sub_100022980(v68, v69, &v105);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v67->setAnchorPoint)(v67, &v105);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSprite *))v19->addChild)(v19, v67);
v70 = FMODAudioEngine::sharedEngine();
sub_100009900(v100, "magicExplosion.ogg");
FMODAudioEngine::playEffect_1(v70, v100);
if ( v101 < 0 )
operator delete(v100[0]);
if ( a4 <= 0 )
{
v73 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v66->getContentSize)(v66);
v74 = (float)(v73 * ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v66->getScale)(v66)) + 5.0;
v75 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v67->getContentSize)(v67);
v76 = (float)(v74 + (float)(v75 * ((float (__fastcall *)(cocos2d::CCSprite *))v67->getScale)(v67))) * 0.5;
v77 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v66->getContentSize)(v66);
v71.n128_f32[0] = -(float)(v76
- (float)((float)(v77 * ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v66->getScale)(v66))
* 0.5));
}
else
{
v71.n128_u32[0] = -1038090240;
}
v71.n128_f32[0] = v43 + v71.n128_f32[0];
v72.n128_u32[0] = -1032323072;
sub_100022980(v71, v72, &v105);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v66->setPosition)(v66, &v105);
v78 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v66->getPosition)(v66);
v79 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v66->getContentSize)(v66) * 0.5;
v80.n128_f64[0] = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))v66->getScale)(v66);
v80.n128_f32[0] = (float)(v79 * v80.n128_f32[0]) + 5.0;
v81.n128_u32[0] = -0.5;
sub_100022980(v80, v81, &v104);
*(float32x2_t *)&v82 = sub_1000229DC(v78, &v104, (float32x2_t *)&v105);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *, double))v67->setPosition)(v67, &v105, v82);
LABEL_42:
cocos2d::CCNode::convertToWorldSpace(a1->m_player1, &stru_10086B290);
if ( v52 )
v83 = DemonKey;
else
v83 = Icon;
sub_1000229B8((__int64 *)&v104, (__int64 *)&v105);
v109.y = 0.9;
v109.x = 0.0;
v86 = CurrencyRewardLayer::create(a3, 0, 0, a4, v83, v52, Icon, 0, v109, (CurrencyRewardType)&v104, v84, v85);
((void (__fastcall *)(PlayLayer *, CurrencyRewardLayer *, __int64))a1->addChild_0)(a1, v86, 101);
if ( v52 )
{
v87 = FMODAudioEngine::sharedEngine();
sub_100009900(v98, "secretKey.ogg");
FMODAudioEngine::playEffect_1(v87, v98);
if ( v99 < 0 )
operator delete(v98[0]);
}
if ( !a6 )
v86->m_delegate = &a1->CurrencyRewardDelegate;
LABEL_50:
v88 = flt_100636F80[v14];
((void (__fastcall *)(cocos2d::CCNode *, float))v19->setScale)(v19, 0.01);
v89 = cocos2d::CCScaleTo::create_1(0.4, 1.0);
v90 = cocos2d::CCEaseElasticOut::create(v89, 0.6);
cocos2d::CCDelayTime::create(v88);
v91 = cocos2d::CCScaleTo::create(0.2, 0.01, 0.01);
cocos2d::CCEaseIn::create(v91, 2.0);
cocos2d::CCHide::create();
v107.ptr = (void (*)(void))520;
v107.adj = 1;
cocos2d::CCCallFunc::create(v19, v107);
v92 = (cocos2d::CCAction *)sub_10018A494(v90);
cocos2d::CCNode::runAction(v19, v92);
if ( v97 >= 1 )
{
LODWORD(v105.__r_.__value_.__l.__data_) = 0;
v93 = cocos2d::CCLayerColor::create_1((const cocos2d::ccColor4B *)&v105);
((void (__fastcall *)(PlayLayer *, cocos2d::CCLayerColor *, __int64))a1->addChild_0)(a1, v93, 99);
v94 = cocos2d::CCFadeTo::create(0.3, 0x64u);
cocos2d::CCDelayTime::create(1.6);
cocos2d::CCFadeTo::create(0.4, 0);
v108.ptr = (void (*)(void))520;
v108.adj = 1;
cocos2d::CCCallFunc::create(v93, v108);
v95 = (cocos2d::CCAction *)sub_10018A494(v94);
cocos2d::CCNode::runAction(v93, v95);
}
}