//
// GameStatsManager::checkCoinAchievement from 0x7a2cb8 to 0x7a2e8c (468 bytes)
//
// 5 xrefs:
// > PlayLayer::levelComplete @ 0x5d122c
// > GameManager::dataLoaded @ 0x5fb448
// > GameManager::dataLoaded @ 0x5fb46c
// > GameManager::dataLoaded @ 0x5fb490
// > ??> @ 0x6a980
//
// 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 GameStatsManager::checkCoinAchievement(GameStatsManager *a1, GJGameLevel *a2)
{
int v2; // w2
int v3; // w19
GameManager *v4; // x0
float v5; // s0
const char *v6; // x1
int v7; // w2
int v8; // w0
int v9; // w2
float v10; // s0
int v11; // w0
int v12; // w2
float v13; // s0
int v14; // w19
int v15; // w19
int v16; // w0
int v17; // w2
float v18; // s0
int CollectedCoinsForLevel; // w19
int v20; // [xsp+28h] [xbp+28h]
if ( a2->m_levelType == Main )
{
v2 = a2->m_levelID.random - a2->m_levelID.seed;
if ( v2 == 5001 )
{
CollectedCoinsForLevel = GameStatsManager::getCollectedCoinsForLevel(a1, a2);
v4 = GameManager::sharedState();
v5 = (float)CollectedCoinsForLevel;
v6 = "geometry.ach.tower01Coin";
}
else
{
if ( v2 <= 5001 )
{
switch ( v2 )
{
case 18:
v16 = GameStatsManager::getCollectedCoinsForLevel(a1, a2);
v17 = 100;
v18 = floorf((float)((float)v16 / 3.0) * 100.0);
if ( v18 < 100.0 )
v17 = (int)v18;
v20 = v17;
v4 = GameManager::sharedState();
v6 = "geometry.ach.demoncoin02";
break;
case 20:
v11 = GameStatsManager::getCollectedCoinsForLevel(a1, a2);
v12 = 100;
v13 = floorf((float)((float)v11 / 3.0) * 100.0);
if ( v13 < 100.0 )
v12 = (int)v13;
v20 = v12;
v4 = GameManager::sharedState();
v6 = "geometry.ach.demoncoin03";
break;
case 14:
v8 = GameStatsManager::getCollectedCoinsForLevel(a1, a2);
v9 = 100;
v10 = floorf((float)((float)v8 / 3.0) * 100.0);
if ( v10 < 100.0 )
v9 = (int)v10;
v20 = v9;
v4 = GameManager::sharedState();
v6 = "geometry.ach.demoncoin01";
break;
default:
return;
}
v7 = v20;
LABEL_10:
GameManager::reportAchievementWithID(v4, v6, v7, 0);
return;
}
if ( v2 == 5003 )
{
v15 = GameStatsManager::getCollectedCoinsForLevel(a1, a2);
v4 = GameManager::sharedState();
v5 = (float)v15;
v6 = "geometry.ach.tower03Coin";
}
else if ( v2 < 5003 )
{
v14 = GameStatsManager::getCollectedCoinsForLevel(a1, a2);
v4 = GameManager::sharedState();
v5 = (float)v14;
v6 = "geometry.ach.tower02Coin";
}
else
{
if ( v2 != 5004 )
return;
v3 = GameStatsManager::getCollectedCoinsForLevel(a1, a2);
v4 = GameManager::sharedState();
v5 = (float)v3;
v6 = "geometry.ach.tower04Coin";
}
}
v7 = vcvtms_s32_f32((float)(v5 / 3.0) * 100.0);
goto LABEL_10;
}
}