//
// GJBaseGameLayer::hasUniqueCoin from 0x100128a10 to 0x100128b03 (243 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::collisionCheckObjects @ 0x100127094
// > GJBaseGameLayer::collisionCheckObjects @ 0x100127277
// > GameObject::playDestroyObjectAnim @ 0x10025e618
// > EnhancedGameObject::updateUserCoin @ 0x1005c1aaa
//
// 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
//
bool __fastcall GJBaseGameLayer::hasUniqueCoin(GJBaseGameLayer *a1, EffectGameObject *a2)
{
GJGameLevel *m_level; // rdi
int m_secretCoinID; // eax
int v5; // ecx
const char *CoinKey; // r14
GJLevelType m_levelType; // ebx
GameStatsManager *v8; // rdi
bool result; // al
bool hasUserCoin; // cl
GameStatsManager *v11; // rax
m_level = a1->m_level;
if ( m_level->m_levelType == Editor )
{
if ( ((unsigned int (__fastcall *)(EffectGameObject *))a2->getType)(a2) == 31 )
{
m_secretCoinID = a2->m_secretCoinID;
switch ( m_secretCoinID )
{
case 3:
v5 = a1->m_level->m_thirdCoinVerified.random - a1->m_level->m_thirdCoinVerified.seed;
return v5 == 1;
case 2:
v5 = a1->m_level->m_secondCoinVerified.random - a1->m_level->m_secondCoinVerified.seed;
return v5 == 1;
case 1:
v5 = a1->m_level->m_firstCoinVerified.random - a1->m_level->m_firstCoinVerified.seed;
return v5 == 1;
}
}
return 0;
}
else
{
CoinKey = GJGameLevel::getCoinKey(m_level, a2->m_secretCoinID);
m_levelType = a1->m_level->m_levelType;
v8 = GameStatsManager::sharedState();
if ( m_levelType == Main )
{
return GameStatsManager::hasSecretCoin(v8, CoinKey);
}
else
{
hasUserCoin = GameStatsManager::hasUserCoin(v8, CoinKey);
result = 1;
if ( !hasUserCoin )
{
v11 = GameStatsManager::sharedState();
return GameStatsManager::hasPendingUserCoin(v11, CoinKey);
}
}
}
return result;
}