//
// ForceBlockGameObject::calculateForceToTarget from 0x3ec670 to 0x3ec89a (554 bytes)
//
// 1 xrefs:
// > PlayerObject::touchedObject @ 0x34defa
//
// 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
//
cocos2d::CCPoint *ForceBlockGameObject::calculateForceToTarget(
cocos2d::CCPoint *__return_ptr retstr,
ForceBlockGameObject *a2,
GameObject *a3)
{
float m_force; // s19
const cocos2d::CCRect *v7; // r0
float ObjectRadius; // s18
ForceBlockGameObject_vtbl *v9; // r3
float v10; // s16
float v11; // s14
float v12; // s15
float v13; // s17
double v14; // d8
double v15; // d6
float v16; // r0
float v17; // s14
float v18; // r10
float v19; // r0
cocos2d::CCPoint v21; // [sp+4h] [bp-34h] BYREF
float v22; // [sp+Ch] [bp-2Ch] BYREF
float v23; // [sp+10h] [bp-28h]
cocos2d::CCPoint v24; // [sp+14h] [bp-24h] BYREF
cocos2d::CCPoint v25; // [sp+1Ch] [bp-1Ch] BYREF
cocos2d::CCRect v26; // [sp+24h] [bp-14h] BYREF
m_force = a2->m_force;
v7 = a2->getObjectRect(a2);
cocos2d::CCRect::CCRect(&v26, v7);
if ( a2->m_objectRadius <= 0.0 )
{
if ( v26.size.width >= v26.size.height )
ObjectRadius = v26.size.width * 0.5;
else
ObjectRadius = v26.size.height * 0.5;
}
else
{
ObjectRadius = GameObject::getObjectRadius(a2);
}
v9 = a2->EffectGameObject::EnhancedGameObject::GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( a2->m_relativeForce )
{
v9->getRealPosition(&v24, a2);
a3->getRealPosition(&v25, a3);
cocos2d::CCPoint::operator-(&v22, &v24, &v25);
v14 = atan2(v23, v22);
v15 = 3.14159265;
v12 = 0.0;
if ( ((int (__fastcall *)(ForceBlockGameObject *))a2->isFlipY)(a2) )
v15 = 0.0;
v13 = v14 + v15;
}
else
{
v10 = 90.0 - COERCE_FLOAT(((int (__fastcall *)(ForceBlockGameObject *))v9->getRotationX)(a2));
v11 = 0.0;
v12 = 180.0;
if ( ((int (__fastcall *)(ForceBlockGameObject *))a2->isFlipY)(a2) )
v11 = 180.0;
v13 = (float)(v10 + v11) * 0.017453;
}
if ( a2->m_forceRange )
{
if ( a2->m_relativeForce )
{
a2->getRealPosition(&v24, a2);
a3->getRealPosition(&v25, a3);
v16 = cocos2d::ccpDistance(&v24, &v25);
v17 = v16;
if ( v16 >= ObjectRadius )
v12 = 0.0;
else
v17 = v16 / ObjectRadius;
if ( v16 < ObjectRadius )
v12 = 1.0 - v17;
}
else
{
v18 = cosf(v13);
v19 = sinf(v13);
cocos2d::CCPoint::CCPoint(&v21, v18, v19);
a2->getRealPosition(&v24, a2);
a3->getRealPosition(&v25, a3);
cocos2d::CCPoint::operator-(&v22, &v24, &v25);
v12 = (float)((float)((float)((float)(v23 * v21.y) + (float)(v22 * v21.x)) + ObjectRadius) / ObjectRadius) * 0.5;
}
m_force = a2->m_minForce + (float)((float)(a2->m_maxForce - a2->m_minForce) * cocos2d::clampf(v12, 0.0, 1.0));
}
cocos2d::ccpForAngle(&v25, v13);
cocos2d::CCPoint::operator*(retstr, &v25, LODWORD(m_force));
return retstr;
}