//
// GameStatsManager::checkCoinAchievement from 0x10006cdf0 to 0x10006d24c (1116 bytes)
//
// 4 xrefs:
// > PlayLayer::levelComplete @ 0x1000b3d3e
// > GameManager::dataLoaded @ 0x10038a35e
// > GameManager::dataLoaded @ 0x10038a385
// > GameManager::dataLoaded @ 0x10038a3ac
//
// 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 GameStatsManager::checkCoinAchievement(GameStatsManager *a1, GJGameLevel *a2)
{
__m128 v2; // xmm0
int v3; // eax
const char *CoinKey; // rax
_BOOL4 hasSecretCoin; // r15d
const char *v6; // rax
int v7; // r12d
const char *v8; // rax
int v9; // ebx
GameManager *v10; // rax
int v11; // edx
const char *v12; // rsi
const char *v13; // rax
_BOOL4 v14; // r15d
const char *v15; // rax
int v16; // r12d
const char *v17; // rax
int v18; // ebx
GameManager *v19; // rax
const char *v20; // rax
_BOOL4 v21; // r15d
const char *v22; // rax
int v23; // r12d
const char *v24; // rax
const char *v25; // rax
_BOOL4 v26; // r15d
const char *v27; // rax
int v28; // r12d
const char *v29; // rax
int v30; // ebx
const char *v31; // rax
_BOOL4 v32; // r15d
const char *v33; // rax
int v34; // r12d
const char *v35; // rax
int v36; // ebx
const char *v37; // rax
_BOOL4 v38; // r15d
const char *v39; // rax
int v40; // r12d
const char *v41; // rax
int v42; // ebx
GameManager *v43; // rdi
const char *v44; // rax
_BOOL4 v45; // r15d
const char *v46; // rax
int v47; // r12d
const char *v48; // rax
if ( a2->m_levelType == Main )
{
v3 = a2->m_levelID.random - a2->m_levelID.seed;
if ( v3 > 5000 )
{
switch ( v3 )
{
case 5001:
CoinKey = GJGameLevel::getCoinKey(a2, 1);
hasSecretCoin = GameStatsManager::hasSecretCoin(a1, CoinKey);
v6 = GJGameLevel::getCoinKey(a2, 2);
v7 = hasSecretCoin + GameStatsManager::hasSecretCoin(a1, v6);
v8 = GJGameLevel::getCoinKey(a2, 3);
v9 = v7 + GameStatsManager::hasSecretCoin(a1, v8);
v10 = GameManager::sharedState();
v2.f32[0] = (float)((float)v9 / 3.0) * 100.0;
v11 = (int)_mm_round_ss(v2, v2, 9).f32[0];
v12 = "geometry.ach.tower01Coin";
goto LABEL_14;
case 5002:
v37 = GJGameLevel::getCoinKey(a2, 1);
v38 = GameStatsManager::hasSecretCoin(a1, v37);
v39 = GJGameLevel::getCoinKey(a2, 2);
v40 = v38 + GameStatsManager::hasSecretCoin(a1, v39);
v41 = GJGameLevel::getCoinKey(a2, 3);
v42 = v40 + GameStatsManager::hasSecretCoin(a1, v41);
v10 = GameManager::sharedState();
v2.f32[0] = (float)((float)v42 / 3.0) * 100.0;
v11 = (int)_mm_round_ss(v2, v2, 9).f32[0];
v12 = "geometry.ach.tower02Coin";
goto LABEL_14;
case 5003:
v25 = GJGameLevel::getCoinKey(a2, 1);
v26 = GameStatsManager::hasSecretCoin(a1, v25);
v27 = GJGameLevel::getCoinKey(a2, 2);
v28 = v26 + GameStatsManager::hasSecretCoin(a1, v27);
v29 = GJGameLevel::getCoinKey(a2, 3);
v30 = v28 + GameStatsManager::hasSecretCoin(a1, v29);
v10 = GameManager::sharedState();
v2.f32[0] = (float)((float)v30 / 3.0) * 100.0;
v11 = (int)_mm_round_ss(v2, v2, 9).f32[0];
v12 = "geometry.ach.tower03Coin";
goto LABEL_14;
case 5004:
v31 = GJGameLevel::getCoinKey(a2, 1);
v32 = GameStatsManager::hasSecretCoin(a1, v31);
v33 = GJGameLevel::getCoinKey(a2, 2);
v34 = v32 + GameStatsManager::hasSecretCoin(a1, v33);
v35 = GJGameLevel::getCoinKey(a2, 3);
v36 = v34 + GameStatsManager::hasSecretCoin(a1, v35);
v10 = GameManager::sharedState();
v2.f32[0] = (float)((float)v36 / 3.0) * 100.0;
v11 = (int)_mm_round_ss(v2, v2, 9).f32[0];
v12 = "geometry.ach.tower04Coin";
LABEL_14:
v43 = v10;
goto LABEL_17;
default:
return;
}
}
switch ( v3 )
{
case 14:
v20 = GJGameLevel::getCoinKey(a2, 1);
v21 = GameStatsManager::hasSecretCoin(a1, v20);
v22 = GJGameLevel::getCoinKey(a2, 2);
v23 = v21 + GameStatsManager::hasSecretCoin(a1, v22);
v24 = GJGameLevel::getCoinKey(a2, 3);
v2.f32[0] = (float)((float)(v23 + GameStatsManager::hasSecretCoin(a1, v24)) / 3.0) * 100.0;
v18 = (int)fminf(_mm_round_ss(v2, v2, 9).f32[0], 100.0);
v19 = GameManager::sharedState();
v12 = "geometry.ach.demoncoin01";
break;
case 18:
v44 = GJGameLevel::getCoinKey(a2, 1);
v45 = GameStatsManager::hasSecretCoin(a1, v44);
v46 = GJGameLevel::getCoinKey(a2, 2);
v47 = v45 + GameStatsManager::hasSecretCoin(a1, v46);
v48 = GJGameLevel::getCoinKey(a2, 3);
v2.f32[0] = (float)((float)(v47 + GameStatsManager::hasSecretCoin(a1, v48)) / 3.0) * 100.0;
v18 = (int)fminf(_mm_round_ss(v2, v2, 9).f32[0], 100.0);
v19 = GameManager::sharedState();
v12 = "geometry.ach.demoncoin02";
break;
case 20:
v13 = GJGameLevel::getCoinKey(a2, 1);
v14 = GameStatsManager::hasSecretCoin(a1, v13);
v15 = GJGameLevel::getCoinKey(a2, 2);
v16 = v14 + GameStatsManager::hasSecretCoin(a1, v15);
v17 = GJGameLevel::getCoinKey(a2, 3);
v2.f32[0] = (float)((float)(v16 + GameStatsManager::hasSecretCoin(a1, v17)) / 3.0) * 100.0;
v18 = (int)fminf(_mm_round_ss(v2, v2, 9).f32[0], 100.0);
v19 = GameManager::sharedState();
v12 = "geometry.ach.demoncoin03";
break;
default:
return;
}
v43 = v19;
v11 = v18;
LABEL_17:
GameManager::reportAchievementWithID(v43, v12, v11, 0);
}
}