//
// GJBaseGameLayer::recordHitboxTrailState from 0x140317690 to 0x140317895 (517 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::update @ 0x140341443
// > GJBaseGameLayer::update @ 0x140341469
// > ??> @ 0x14091e9b0
//
// 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:30:18 +0000
//
__int64 __fastcall GJBaseGameLayer::recordHitboxTrailState(__int64 *a1, _BYTE *a2, __int64 a3, int *a4)
{
const struct cocos2d::CCRect *v8; // rax
float MidY; // xmm6_4
float MidX; // xmm0_4
__int64 v11; // rax
__int64 v12; // rax
float v13; // xmm0_4
__int64 v14; // rax
int v15; // eax
int v16; // esi
__int64 v17; // rbp
int v18; // edx
__int64 v19; // rbx
__int64 result; // rax
__int64 v21; // rbx
__int64 v22; // rbx
_BYTE v23[8]; // [rsp+20h] [rbp-58h] BYREF
float v24; // [rsp+28h] [rbp-50h]
_BYTE v25[8]; // [rsp+30h] [rbp-48h] BYREF
float v26; // [rsp+38h] [rbp-40h]
float v27; // [rsp+3Ch] [rbp-3Ch]
unsigned __int8 v28; // [rsp+40h] [rbp-38h]
char v29; // [rsp+80h] [rbp+8h] BYREF
v8 = (const struct cocos2d::CCRect *)(*(__int64 (__fastcall **)(_BYTE *))(*(_QWORD *)a2 + 1184LL))(a2);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v23, v8);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v25);
MidY = cocos2d::CCRect::getMidY((cocos2d::CCRect *)v23);
MidX = cocos2d::CCRect::getMidX((cocos2d::CCRect *)v23);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, MidX, MidY);
cocos2d::CCPoint::operator=(v25, v11);
v12 = *(_QWORD *)a2;
v26 = v24;
v13 = (*(float (__fastcall **)(_BYTE *))(v12 + 1424))(a2);
v28 = a2[2445];
v14 = *a1;
v27 = v13;
v15 = (*(__int64 (__fastcall **)(__int64 *))(v14 + 1184))(a1);
v16 = v15;
v17 = (*(_QWORD *)(a3 + 8) - *(_QWORD *)a3) / 20LL;
if ( (int)v17 <= 0
|| ((int)v17 < v15 ? (v18 = v17 - 1) : (v18 = (v15 + *a4 - 1) % v15),
(v19 = *(_QWORD *)a3 + 20LL * v18,
!cocos2d::CCPoint::equals((cocos2d::CCPoint *)v19, (const struct cocos2d::CCPoint *)v25))
|| *(float *)(v19 + 12) != v27
|| *(float *)(v19 + 8) != v26
|| (result = v28, *(_BYTE *)(v19 + 16) != v28)) )
{
if ( (int)v17 >= v16 )
{
v22 = *(_QWORD *)a3 + 20LL * *a4;
cocos2d::CCPoint::operator=(v22, v25);
*(float *)(v22 + 8) = v26;
*(float *)(v22 + 12) = v27;
*(_BYTE *)(v22 + 16) = v28;
result = (unsigned int)((*a4 + 1) / v16);
*a4 = (*a4 + 1) % v16;
}
else
{
v21 = *(_QWORD *)(a3 + 8);
if ( v21 == *(_QWORD *)(a3 + 16) )
{
result = sub_14035BC80(a3, *(_QWORD *)(a3 + 8), v25);
}
else
{
cocos2d::CCPoint::CCPoint(*(cocos2d::CCPoint **)(a3 + 8), (const struct cocos2d::CCPoint *)v25);
*(float *)(v21 + 8) = v26;
*(float *)(v21 + 12) = v27;
result = v28;
*(_BYTE *)(v21 + 16) = v28;
*(_QWORD *)(a3 + 8) += 20LL;
}
}
*((_BYTE *)a1 + 14536) = 1;
}
return result;
}