//
// sub_140403260 from 0x140403260 to 0x140403508 (680 bytes)
//
// 3 xrefs:
// > sub_140406240 @ 0x140406481
// > sub_140406240 @ 0x140406b53
// > ??> @ 0x140925bc8
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:31:55 +0000
//
double __fastcall sub_140403260(cocos2d::CCDrawNode *a1, float *a2, float *a3, __int64 a4, __int64 a5)
{
float v8; // xmm7_4
float v9; // xmm8_4
float v10; // xmm1_4
double result; // xmm0_8
float v12; // xmm6_4
float v13; // xmm3_4
double v14; // xmm6_8
float v15; // xmm1_4
float v16; // xmm7_4
float v17[2]; // [rsp+38h] [rbp-61h] BYREF
_BYTE v18[8]; // [rsp+40h] [rbp-59h] BYREF
_BYTE v19[8]; // [rsp+48h] [rbp-51h] BYREF
_BYTE v20[8]; // [rsp+50h] [rbp-49h] BYREF
_BYTE v21[8]; // [rsp+58h] [rbp-41h] BYREF
_DWORD v22[2]; // [rsp+60h] [rbp-39h] BYREF
_BYTE v23[8]; // [rsp+68h] [rbp-31h] BYREF
_BYTE v24[8]; // [rsp+70h] [rbp-29h] BYREF
_BYTE v25[80]; // [rsp+78h] [rbp-21h] BYREF
cocos2d::CCPoint::operator-(a3, v22, a2);
v8 = *(float *)&v22[1];
v9 = *(float *)v22;
v10 = (float)(v8 * v8) + (float)(v9 * v9);
result = 0.0;
if ( v10 < 0.0 )
{
HIDWORD(result) = 0;
*(float *)&result = sqrtf(v10);
v12 = *(float *)&result;
}
else
{
v12 = fsqrt(v10);
}
if ( v12 >= 0.001 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v17, v9 / v12, v8 / v12);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v23, -v17[1], v17[0]);
v13 = *(double *)&qword_14090C060;
if ( !byte_1409097DE && v12 > 1000.0 )
{
v14 = fminf(v12 / 1000.0, 10.0);
v15 = fmod(dbl_14090C058, v14) / v14;
v13 = 1.0 - v15;
}
v16 = 1.0 - v13;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v18,
(float)(v13 * *a2) + (float)((float)(1.0 - v13) * *a3),
(float)((float)(1.0 - v13) * a3[1]) + (float)(v13 * a2[1]));
cocos2d::CCPoint::operator*(v23, v19);
cocos2d::CCPoint::operator*(v17, v20);
cocos2d::CCPoint::operator+(v20, v21, v19);
cocos2d::CCPoint::operator-(v18, v24, v21);
cocos2d::CCPoint::operator*(v23, v21);
cocos2d::CCPoint::operator*(v17, v20);
cocos2d::CCPoint::operator-(v20, v19, v21);
cocos2d::CCPoint::operator-(v18, v25, v19);
cocos2d::CCDrawNode::drawSegment(
a1,
(const struct cocos2d::CCPoint *)a2,
(const struct cocos2d::CCPoint *)a3,
1.0,
(const struct cocos2d::_ccColor4F *)a5);
if ( (float)(1.0 - v13) >= 0.050000001 )
{
if ( v16 > 0.94999999 )
*(float *)(a5 + 12) = (float)((float)(1.0 - v16) / 0.050000001) * *(float *)(a5 + 12);
}
else
{
*(float *)(a5 + 12) = (float)(v16 / 0.050000001) * *(float *)(a5 + 12);
}
cocos2d::CCDrawNode::drawSegment(
a1,
(const struct cocos2d::CCPoint *)v18,
(const struct cocos2d::CCPoint *)v24,
1.0,
(const struct cocos2d::_ccColor4F *)a5);
return cocos2d::CCDrawNode::drawSegment(
a1,
(const struct cocos2d::CCPoint *)v18,
(const struct cocos2d::CCPoint *)v25,
1.0,
(const struct cocos2d::_ccColor4F *)a5);
}
return result;
}