//
// cocos2d::CCFollow::initWithTarget from 0x1800242e0 to 0x180024440 (352 bytes)
//
// 3 xrefs:
// > cocos2d::CCFollow::create @ 0x180024186
// > ??> @ 0x1801438a8
// > ??> @ 0x1801af154
//
// 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 cocos2d::CCFollow::initWithTarget(
cocos2d::CCFollow *this,
struct cocos2d::CCNode *a2,
struct cocos2d::CCRect *a3)
{
cocos2d::CCDirector *v6; // rax
float *v7; // rax
float v8; // xmm2_4
float v9; // xmm4_4
float v10; // xmm1_4
float v11; // xmm3_4
bool result; // al
float v13; // [rsp+30h] [rbp+8h]
float v14; // [rsp+34h] [rbp+Ch]
int v15; // [rsp+38h] [rbp+10h] BYREF
cocos2d::CCObject::retain(a2);
*((_QWORD *)this + 10) = a2;
*((_BYTE *)this + 88) = !cocos2d::CCRect::equals(a3, &unk_1801A8370);
*((_BYTE *)this + 89) = 0;
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v6);
v7 = kmVec2Fill((float *)&v15, v13, v14);
cocos2d::CCSize::operator=((_DWORD *)this + 25, v7);
cocos2d::CCSize::operator*((float *)this + 25, (float *)&v15, 0.5);
cocos2d::CCSize::operator=((_DWORD *)this + 23, &v15);
if ( !*((_BYTE *)this + 88) )
return 1;
v8 = -(float)((float)(a3->size.width + a3->origin.x) - *((float *)this + 25));
*((float *)this + 27) = v8;
v9 = -a3->origin.x;
*((float *)this + 28) = v9;
v10 = -a3->origin.y;
*((float *)this + 29) = v10;
v11 = -(float)((float)(a3->size.height + a3->origin.y) - *((float *)this + 26));
*((float *)this + 30) = v11;
if ( v8 > v9 )
{
v8 = (float)(v9 + v8) * 0.5;
*((float *)this + 27) = v8;
v9 = v8;
*((float *)this + 28) = v8;
}
if ( v11 > v10 )
{
v10 = (float)(v10 + v11) * 0.5;
*((float *)this + 30) = v10;
v11 = v10;
*((float *)this + 29) = v10;
}
if ( v10 != v11 )
return 1;
result = 1;
if ( v8 == v9 )
*((_BYTE *)this + 89) = 1;
return result;
}