//
// PlayLayer::updateAttempts from 0x5d08c0 to 0x5d0a9c (476 bytes)
//
// 3 xrefs:
// > PlayLayer::resetLevel @ 0x5e5668
// > PlayLayer::resetLevel @ 0x5e5aa0
// > ??> @ 0x3e880
//
// 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 PlayLayer::updateAttempts(PlayLayer *a1)
{
float *v2; // x21
GameManager *v3; // x22
GameManager *v4; // x22
GameManager *v5; // x0
int v6; // w1
cocos2d::CCString *v7; // x0
const unsigned __int8 *CString; // x0
cocos2d::CCDirector *v9; // x0
cocos2d::CCLabelBMFont *m_attemptLabel; // x22
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
GameManager *v12; // x0
GameManager *v13; // x0
GameManager *v14; // x22
float v15; // [xsp+58h] [xbp+58h]
float v16; // [xsp+5Ch] [xbp+5Ch]
cocos2d::CCPoint v17; // [xsp+60h] [xbp+60h] BYREF
v2 = &a1->m_varianceValues.__elems_[1975];
++a1->m_attempts;
v3 = GameManager::sharedState();
v3->m_sessionAttempts = GameManager::sharedState()->m_sessionAttempts + 1;
v4 = GameManager::sharedState();
v5 = GameManager::sharedState();
v6 = *((unsigned __int8 *)v2 + 592);
v4->m_sessionAttempts2 = v5->m_sessionAttempts2 + 1;
if ( !v6 )
{
v14 = GameManager::sharedState();
v14->m_sessionNormalAttempts = GameManager::sharedState()->m_sessionNormalAttempts + 1;
}
v7 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Attempt %i",
(const char *)(unsigned int)a1->m_attempts);
CString = (const unsigned __int8 *)cocos2d::CCString::getCString(v7);
a1->m_attemptLabel->setString(a1->m_attemptLabel, CString);
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v9);
if ( a1->m_attempts != 1 || *((_BYTE *)v2 + 270) )
{
m_attemptLabel = a1->m_attemptLabel;
setPosition = m_attemptLabel->setPosition;
cocos2d::CCPoint::CCPoint(
&v17,
(float)(a1->m_gameState.m_cameraPosition.x + (float)(v15 * 0.5)) + 50.0,
(float)(a1->m_gameState.m_cameraPosition.y + (float)(v16 * 0.5)) + 85.0);
setPosition(m_attemptLabel, &v17);
}
if ( *((_BYTE *)v2 + 1951)
|| *((_BYTE *)v2 + 592) && (v12 = GameManager::sharedState(), GameManager::getGameVariable(v12, "0134"))
|| (v13 = GameManager::sharedState(), GameManager::getGameVariable(v13, "0135")) )
{
a1->m_attemptLabel->setVisible(a1->m_attemptLabel, 0);
}
else if ( a1->m_attempts > 0 )
{
a1->m_attemptLabel->setVisible(a1->m_attemptLabel, 1);
}
}