//
// PlayLayer::updateAttempts from 0x100122540 to 0x1001226dc (412 bytes)
//
// 2 xrefs:
// > PlayLayer::resetLevel @ 0x1001221f8
// > PlayLayer::resetLevel @ 0x100122258
//
// 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)
{
bool *p_m_isPlatformer; // x21
GameManager *v3; // x20
GameManager *v4; // x20
GameManager *v5; // x20
cocos2d::CCString *v6; // x0
const char *CString; // x0
cocos2d::CCDirector *v8; // x0
__n128 v9; // q0
__n128 v10; // q1
cocos2d::CCLabelBMFont *m_attemptLabel; // x20
GameManager *v12; // x0
GameManager *v13; // x0
__int64 v14; // x1
_DWORD v15[4]; // [xsp+10h] [xbp-30h] BYREF
p_m_isPlatformer = &a1->m_isPlatformer;
++a1->m_attempts;
v3 = GameManager::sharedState();
v3->m_sessionAttempts = GameManager::sharedState()->m_sessionAttempts + 1;
v4 = GameManager::sharedState();
v4->m_sessionAttempts2 = GameManager::sharedState()->m_sessionAttempts2 + 1;
if ( !p_m_isPlatformer[290] )
{
v5 = GameManager::sharedState();
v5->m_sessionNormalAttempts = GameManager::sharedState()->m_sessionNormalAttempts + 1;
}
v6 = (cocos2d::CCString *)sub_100268F4C("Attempt %i", a1->m_attempts);
CString = cocos2d::CCString::getCString(v6);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_attemptLabel->setString)(
a1->m_attemptLabel,
CString);
v8 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v8);
if ( a1->m_attempts != 1 || *p_m_isPlatformer )
{
m_attemptLabel = a1->m_attemptLabel;
v9.n128_f32[0] = (float)(a1->m_gameState.m_cameraPosition.x + (float)(*(float *)&v15[2] * 0.5)) + 50.0;
v10.n128_f32[0] = (float)(a1->m_gameState.m_cameraPosition.y + (float)(*(float *)&v15[3] * 0.5)) + 85.0;
sub_100022980(v9, v10, v15);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _DWORD *))m_attemptLabel->setPosition)(m_attemptLabel, v15);
}
if ( p_m_isPlatformer[1633]
|| p_m_isPlatformer[290] && (v12 = GameManager::sharedState(), GameManager::getGameVariable(v12, "0134"))
|| (v13 = GameManager::sharedState(), GameManager::getGameVariable(v13, "0135")) )
{
v14 = 0;
LABEL_11:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))a1->m_attemptLabel->setVisible)(a1->m_attemptLabel, v14);
return;
}
if ( a1->m_attempts >= 1 )
{
v14 = 1;
goto LABEL_11;
}
}