//
// cocos2d::CCFollow::initWithTarget from 0x5b0110 to 0x5b0252 (322 bytes)
//
// 1 xrefs:
// > cocos2d::CCFollow::create @ 0x5b02a4
//
// 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 cocos2d::CCFollow::initWithTarget(cocos2d::CCFollow *a1, cocos2d::CCNode *a2, const cocos2d::CCRect *a3)
{
char v6; // r0
cocos2d::CCDirector *v7; // r0
int v8; // r2
bool v9; // r3
int v10; // r2
bool v11; // r3
float x; // s12
float y; // s13
float height; // s11
int v15; // s10
cocos2d::CCObjectType v16; // s15
int v17; // s14
float v18; // s13
float v19; // s11
bool v20; // nf
float v21; // s13
int v22; // s11
bool v23; // fnf
int v24; // s14
cocos2d::CCSize v26; // [sp+4h] [bp-14h] BYREF
cocos2d::CCPoint v27; // [sp+Ch] [bp-Ch] BYREF
cocos2d::CCObject::retain(a2);
a1[1].__vftable = (cocos2d::CCFollow_vtbl *)a2;
v6 = cocos2d::CCRect::equals((cocos2d::CCRect *)a3, &stru_AC85AC);
BYTE1(a1[1].m_uID) = 0;
LOBYTE(a1[1].m_uID) = v6 ^ 1;
v7 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v26, v7);
cocos2d::CCPoint::CCPoint(&v27, v26.width, v26.height);
cocos2d::CCPoint::operator=((PlayerObject *)&a1[1].m_uReference, COERCE_FLOAT(&v27), v8, v9);
cocos2d::CCPoint::operator*(&v27, &a1[1].m_uReference, 1056964608);
cocos2d::CCPoint::operator=((PlayerObject *)&a1[1].m_nLuaID, COERCE_FLOAT(&v27), v10, v11);
if ( LOBYTE(a1[1].m_uID) )
{
x = a3->origin.x;
y = a3->origin.y;
height = a3->size.height;
*(float *)&v15 = -a3->origin.x;
*(float *)&v16 = -(float)((float)(a3->origin.x + a3->size.width) - *(float *)&a1[1].m_uReference);
a1[1].m_uIndexInArray = v15;
*(float *)&v17 = -y;
a1[1].m_eObjType = v16;
v18 = y + height;
v19 = *(float *)&a1[1].m_uAutoReleaseCount;
a1[1].m_uUnknown = v17;
v20 = *(float *)&v15 < *(float *)&v16;
if ( *(float *)&v15 < *(float *)&v16 )
{
*(float *)&v16 = *(float *)&v16 - x;
x = 0.5;
}
v21 = v18 - v19;
if ( v20 )
*(float *)&v16 = *(float *)&v16 * x;
*(float *)&v22 = -v21;
if ( v20 )
a1[1].m_eObjType = v16;
v23 = *(float *)&v17 < *(float *)&v22;
if ( v20 )
a1[1].m_uIndexInArray = v16;
if ( *(float *)&v17 < *(float *)&v22 )
*(float *)&v17 = *(float *)&v17 - v21;
a1[1].m_unknown2 = v22;
if ( v23 )
{
*(float *)&v24 = *(float *)&v17 * 0.5;
a1[1].m_unknown2 = v24;
a1[1].m_uUnknown = v24;
}
if ( *(float *)&a1[1].m_uUnknown == *(float *)&a1[1].m_unknown2
&& *(float *)&a1[1].m_eObjType == *(float *)&a1[1].m_uIndexInArray )
{
BYTE1(a1[1].m_uID) = 1;
}
}
return 1;
}