//
// PlayLayer::updateAttempts from 0x1000bef60 to 0x1000bf0ec (396 bytes)
//
// 2 xrefs:
// > PlayLayer::resetLevel @ 0x1000bec25
// > PlayLayer::resetLevel @ 0x1000bec7e
//
// 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::updateAttempts(PlayLayer *a1)
{
GameManager *v1; // r14
GameManager *v2; // r14
GameManager *v3; // r14
cocos2d::CCString *v4; // rax
const char *CString; // rax
cocos2d::CCLabelBMFont *m_attemptLabel; // r14
GameManager *v7; // rax
GameManager *v8; // rax
unsigned __int8 v9; // al
char v10; // [rsp+0h] [rbp-30h]
_BYTE v11[8]; // [rsp+8h] [rbp-28h] BYREF
float v12[8]; // [rsp+10h] [rbp-20h] BYREF
cocos2d::CCSize WinSize; // 0:xmm0_8.8
++a1->m_attempts;
v1 = GameManager::sharedState();
v1->m_sessionAttempts = GameManager::sharedState()->m_sessionAttempts + 1;
v2 = GameManager::sharedState();
v2->m_sessionAttempts2 = GameManager::sharedState()->m_sessionAttempts2 + 1;
if ( !a1->m_isPracticeMode )
{
v3 = GameManager::sharedState();
v3->m_sessionNormalAttempts = GameManager::sharedState()->m_sessionNormalAttempts + 1;
}
v4 = (cocos2d::CCString *)sub_1007AB580("Attempt %i", v10);
CString = cocos2d::CCString::getCString(v4);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_attemptLabel->setString)(
a1->m_attemptLabel,
CString);
cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v12);
if ( a1->m_attempts != 1 || a1->m_isPlatformer )
{
m_attemptLabel = a1->m_attemptLabel;
WinSize = (cocos2d::CCSize)LODWORD(v12[0]);
WinSize.width = (float)((float)(v12[0] * 0.5) + a1->m_gameState.m_cameraPosition.x) + 50.0;
sub_10028CBE0(v11, WinSize.width, (float)((float)(0.5 * v12[1]) + a1->m_gameState.m_cameraPosition.y) + 85.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _BYTE *))m_attemptLabel->setPosition)(m_attemptLabel, v11);
}
if ( a1->m_unk36cf
|| a1->m_isPracticeMode && (v7 = GameManager::sharedState(), GameManager::getGameVariable(v7, "0134"))
|| (v8 = GameManager::sharedState(), GameManager::getGameVariable(v8, "0135")) )
{
v9 = 0;
LABEL_11:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _QWORD, double))a1->m_attemptLabel->setVisible)(
a1->m_attemptLabel,
v9,
*(double *)&WinSize);
return;
}
v9 = 1;
if ( a1->m_attempts > 0 )
goto LABEL_11;
}