//
// PlayLayer::updateAttempts from 0x1403b9ba0 to 0x1403b9dd8 (568 bytes)
//
// 2 xrefs:
// > PlayLayer::resetLevel @ 0x1403b97f1
// > ??> @ 0x1406d70b8
//
// 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
//
// Hidden C++ exception states: #wind=8
void PlayLayer::updateAttempts(PlayLayer *a1)
{
float v1; // xmm0_4
_DWORD *v3; // rcx
_DWORD *v4; // rbx
cocos2d::CCString *v5; // rax
const char *CString; // rax
__int64 v7; // rcx
cocos2d::CCDirector *v8; // rax
cocos2d::CCLabelBMFont_vtbl *v9; // rbx
const cocos2d::CCPoint *v10; // rax
GameManager *v11; // rcx
GameManager *v12; // rcx
_BOOL8 v13; // rdx
float v14; // [rsp+30h] [rbp+8h]
void *v15; // [rsp+38h] [rbp+10h]
void *v16; // [rsp+38h] [rbp+10h]
void *v17; // [rsp+40h] [rbp+18h]
void *v18; // [rsp+40h] [rbp+18h]
++a1->m_attempts;
v3 = (_DWORD *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v15 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v3 = (_DWORD *)qword_1406C2ED8;
}
v4 = v3;
if ( !v3 )
{
v16 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v3 = (_DWORD *)qword_1406C2ED8;
}
v3[247] = v4[247] + 1;
++v3[248];
if ( !a1->m_isPracticeMode )
++v3[249];
v5 = cocos2d::CCString::createWithFormat("Attempt %i", a1->m_attempts);
CString = cocos2d::CCString::getCString(v5);
a1->m_attemptLabel->setString(&a1->m_attemptLabel->cocos2d::CCLabelProtocol, CString);
v8 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getWinSize(v8);
if ( a1->m_attempts != 1 || a1->m_isPlatformer )
{
v9 = a1->m_attemptLabel->__vftable;
cocos2d::CCPoint::CCPoint(v1, (float)((float)(v14 * 0.5) + a1->m_gameState.m_cameraPosition.x) + 50.0);
v9->setPosition_0(a1->m_attemptLabel, v10);
}
if ( a1->m_unk36cf )
goto LABEL_20;
if ( a1->m_isPracticeMode )
{
v11 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v17 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v11 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getGameVariable(v11, "0134") )
goto LABEL_20;
}
v12 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v18 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v18);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v12 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getGameVariable(v12, "0135") )
{
LABEL_20:
v13 = 0;
}
else
{
if ( a1->m_attempts <= 0 )
return;
LOBYTE(v13) = 1;
}
a1->m_attemptLabel->setVisible(a1->m_attemptLabel, v13);
}