//
// PlayLayer::showNewBest from 0x100082b90 to 0x10008368e (2814 bytes)
//
// 2 xrefs:
// > PlayLayer::destroyPlayer @ 0x1000880a1
// > PlayLayer::destroyPlayer @ 0x100088160
//
// 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 12:20:03 +0000
//
__int64 __fastcall PlayLayer::showNewBest(_BYTE *a1, __int64 a2, int a3, int a4, int a5, int a6, char a7)
{
int v8; // xmm0_4
__int64 v9; // rax
__int64 v10; // r14
__int64 v11; // rbx
int v12; // r14d
char v13; // al
__m128 v14; // xmm0
__m128 v15; // xmm1
unsigned int v16; // eax
std::string::pointer data; // rdi
__int64 v18; // r15
__int64 v19; // r12
__int64 v20; // r12
__int64 v21; // rax
__int64 CString; // rax
__int64 v23; // r12
__int64 v24; // rax
__int64 v25; // rax
__int64 v26; // rax
__int64 v27; // r13
__int64 v28; // r12
__int64 v29; // rax
float v30; // xmm0_4
float v31; // xmm0_4
__int128 v32; // xmm0
__int128 v33; // xmm1
__int64 v34; // r15
float v35; // xmm0_4
__int64 v36; // rax
__int64 v37; // rax
__int64 v38; // r13
__int64 v39; // r14
__int64 v40; // r12
double v41; // xmm0_8
__int64 v42; // rax
float v43; // xmm1_4
float v44; // xmm0_4
__int128 v45; // xmm0
__int128 v46; // xmm1
__int64 v47; // r15
float v48; // xmm0_4
_QWORD *v49; // rbx
char v50; // r12
int v51; // r15d
__int64 v52; // r15
__int64 v53; // rax
__int64 v54; // r14
__int64 v55; // rax
int v56; // r15d
int v57; // r12d
__int64 v58; // rdi
int v59; // ebx
int v60; // r13d
int v61; // eax
__int64 v62; // rsi
__int64 result; // rax
__int64 v64; // r14
int v65; // ebx
int v66; // r15d
int v67; // r12d
int v68; // eax
int v69; // r9d
__int64 v70; // rax
char v71; // [rsp+0h] [rbp-100h]
char v72; // [rsp+0h] [rbp-100h]
char v73[8]; // [rsp+20h] [rbp-E0h] BYREF
float v74[2]; // [rsp+28h] [rbp-D8h] BYREF
char v75; // [rsp+30h] [rbp-D0h] BYREF
_BYTE v76[23]; // [rsp+31h] [rbp-CFh] BYREF
void *v77[3]; // [rsp+48h] [rbp-B8h] BYREF
char v78; // [rsp+60h] [rbp-A0h] BYREF
_BYTE v79[23]; // [rsp+61h] [rbp-9Fh] BYREF
_QWORD *v80; // [rsp+78h] [rbp-88h]
int v81; // [rsp+80h] [rbp-80h]
int v82; // [rsp+84h] [rbp-7Ch]
int v83; // [rsp+88h] [rbp-78h]
int v84; // [rsp+8Ch] [rbp-74h]
__int64 v85; // [rsp+90h] [rbp-70h]
char v86[8]; // [rsp+98h] [rbp-68h] BYREF
__int128 v87; // [rsp+A0h] [rbp-60h]
std::string v88; // [rsp+B0h] [rbp-50h] BYREF
float v89; // [rsp+C8h] [rbp-38h]
bool v90; // [rsp+CFh] [rbp-31h]
float v91; // [rsp+D0h] [rbp-30h]
float v92; // [rsp+D4h] [rbp-2Ch]
v82 = a6;
v84 = a5;
v89 = *(float *)&a4;
v83 = a3;
if ( (a3 + a4 < 0) ^ __OFADD__(a3, a4) | (a3 + a4 == 0) )
v8 = 0;
else
v8 = 1092616192;
LODWORD(v85) = v8;
v81 = a3 + a4;
v90 = a3 + a4 > 0;
v9 = cocos2d::CCDirector::sharedDirector(a1, a2);
cocos2d::CCDirector::getWinSize(v74, v9);
sub_100278250(v73, v74[0] * 0.5, (float)((float)(0.5 * v74[1]) + 20.0) + *(float *)&v85);
v10 = cocos2d::CCNode::create(v73);
(*(void (__fastcall **)(_BYTE *, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v10, 100);
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v10 + 184LL))(v10, v73);
v11 = v10;
v12 = v83;
if ( !a7 )
{
v13 = a1[14400];
if ( (_BYTE)a2 && (v13 & 1) == 0 )
{
v19 = cocos2d::CCLabelBMFont::create_3("New Reward!", "goldFont.fnt");
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v19 + 160LL))(v19, 1.2);
sub_100278250(&v88, 0.0, 5.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v19 + 184LL))(v19, &v88);
sub_100278250(&v88, 0.5, 0.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v19 + 296LL))(v19, &v88);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v11 + 456LL))(v11, v19);
}
else if ( (v13 & 1) != 0 )
{
v88.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)6;
*(_DWORD *)((char *)&v88.__r_.__value_.__l.0 + 1) = 5261650;
v14 = 0;
v14.f32[0] = (float)((float)rand() * 4.6566129e-10) * 90.0;
v15 = _mm_or_ps(_mm_and_ps((__m128)xmmword_100A035F0, v14), (__m128)xmmword_100A03600);
v15.f32[0] = v15.f32[0] + v14.f32[0];
v16 = (int)_mm_round_ss((__m128)0LL, v15, 11).f32[0] - 1;
if ( v16 < 0x5A )
std::string::assign(&v88, (const std::string::value_type *)&unk_100A04278 + *((int *)&unk_100A04278 + v16));
if ( (*(_BYTE *)&v88.__r_.__value_.__s.0 & 1) != 0 )
data = v88.__r_.__value_.__l.__data_;
else
data = v88.__r_.__value_.__s.__data_;
v20 = cocos2d::CCLabelBMFont::create_3(data, "goldFont.fnt");
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v20 + 160LL))(v20, 1.2);
sub_100278250(v86, 0.0, 5.0);
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v20 + 184LL))(v20, v86);
sub_100278250(v86, 0.5, 0.0);
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v20 + 296LL))(v20, v86);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v11 + 456LL))(v11, v20);
if ( (*(_BYTE *)&v88.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v88.__r_.__value_.__l.__data_);
}
else
{
v18 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_newBest_001.png");
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v11 + 456LL))(v11, v18);
sub_100278250(&v88, 0.5, 0.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v18 + 296LL))(v18, &v88);
}
}
v21 = sub_10088E820("%i%%", v71);
CString = cocos2d::CCString::getCString(v21);
v23 = cocos2d::CCLabelBMFont::create_3(CString, "bigFont.fnt");
sub_100278250(&v88, 0.5, 1.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v23 + 296LL))(v23, &v88);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v23 + 160LL))(v23, 1.1);
sub_100278250(&v88, 0.0, -4.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v23 + 184LL))(v23, &v88);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v11 + 456LL))(v11, v23);
v24 = 0;
v80 = a1;
if ( v12 <= 0 )
{
v91 = -5.0;
v85 = v11;
if ( SLODWORD(v89) <= 0 )
goto LABEL_19;
LABEL_22:
v25 = sub_10088E820("+%i", v72);
v26 = cocos2d::CCString::getCString(v25);
v27 = cocos2d::CCLabelBMFont::create_3(v26, "bigFont.fnt");
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v27 + 160LL))(v27, 0.60000002);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v11 + 456LL))(v11, v27);
v28 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigDiamond_001.png");
sub_100278250(&v88, 0.0, 0.5);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v28 + 296LL))(v28, &v88);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v28 + 160LL))(v28, 0.55000001);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v11 + 456LL))(v11, v28);
if ( !(_BYTE)v84 )
{
v29 = FMODAudioEngine::sharedEngine(COERCE_DOUBLE(1057803469));
v75 = 20;
strcpy(v76, "gold02.ogg");
FMODAudioEngine::playEffect_1(v29, &v75);
if ( (v75 & 1) != 0 )
operator delete(*(void **)&v76[15]);
}
if ( v12 <= 0 )
{
LODWORD(v87) = *(_DWORD *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v27 + 328LL))(v27);
v31 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v27 + 168LL))(v27);
*(float *)&v87 = (float)(v31 * *(float *)&v87) + 1.0;
v92 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v28 + 328LL))(v28);
v32 = LODWORD(v92);
*(double *)&v32 = (*(double (__fastcall **)(__int64))(*(_QWORD *)v28 + 168LL))(v28);
v33 = v32;
*(float *)&v33 = (float)((float)(*(float *)&v32 * v92) + *(float *)&v87) * 0.5;
v87 = v33;
v92 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v27 + 328LL))(v27);
*(float *)&v32 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v27 + 168LL))(v27);
v30 = -(float)(*(float *)&v87 - (float)((float)(*(float *)&v32 * v92) * 0.5));
}
else
{
v30 = 40.0;
}
sub_100278250(&v88, v30 + v91, -62.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v27 + 184LL))(v27, &v88);
v34 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v27 + 192LL))(v27);
*(float *)&v87 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v27 + 328LL))(v27) * 0.5;
v35 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v27 + 168LL))(v27);
sub_100278250(v86, (float)(v35 * *(float *)&v87) + 1.0, -1.0);
sub_100278350(&v88, v34, v86);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v28 + 184LL))(v28, &v88);
if ( v12 <= 0 )
goto LABEL_35;
goto LABEL_29;
}
LOBYTE(v24) = SLODWORD(v89) > 0;
v91 = flt_100A040F8[v24];
v85 = v11;
if ( SLODWORD(v89) > 0 )
goto LABEL_22;
LABEL_19:
if ( v12 <= 0 )
goto LABEL_40;
LABEL_29:
v36 = sub_10088E820("+%i", v72);
v37 = cocos2d::CCString::getCString(v36);
v38 = cocos2d::CCLabelBMFont::create_3(v37, "bigFont.fnt");
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v38 + 160LL))(v38, 0.60000002);
v39 = v85;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v85 + 456LL))(v85, v38);
v40 = cocos2d::CCSprite::createWithSpriteFrameName("currencyOrbIcon_001.png");
sub_100278250(&v88, 0.0, 0.5);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v40 + 296LL))(v40, &v88);
v41 = (*(double (__fastcall **)(__int64, __int64))(*(_QWORD *)v39 + 456LL))(v39, v40);
v42 = FMODAudioEngine::sharedEngine(v41);
strcpy((char *)v77, "$magicExplosion.ogg");
FMODAudioEngine::playEffect_1(v42, v77);
if ( ((__int64)v77[0] & 1) != 0 )
operator delete(v77[2]);
if ( SLODWORD(v89) <= 0 )
{
LODWORD(v87) = *(_DWORD *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v38 + 328LL))(v38);
v44 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v38 + 168LL))(v38);
*(float *)&v87 = (float)(v44 * *(float *)&v87) + 5.0;
v92 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v40 + 328LL))(v40);
v45 = LODWORD(v92);
*(double *)&v45 = (*(double (__fastcall **)(__int64))(*(_QWORD *)v40 + 168LL))(v40);
v46 = v45;
*(float *)&v46 = (float)((float)(*(float *)&v45 * v92) + *(float *)&v87) * 0.5;
v87 = v46;
v92 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v38 + 328LL))(v38);
*(float *)&v45 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v38 + 168LL))(v38);
v43 = -(float)(*(float *)&v87 - (float)((float)(*(float *)&v45 * v92) * 0.5));
}
else
{
v43 = -40.0;
}
sub_100278250(&v88, v91 + v43, -62.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v38 + 184LL))(v38, &v88);
v47 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v38 + 192LL))(v38);
v91 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v38 + 328LL))(v38) * 0.5;
v48 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v38 + 168LL))(v38);
sub_100278250(v86, (float)(v48 * v91) + 5.0, -0.5);
sub_100278350(&v88, v47, v86);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v40 + 184LL))(v40, &v88);
LABEL_35:
v49 = v80;
cocos2d::CCNode::convertToWorldSpace(&v88, v80[407], &unk_100BE1088);
v50 = v84;
v51 = (unsigned __int8)v84;
LODWORD(v91) = 9 * (unsigned __int8)v84;
sub_1002782D0(v86, &v88);
v52 = CurrencyRewardLayer::create(v83, 0, 0, LODWORD(v89), LODWORD(v91), v51, 0, 0, (__int64)v86, 0);
(*(void (__fastcall **)(_QWORD *, __int64, __int64, double, float))(*v49 + 464LL))(v49, v52, 101, 0.0, 0.89999998);
if ( v50 )
{
v53 = FMODAudioEngine::sharedEngine(0.0);
v78 = 26;
strcpy(v79, "secretKey.ogg");
FMODAudioEngine::playEffect_1(v53, &v78);
if ( (v78 & 1) != 0 )
operator delete(*(void **)&v79[15]);
}
if ( !(_BYTE)v82 )
*(_QWORD *)(v52 + 408) = v49 + 1750;
LABEL_40:
v89 = flt_100A040F0[v90];
v54 = v85;
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v85 + 160LL))(v85, 0.0099999998);
v55 = cocos2d::CCScaleTo::create_1(0.40000001, 1.0);
v56 = cocos2d::CCEaseElasticOut::create(v55, 0.60000002);
v57 = cocos2d::CCDelayTime::create(v89);
v58 = cocos2d::CCScaleTo::create(0.2, 0.0099999998, 0.0099999998);
v59 = cocos2d::CCEaseIn::create(v58, 2.0);
v60 = cocos2d::CCHide::create();
v61 = cocos2d::CCCallFunc::create(v54, 537, 0);
v62 = sub_10039EB60(v56, v57, v59, v60, v61, 0);
result = cocos2d::CCNode::runAction(v54, v62);
if ( v81 > 0 )
{
*(_DWORD *)&v88.__r_.__value_.__l.0 = 0;
v64 = cocos2d::CCLayerColor::create_1(&v88);
(*(void (__fastcall **)(_QWORD *, __int64, __int64))(*v80 + 464LL))(v80, v64, 99);
v65 = cocos2d::CCFadeTo::create(100, 0.30000001);
v66 = cocos2d::CCDelayTime::create(1.5999999);
v67 = cocos2d::CCFadeTo::create(0, 0.40000001);
v68 = cocos2d::CCCallFunc::create(v64, 537, 0);
v70 = sub_10039EB60(v65, v66, v67, v68, 0, v69);
return cocos2d::CCNode::runAction(v64, v70);
}
return result;
}