//
// ProfilePage::onFollow from 0x1001976cc to 0x1001978a0 (468 bytes)
//
// 1 xrefs:
// > ProfilePage::init @ 0x1001970a8
//
// 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 ProfilePage::onFollow(ProfilePage *a1, cocos2d::CCObject *a2)
{
GameManager *v3; // x0
GameLevelManager *v4; // x0
bool isFollowingUser; // w20
GameLevelManager *v6; // x0
const char *v7; // x20
signed int v8; // w20
float v9; // s8
GameManager *v10; // x0
GameManager *v11; // x0
GameManager *v12; // x0
GameLevelManager *v13; // x0
__int64 v14; // x19
cocos2d::CCSpriteFrameCache *v15; // x0
cocos2d::CCSpriteFrame *v16; // x0
cocos2d::CCString *v17; // x0
char *CString; // x0
__int64 v19; // x19
void *__p[2]; // [xsp+8h] [xbp-48h] BYREF
char v21; // [xsp+1Fh] [xbp-31h]
v3 = GameManager::sharedState();
GameManager::reportAchievementWithID(v3, "geometry.ach.followCreator", 100, 0);
v4 = GameLevelManager::sharedState();
isFollowingUser = GameLevelManager::isFollowingUser(v4, a1->m_accountID);
v6 = GameLevelManager::sharedState();
if ( isFollowingUser )
{
GameLevelManager::unfollowUser(v6, a1->m_accountID);
v7 = "gj_heartOff_001.png";
LABEL_5:
v14 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_followBtn->getNormalImage)(a1->m_followBtn);
v15 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v16 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v15, v7);
(*(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v14 + 1144LL))(v14, v16);
return;
}
v8 = cocos2d::CCDictionary::count(v6->m_followedCreators);
v9 = (float)(v8 + 1);
v10 = GameManager::sharedState();
GameManager::reportAchievementWithID(
v10,
"geometry.ach.followCreator02",
vcvtms_s32_f32((float)(v9 / 10.0) * 100.0),
0);
v11 = GameManager::sharedState();
GameManager::reportAchievementWithID(
v11,
"geometry.ach.followCreator03",
vcvtms_s32_f32((float)(v9 / 25.0) * 100.0),
0);
v12 = GameManager::sharedState();
GameManager::reportAchievementWithID(
v12,
"geometry.ach.followCreator04",
vcvtms_s32_f32((float)(v9 / 50.0) * 100.0),
0);
if ( v8 < 100 )
{
v13 = GameLevelManager::sharedState();
GameLevelManager::followUser(v13, a1->m_accountID);
v7 = "gj_heartOn_001.png";
goto LABEL_5;
}
v17 = (cocos2d::CCString *)sub_100268F4C("You can only follow %i users at the same time.", 100);
CString = (char *)cocos2d::CCString::getCString(v17);
sub_100009900(__p, CString);
v19 = sub_1002ABCCC(0, "Max Followed", __p, "OK", 0);
if ( v21 < 0 )
operator delete(__p[0]);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v19 + 1288LL))(v19);
}